PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Rolf Brandt on December 08, 2010, 06:10:36 AM

Title: FireTextBox and DefaultPushbutton
Post by: Rolf Brandt on December 08, 2010, 06:10:36 AM
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?
Title: Re: FireTextBox and DefaultPushbutton
Post by: Paul Squires on December 09, 2010, 08:46:04 AM
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.
Title: Re: FireTextBox and DefaultPushbutton
Post by: Rolf Brandt on December 09, 2010, 09:48:25 AM
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.
Title: Re: FireTextBox and DefaultPushbutton
Post by: Paul Squires on December 10, 2010, 12:27:35 PM
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


     
Title: Re: FireTextBox and DefaultPushbutton
Post by: Rolf Brandt on December 10, 2010, 01:30:30 PM
Thanks, Paul, I will try it our.