Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
So far I have not come across a winget() facility in which we can get the Button Checked in a Group.

More Clearly - Suppose I have a set Group for several Buttons.And I want to get which is the checked Button in the Group.Same Applies to all Groupable radio,checkbox.

a more like winget(src,"Window","group=GroupName")

returns :the id of the selected Button in the Group mentioned in the window. or "" if not any button selected

Umm Ignore if there was already a BYOND workaround!

Ohh yea I do know that players can work that around!


You can use the window.* format to read the is-checked value of all buttons in the pane, which you can use to find out which of the buttons in the group is checked.
2 year bump. I think this really needs to be considered. If you have more than one set of grouped buttons in a pane, it becomes silly. You have to check each button's group, then see if any of the buttons is checked. It's really not efficient, imo.
I'm open to expanding the syntax, but I don't think the syntax proposed for reading a group is viable. Something that does not make use of = would be best. I don't think : can be used for this purpose, such as group:name, because it could potentially interfere with the ternary ?: operator in client-side .winset commands. If you have suggestions please post them here.
group#name, perhaps? I don't think the # symbol is used an operator anywhere besides for preprocessor macros in Dream Makers, so, I don't think it'll interfere anywhere. Plus, it reminds me of website anchors. :|
Bumping for the sake of # sounds like a good ideal.
What about something like winget(src, "Window", "group:is-checked") ? This would return a list of buttons in the window "Window" that either return true or return each button with their value. Example: Returning a list of buttons and their values would return a list.

"Search for controls with is-checked in Window returns:"
This would clearly only search controls that contain the given variable. Searching all controls and giving the list is also viable.

Now, checking the buttons for the value to be TRUE is something that I'd personaly prefer. This would simply return a list of controls with a value of TRUE.

"Search for controls with positive values of is-checked in the window Window returns:
button2" <-- going with the previous list

Perhaps a combination of the above two. winget(src, "Window", "group:is-checked:TRUE") would be an example and apply to the second example given previously.

In-general format:
winget(src, control_id, "group:[variable]:[value]")
asking for it to return a list is silly, unless you're asking for multiple groups. in a group, only one button control can be checked at a time. so only one would ever be true, and the rest would always be false. if you know one is true, the rest are clearly false.

that's what the initial request is asking for. we only need to know the single button is checked, if any; either in one or multiple groups.
I think this could also be solved with a more general-purpose feature: the ability to filter a wildcard search based on parameter values. Maybe something more like this:
winget(src,"window.*","type=button;group=\"My Group\";is-checked=true")

I know you said you don't want to use =, Lummox JR, but I think for a more general feature the consistency would make sense.
I'd like to see some sort of fix to this added as well. When doing heavy control layouts with many button controls, this could save a lot of effort and clean up the code written for the effect considerably (I'm just finding out how nasty it can be when trying to organize the data for radio button groups!)