March 28, 2024, 12:43:57 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Program control of radiobuttons

Started by LarryMc, September 12, 2013, 11:54:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

When I have a group of radiobuttons I've never had a problem with turning them on/off with the mouse.
I click one; it is turned on and all others in the group are turned off
However, when I use the SETSTATE command to turn a radiobutton on it does not turn any others off in the group.
I have to add SETSTATE commands for every radiobutton and turn them all off and the desired one on.
The attached example rb1.iwb shows what happens if you use just the one SETSTATE command at a time to turn on the desired rb.
(Each of the 3 buttons turns on the associated radiobutton.)

There's a windows API that fixes that:CheckRadioButton
The parameters that are passed are:
handle of parent window,
id of first rb in group,
id of last rb in group,
rb to turn on

The attached example rb2 shows the api function in action
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Hi Larry,

The same problem occurs when using CHECKBOX, you have to manually turn them all off and turn on the desired one.

Do you know if there is a Windows API for checkboxes as well?

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

If you change the radio buttons in the rb2 example to checkboxes it works with them too!

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Quote from: andy1966 on September 13, 2013, 10:31:43 PM
If you change the radio buttons in the rb2 example to checkboxes it works with them too!

Andy.
:)
Checkboxes are normally used in an exclusive or arrangement but that is nice to know.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library