Hi,
I know, pretty basic.
How does one catch the escape key to exit the dialog (= current window), the FF way.
Thanks for any answer.
Marc
Marc,
Edit the properties of whichever button you would normally use to close your form (Ok, Cancel, etc.). Set the Cancel option to True. Then add the following code in the forms WM_COMMAND section:Function FORM1_WM_COMMAND ( _
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
wNotifyCode As Long, _ ' notification code
wID As Long _ ' item, control, or accelerator identifer
) As Long
Select Case wID
Case IDC_FORM1_CMDOKCANCEL ' Look for the IDC of the button that closes your form here
FF_CloseForm HWND_FORM1, %True ' and close the form.
End Select
End Function
If you don't have/want a button to close your form, just use one and set it to not be visible.
David
Thanks David,
unfortunately, it did not work here.
First I use rrbuttons all the time and they do not have a CANCEL option.
I then added a default button to do what you said but the form with that button did not even show up. I' ll try to explain.
From FORM1 I show FORM2 (with cancel button) but I think it goes directly to the FORM2_WM_COMMAND and the FROM2 does not appear.
Any thoughts?
Marc
Maybe I shoud add that FORM2 has a TAB control.
Marc
Try adding something like this to your FF_PumpHook code:
If IsWindow( HWND_FORM1 ) Then
Select Case Msg.Message
Case %WM_KEYUP
If msg.wParam = %VK_ESCAPE Then
msg.Message = %WM_NULL
? "escape pressed"
FF_CloseForm HWND_FORM1
Function = %FALSE
Exit Function
End If
End Select
End If
That did it.
Thanks Paul.
Have a nice sunday both of you.
Marc