I can confirm the bug on MacOS X 10.6.8 (Snow Leopard): "Option 2" and "Option 3" are not selectable although "Option 1" is deselected (but the focus ring still remains around the circle of "Option 1" !).Kukulkan wrote:Try this code on both Windows and MacOS. On Windows it works fine, on MacOS it is not usable:
But please take a look into my following workaround which works without problems on Windows 7 SP1 x64 with PB 5.22 x86 and x64 and on MacOS X 10.6.8 with PB 5.22 x86 and x64. I have added SetActiveGadget() for OptionGadgets 2 and 3 and always even a 3rd SetGadgetState(OptionGadget, 1) for the modified OptionGadget. For OptionGadget "opt2" it's further absolutely necessary to use the SetGadgetState(DialogGadget(#Dialog, "opt2"), 1) as the last of the SetGadgetState() commands because otherwise the OptionGadget on MacOS will be selected with a focus ring but the dot in the circle will be missing...
Code: Select all
CompilerIf #PB_Compiler_Unicode
#XmlEncoding = #PB_UTF8
CompilerElse
#XmlEncoding = #PB_Ascii
CompilerEndIf
#Dialog = 0
#Xml = 0
XML$ = "<window id='#PB_Any' name='test' text='Gridbox' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
" <gridbox columns='1'>" +
" <option name='opt1' text='Option 1' />" +
" <string name='strTest' minwidth='450' />" +
" <option name='opt2' text='Option 2' />" +
" <option name='opt3' text='Option 3' />" +
" </gridbox>" +
" </window>"
If CatchXML(#Xml, @XML$, StringByteLength(XML$), 0, #XmlEncoding) And XMLStatus(#Xml) = #PB_XML_Success
If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
SetGadgetState(DialogGadget(#Dialog, "opt1"), 1); select opt1 by default
SetActiveGadget(DialogGadget(#Dialog, "strTest"))
Repeat
Event = WaitWindowEvent()
EventType = EventType()
If Event = #PB_Event_Gadget
Gadget = EventGadget()
;{ Handle Option Group because PB does not...
Select Gadget
Case DialogGadget(#Dialog, "opt1")
DisableGadget(DialogGadget(#Dialog, "strTest"), 0)
SetGadgetState(DialogGadget(#Dialog, "opt1"), 1)
SetGadgetState(DialogGadget(#Dialog, "opt2"), 0)
SetGadgetState(DialogGadget(#Dialog, "opt3"), 0)
SetActiveGadget(DialogGadget(#Dialog, "strTest"))
Case DialogGadget(#Dialog, "opt2")
SetGadgetState(DialogGadget(#Dialog, "opt1"), 0)
SetGadgetState(DialogGadget(#Dialog, "opt3"), 0)
SetGadgetState(DialogGadget(#Dialog, "opt2"), 1)
SetActiveGadget(Gadget)
Case DialogGadget(#Dialog, "opt3")
SetGadgetState(DialogGadget(#Dialog, "opt1"), 0)
SetGadgetState(DialogGadget(#Dialog, "opt2"), 0)
SetGadgetState(DialogGadget(#Dialog, "opt3"), 1)
SetActiveGadget(Gadget)
EndSelect
;}
EndIf
Until Event = #PB_Event_CloseWindow
Else
Debug "Dialog error: " + DialogError(#Dialog)
EndIf
Else
Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
EndIf