On 04/12/2018 09:06 PM, Jeffrey R. Carter wrote:
>    All_Buttons : for I in Label'Range loop
>       Result.Radio (I).Button.Create
>          (Form => Form, Checked => I = Label'First, Name => Name);
>       Result.Radio (I).Label.Create (Form       => Form,
>                                      Label_For  => Result.Radio (I).Button,
>                                      Content    => To_String (Label (I) ),
>                                      Auto_Place => False);
>    end loop All_Buttons;

Experimenting with this, I found that, regardless of index, I was always getting
the state of the last button created.

In simplifying the actual code for posting here, I left off the ID parameter to
Create. In my actual code, I was setting ID for all the buttons in a set to the
same value. This was to allow a single callback to handle events for multiple
widgets. Since that didn't seem to be involved in this part of the code, I
removed it.

If I use a unique ID for each button, then things work as expected. That makes
decoding the ID in callbacks a little more complex, but not a big deal.

It wasn't obvious to me that radio buttons in a set have to have unique IDs. I
hope my experience might help others avoid this mistake.

Jeff Carter
"Why don't you bore a hole in yourself and let the sap run out?"
Horse Feathers

Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Gnoga-list mailing list

Reply via email to