I have a series of widgets that I want them to behave as radio buttons in some conditions and as independent buttons in others. Can the value of the radio group be changed for an array of buttons using GPScript?
I’ve done some scripting with radio buttons before, but I got some unexpected results. I don’t believe that it’s a problem with Gig Performer. The challenge is that there can be race conditions between some callbacks and the value changes of the widgets.
I expect that you can script something, but my recommendation is to not use the built-in radio buttons. Instead write the behavior you want for normal buttons. The challenge is that you get events when the widget changes externally, but you also get events when you change the state of the other buttons to follow suit.
As I recall, I was dealing with widgets in the Global Rackspace that were mapped to parameters, so they could be controlled by widgets on Local Rackspaces, so I had yet another layer of complexity. I now use Radio Buttons only when the use case is straightforward. They work fine as intended.
Thanks for the response. I’m more of a database programmer than application interface programmer. Radio buttons functionality has been built into the language since IBM/OS2. So, I’ve never had to deal with code for doing it myself. When I didn’t get a faster response, I assumed I must be right in assuming there is no function for changing the radio button group assignment in GPScript. So, I proceeded as you suggested.
Yes, knowing if a user click triggered an event or if my subsequent button state changes via code triggered the event made for an interesting problem to resolve. I also had a complex need where I have 4 radio groups that I need to be able to enable/disable entire groups. But it looks like I got something to work. I’m in testing now and no problems yet. I will likely post the rackspace once I feel comfortable it is in a state where others might be able to make use of it.
Thanks again for the response and guidance.
On WidgetValueChanged(w : Widget, curindex: integer, newValue : double) from PASS_UL_0, PASS_UL_1, PASS_UL_2, PASS_UL_3, PASS_UL_4, PASS_UL_5, PASS_UL_6, PASS_UL_7, PASS_UL_8, PASS_UL_9, PASS_UL_10, PASS_UL_11, PASS_UL_12, PASS_UL_13, PASS_UL_14, PASS_UL_15
var index : integer
if newValue <> 0 then
for index=0; index<Size(NoteBlockerUpperLeft); index=index + 1 Do
if index <> curindex then
if GetWidgetValue(NoteBlockerUpperLeft[index]) <> 0.0 then
SetWidgetValue(NoteBlockerUpperLeft[index], 0)
end
end
end
end
End