
Is it possible to affect radiobutton selection with DoAlert?

neovenecia
Hello.
I have a problem combining DoAlert and radiobuttons.
When I change between two radio button, then I want to have a question prompted which need to be answered with yes or no. If the answer is yes, then the clicked radio button should be selected. But if the answer is no, then the previous selected radio should stay selected. My current problem is when I press no than both radio buttons are selected.
Here is my code.
Function sampling_method_proc(cb):CheckboxControl STRUCT WMCheckboxAction &cb switch(cb.eventCode) case 2: // Mouse up sampling_method_proc_extra(cb.ctrlname) break endswitch PanelApp() //activates function for enable/disable parts of panel End Function sampling_method_proc_extra(controlname) String controlname NVAR SamplingMethodG=root:SamplerGlobals:SamplingMethodG DoAlert/T="Active Checkbox" 1,"Are all Active Checkboxes unchecked?" if (V_flag==1) strswitch (controlname) case "sampling_automatic_panel": SamplingMethodG=1 break case "sampling_manual_panel": SamplingMethodG=2 break endswitch else return 0 endif End
Thank you in advance.
September 21, 2018 at 08:18 am - Permalink
In reply to Function sampling_method… by tony
But how shall I set them that there is no change in the selection of the radio button?
September 21, 2018 at 08:34 am - Permalink
In reply to But how shall I set them… by neovenecia
you can pass the name of the checkbox that was clicked and its value from the checkbox procedure, then figure out the logic of whatever you want to do.
if g is the global variable associated with the checkbox that was clicked you will probably want to set g=!g
September 21, 2018 at 08:45 am - Permalink
In reply to But how shall I set them… by neovenecia
Perhaps what you are looking for is the "value" keyword for the CheckBox control. For details look up Checkbox in Command Help.
September 23, 2018 at 03:30 pm - Permalink
Thank you very much.
I solved it
September 24, 2018 at 12:15 am - Permalink
In reply to Thank you very much. I… by neovenecia
As a courtesy to those who helped you, please post your solution.
September 24, 2018 at 09:39 am - Permalink