Hi,
I've a Main Form; on this Main Form I've just a Help Command Button used to show a Help Form; the Help Form is displayed as Non-Modal (%FALSE) because the user should be able to go back to the Main Form when the Help Form is displayed.
FIRST QUESTION
--------------------
To prevent opening the Help Form more than once (if the user click a second time on the button), I have disabled the Help Button before showing the Help Form; Is it a good way to do that with FireFly ? what else can I do to prevent opening the same "non-modal" forms many times ?
'------------------------------------------------------------------------------------------------------------------------
Function MAINFORM_HELPBOUTTON_BN_CLICKED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
idButtonControl As Long _ ' identifier of button
) As Long
' Disable the Help Boutton on the Main Form
FF_CONTROL_DISABLE(HWND_MAINFORM_HELPBOUTTON)
' show the Help Form
HELPFORM_SHOW (HWND_MAINFORM, %FALSE)
End Function
SECOND QUESTION
-----------------------
In the case I exposed in the first question, I have to ENABLED again the Help Button on the Main Form when the Help Form is closed; where can I do that and for which messages WM_CLOSE and/or WM_DESTROY ?
so far I've written this code: it seems to be ok; is it the good way to do that with FireFly ?
'------------------------------------------------------------------------------------------------------------------------
Function HELPFORM_WM_CLOSE ( _
hWndForm As Dword _ ' handle of Form
) As Long
' Enable the Help Boutton on the Main Form when the Help Form is closed
FF_CONTROL_ENABLE(HWND_MAINFORM_HELPBOUTTON)
End Function
'------------------------------------------------------------------------------------------------------------------------
Function HELPFORM_WM_DESTROY ( _
hWndForm As DWord _ ' handle of Form
) As Long
' Enable the Help Boutton on the Main Form when the Help Form is closed
FF_CONTROL_ENABLE(HWND_MAINFORM_HELPBOUTTON)
End Function
Thank you for your help.
Jean-Pierre
Quote from: Jean-Pierre LEROY
FIRST QUESTION
--------------------
To prevent opening the Help Form more than once (if the user click a second time on the button), I have disabled the Help Button before showing the Help Form; Is it a good way to do that with FireFly ? what else can I do to prevent opening the same "non-modal" forms many times ?
In your BN_CLICKED message you can test to see if the help Form is visible. IF it is then don't display it again.
If IsWindowVisible( HWND_HELPFORM ) Then
'do nothing, or possible try to bring the window to the foreground.
SetActiveWindow HWND_HELPFORM
Else
' show the Help Form
HELPFORM_SHOW (HWND_MAINFORM, %FALSE)
End If
Quote
SECOND QUESTION
-----------------------
In the case I exposed in the first question, I have to ENABLED again the Help Button on the Main Form when the Help Form is closed; where can I do that and for which messages WM_CLOSE and/or WM_DESTROY ?
so far I've written this code: it seems to be ok; is it the good way to do that with FireFly ?
I think that putting the enable code in the WM_DESTROY message would be good enough. No need to put it in the WM_CLOSE message. Whenever a Form/Window is destroyed, it always calls the WM_DESTROY message so you can be sure that when your Help Form closes that the code to enable the button will get executed.
Hi Paul,
Thank you for help.
I didn't kow about the "IsWindowVisible" API; this solution is more "elegant" than to DISABLE/ENABLE Command Button.
Thanks, Jean-Pierre.