Problem with Option control.

Started by Elias Montoya, November 20, 2006, 02:18:04 AM

Previous topic - Next topic

TechSupport

Hi Franck,

Right you are. The messages are getting fired during creation of the control. This problem is related to another long standing problem where the EN_CHANGE message for TextBoxes gets fired during control creation. I have built in a fix for this for FireFly 3. For FireFly 2 you need to do the following:

(1) Add a global variable to your Form/Project:

Global gFireMessages As Long

(2) In each of your Option Button BN_CLICKED message handlers put code such as the following to exit the function if the flag has not been set:

Function FORM1_OPTION1_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

If gFireMessages = %FALSE Then Exit Function

MsgBox "fired Option 1"

End Function


(3) The last line in the WM_CREATE message handler for the Form should set the global flag to TRUE:

Function FORM1_WM_CREATE ( _
                         hWndForm As Dword, _  ' handle of Form
                         ByVal UserData As Long _  'optional user defined Long value
                         ) As Long

gFireMessages = %TRUE

End Function


I hope this little workaround will help you.

Franck Stegli


Yes I prefer to use this type of workaround (while waiting for FF3 ;) ) instead of to take any risk that the result is being hazardous during dev time.
Also placing "gFireMessages = %FALSE" before any Form_SHOW is not too fastidious for a stable program  ;D

Merci .