edpat
New Member
Posts: 4
|
Post by edpat on Apr 13, 2022 18:25:03 GMT -5
I want to uncheck a Radio button but not by checking another one. I hope this has an easy to do answer as the complicated ones give me a headache
|
|
|
Post by mknarr on Apr 13, 2022 18:47:04 GMT -5
From the Help file "You can't really reset radiobuttons"
Would you consider using Check Boxes instead.
|
|
|
Post by Brandon Parker on Apr 13, 2022 20:46:02 GMT -5
Where does it state that? I am just curious...
You can send a "Reset" command to a Radio Button. It will then have the selection dot removed and will show as "Reset" when queried.
'nomainwin RadioButton #win.yes, "Yes", doRadio, dummy, 10, 45, 130, 20 RadioButton #win.no, "No", doRadio,dummy, 10, 70, 130, 20 Open "Make a Choice" For window As #win #win "TrapClose Quit" #win.yes "Set" #win.yes "Reset" #win.yes "Value? result$" Print result$ Wait
Sub doRadio handle$ Print "You selected ";handle$ End Sub
Sub Quit handle$ Close #handle$ End End Sub
{:0)
Brandon Parker
|
|
gaslouk
Full Member
Hi from beautiful Greece.
Posts: 130
|
Post by gaslouk on Apr 14, 2022 2:15:54 GMT -5
Edpat radiobutton it is not a Checkbox. In this case you need a Checkbox and not a radiobutton.
|
|
|
Post by Rod on Apr 14, 2022 2:20:00 GMT -5
Yes, the point about radiobuttons is that ONE of the group is supposed to be on, never all off. So the advice to choose a checkbox is good.
|
|
|
Post by metro on Apr 14, 2022 7:19:25 GMT -5
This hack may give you the result you require, however a checkbox is probably a better option
|
|
|
Post by tsh73 on Apr 14, 2022 7:43:48 GMT -5
|
|
gaslouk
Full Member
Hi from beautiful Greece.
Posts: 130
|
Post by gaslouk on Apr 14, 2022 7:55:32 GMT -5
Very good. Very clever. Now is a check button.
|
|
|
Post by Rod on Apr 14, 2022 8:02:37 GMT -5
I agree it can be done but users might be confused. This is how they are supposed to work.
nomainwin groupbox #win.group,"Radio",5,30,60,90 radiobutton #win.yes, "Yes", doRadio, dummy,10,45,50,20 radiobutton #win.no, "No", doRadio, dummy,10,70,50,20 radiobutton #win.maybe, "Maybe", doRadio, dummy,10,95,50,20 textbox #win.status,5,120,60,20
groupbox #win.check,"Option",105,30,60,90 checkbox #win.c1, "1", doCheckset, doCheckreset,110,45,50,20 checkbox #win.c2, "2", doCheckset, doCheckreset,110,70,50,20 checkbox #win.c3, "3", doCheckset, doCheckreset,110,95,50,20 textbox #win.option,105,120,60,20
open "Make a Choice" for window as #win #win "trapclose Quit" #win.yes "set" #win.status "yes" wait
sub doRadio handle$ #handle$ "set" #win.status word$(handle$,2,".") end sub
sub doCheckset handle$ #handle$ "set" call showchecks end sub
sub doCheckreset handle$ #handle$ "reset" call showchecks end sub
sub showchecks #win.c1 "value? v1$": if v1$="set" then v$="1" #win.c2 "value? v2$": if v2$="set" then v$=v$+"2" #win.c3 "value? v3$": if v3$="set" then v$=v$+"3" #win.option v$ end sub
sub Quit handle$ close #handle$
end end sub
|
|
gaslouk
Full Member
Hi from beautiful Greece.
Posts: 130
|
Post by gaslouk on Apr 14, 2022 9:17:17 GMT -5
Hello rod I will use your example if you allow me to set values for my variables in the previous topic in the Novice questions section. I wish in advance. Regards Gaslouk
|
|
|
Post by Walt Decker on Apr 14, 2022 9:34:54 GMT -5
Bear in mind that related radio buttons do not have to be enclosed in a group button (group box) if the style bits are properly set.
EDIT: From help This can be used to advantage.
|
|
edpat
New Member
Posts: 4
|
Post by edpat on Apr 15, 2022 3:34:41 GMT -5
Thanks so much all for your help. Using Checkboxes did the trick for me! Achieved exactly what I wanted. Also important I now have a good deal of info to think about and work on.
|
|