Hello,
ist there a particular reason, why there's no #PB_EventType_Change for OptionGadgets? I searched Google and didn't find information about this being asked before, though it seems like a logical thing for me.
No #PB_EventType_Change for OptionGadget
No #PB_EventType_Change for OptionGadget
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Re: No #PB_EventType_Change for OptionGadget
I agree that a change event should occur when their status changes from on/off, but then the new gadget would be the EventGadget() and not the previous OptionGadget whose on/off state just changed. So it's probably not possible?
You have to detect it something like this:
You have to detect it something like this:
Code: Select all
If OpenWindow(0, 300, 300, 140, 110, "OptionGadget", #PB_Window_SystemMenu)
OptionGadget(0, 30, 20, 60, 20, "Option 1")
OptionGadget(1, 30, 45, 60, 20, "Option 2")
OptionGadget(2, 30, 70, 60, 20, "Option 3")
SetGadgetState(1, 1)
oldgad=-1
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget
newgad=EventGadget()
If newgad<>oldgad
oldgad=newgad
If GadgetType(newgad)=#PB_GadgetType_Option
Debug "changed"
EndIf
EndIf
EndIf
Until ev=#PB_Event_CloseWindow
EndIf
Re: No #PB_EventType_Change for OptionGadget
Well, a change would occur in the new gadget. The programmer has to take care of it anyway (and can get the status with GetGadgetState()). Also, only one OptionGadget of a group can be activated, so I store a value in a variable, which indicates which OptionGadget is activated. If the new one sends a Change-Message I overwrite the value and don't need to check the other gadgets anyway.
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD