here is a simplified extract from a program I'm working on - what should happen is that when the PureBasic option is selected, the checkbox should be enabled, and when the SpiderBasic checkbox is selected it should be disabled
On first call, it works, but after that the code is reporting that both options are selected. I'm clearly missing something very basic but can't figure out what
Can anyone shed some light? Thanks!
PB 5.50
OS X 10.11.6
Code: Select all
; the following line is required for XCode 8.x +
Import "-stdlib=libc++ -mmacosx-version-min=10.7" : EndImport
EnableExplicit
Define eventNumber.i
Enumeration Controls
#CONTROL_IncludePBFormsCheck
#CONTROL_PureBasicOption
#CONTROL_SpiderBasicOption
EndEnumeration
Procedure LanguageChanged()
Debug "PB option state: " + Str(GetGadgetState(#CONTROL_PureBasicOption))
Debug "SB option state: " + Str(GetGadgetState(#CONTROL_SpiderBasicOption))
If GetGadgetState(#CONTROL_PureBasicOption)
DisableGadget(#CONTROL_IncludePBFormsCheck, #False)
Else
DisableGadget(#CONTROL_IncludePBFormsCheck, #True)
EndIf
EndProcedure
OpenWindow(0, 300,300, 600, 300, "Test")
OptionGadget(#CONTROL_PureBasicOption, 100, 50, 102, 25, "PureBasic")
OptionGadget(#CONTROL_SpiderBasicOption, 210, 50, 100, 25, "SpiderBasic")
SetGadgetState(#CONTROL_SpiderBasicOption, #True)
CheckBoxGadget(#CONTROL_IncludePBFormsCheck, 100, 80, 170, 25, "Include PureBasic Forms?")
LanguageChanged()
BindGadgetEvent(#CONTROL_PureBasicOption, @LanguageChanged())
BindGadgetEvent(#CONTROL_SpiderBasicOption, @LanguageChanged())
Repeat
eventNumber = WaitWindowEvent()
If eventNumber = #PB_Event_Menu And EventMenu() = #PB_Menu_Quit
PostEvent(#PB_Event_CloseWindow)
EndIf
Until eventNumber = #PB_Event_CloseWindow
End