Can be all radio menus be "unchecked" at the same time?

New to Gambas? Post your questions here. No question is too silly or too simple.
Post Reply
sergioabreu
Regular
Posts: 117
Joined: Tue Jul 09, 2024 9:27 am

Can be all radio menus be "unchecked" at the same time?

Post by sergioabreu »

Hello

If I have a menu with 2 RADIOS, is it possible (and normal) to have a state of 2 ot these radios "unchecked" ?

What is the correct way to toggle them, Is it bad to set menu.checked = False or True directly ?

I say that because RADIO nature is to force that AT LEAST ONE and only one to be checked . Having none checked could cause problems as the design expcted to have always one of the 2 values selected...

Please correct me or explain me if it is ok

Thanks
sergioabreu
Regular
Posts: 117
Joined: Tue Jul 09, 2024 9:27 am

Re: Can be all radio menus be "unchecked" at the same time?

Post by sergioabreu »

So...
Manually clicking it works. The problem is doing by code.

I have seem 2 of them checked also :?:
It seems that the "radio functionality" has to be done by hand in Gambas?
All languages that has a radio if we set one to true (via code), all others become false.
User avatar
BruceSteers
Legend
Posts: 2145
Joined: Thu Jul 23, 2020 5:20 pm
Location: Isle of Wight

Re: Can be all radio menus be "unchecked" at the same time?

Post by BruceSteers »

try QT it can be a better toolkit than GTK

RadioButton is "native" meaning it uses the underlaying toolkit, It's behaviour is all down to the toolkit.
sergioabreu
Regular
Posts: 117
Joined: Tue Jul 09, 2024 9:27 am

Re: Can be all radio menus be "unchecked" at the same time?

Post by sergioabreu »

Thanks for the tip
No problem em doing the logic too, if the person is aware of the behavior
User avatar
gbWilly
Site Admin
Posts: 221
Joined: Fri Sep 23, 2016 11:41 am
Location: Netherlands
Contact:

Re: Can be all radio menus be "unchecked" at the same time?

Post by gbWilly »

Check attached example.
A menu with 2 radiobuttons.
Default they are unchecked.
When clicking 'Yes' it will be checked and stay checked while application is running
When clicking 'No', it will be checked and 'Yes' will be unchecked.
RadioMenu.png
Works for me on qt5, gtk2 and gtk3 (menu's just look different)

Edit: Didn't read well.
By code you can set them all to checked.
They stay checked if using gtk.
When using qt5 it works correctly (at least here -> see screen)
ByCodeQt5.png
You do not have the required permissions to view the files attached to this post.
gbWilly
- Dutch translation for Gambas3
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- Gambas3 Debian/Ubuntu repositories

- GambOS

... there is always a Catch if things go wrong!
Post Reply