FireTextBox and DefaultPushbutton

Started by Rolf Brandt, December 08, 2010, 06:10:36 AM

Previous topic - Next topic

Rolf Brandt

I have a form that I use as a dialog box. It has 2 labels, 2 FireText boxes, a Cancel button (Cancel set to true), and an OK buttoun (DefPushButton set to true).

While the FireText boxes have the focus ESC and ENTER strokes are ignored. The Cancel button and OK button do not fire.

Solution?
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Paul Squires

Hi Rolf,

Pretty sure that I can post a solution for you...just need time to write it up. Very busy at work the past two days.
Paul Squires
PlanetSquires Software

Rolf Brandt

No rush for it, Paul,

I replaced them in the meantime with regular textboxes and configured them in the change event for numerical and currency input. But if we could get a solution for it it would be nice.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Paul Squires

Hi Rolf,

You can try adding code like the following into your FF_PUMPHOOK handler:


   ' Catch the ESC and ENTER keys when pressed in a FireTextBox
   ' and then re-route them to the command buttons OK or Cancel
   
   Static zClassName As Asciiz * 30

   Select Case Msg.Message
      Case %WM_CHAR
         GetClassName GetParent(Msg.hWnd), zClassName, SizeOf(zClassName)
         
         If UCase$(zClassName) = "FIRETEXTBOX" Then
            If Msg.wParam = %VK_ESCAPE Then
               PostMessage HWND_FORM1, %WM_COMMAND, Mak(Long, IDC_FORM1_CMDCANCEL, %BN_CLICKED), HWND_FORM1_CMDCANCEL
               Msg.Message = %WM_NULL
               Exit Function
            ElseIf Msg.wParam = %VK_RETURN Then
               PostMessage HWND_FORM1, %WM_COMMAND, Mak(Long, IDC_FORM1_CMDOK, %BN_CLICKED), HWND_FORM1_CMDOK
               Msg.Message = %WM_NULL
               Exit Function
            End If
         End If   
   End Select


     
Paul Squires
PlanetSquires Software

Rolf Brandt

Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)