Setting the labels for a group of radio buttons programmatically (OpenInsight Specific)
At 05 NOV 1997 07:56:20PM J.Wheeler wrote:
How can I set the labels on a group of radio buttons programmatically.
I want one set for each province for example.
At 06 NOV 1997 04:28AM Oystein Reigem wrote:
J,
Let's say you have a radio button group called
"RADIO", with e.g 3 buttons. In Form Designer
you give the radio buttons dummy labels,
e.g "A", "B" and "C". These labels also become
part of the names of the radio buttons.
Then in your programming you can change
the labels to e.g "East", "West" and "North" with
OldVal=Set_Property( @Window : ".RADIO.A", 'TEXT', "East" )
OldVal=Set_Property( @Window : ".RADIO.B", 'TEXT', "West" )
OldVal=Set_Property( @Window : ".RADIO.C", 'TEXT', "North" )
Come to think of it - you might have problems
with the new label not showing correctly!
I remember once I had a radio button group
where I *did* want static values, but still had
to set them to something different in Form Designer
and change them programmatically afterwards.
The problem was: The labels I wanted contained
spaces (or perhaps it was foreign characters,
or perhaps both). Anyway the radio button *names*
became messy. I needed to refer to the radio buttons
programmatically, but the names had become
unusable. So I had to give the buttons more
"neutral" names in Form Designer and change them
programmatically afterwards. But I discovered
that if I used short strings (e.g, "1", "2")
for the labels in Form Designer, my new,
programmatically set labels were truncated!
So I set my labels to "111111111111111111111111111111"
and "222222222222222222222222222222" (I had to
experiment to find suitable lenghts for these
strings) and programmed like this:
OldVal=Set_Property(
@Window : ".RADIO.111111111111111111111111111111","TEXT", "Særskilt søk på distrikt og adresse" )OldVal=Set_Property(
@Window : ".RADIO.222222222222222222222222222222","TEXT", "Parallell søk på distrikt og adresse" )Yuck! But it worked.
By the way - I have also needed to set the labels
programmatically when I *didn't* need any labels.
I had a horizontal radio button group, and for
some reason I wanted my label texts in a separate
control - a static text - above the group.
Then I gave my 4 radio buttons dummy labels
"1" to "4" and cleared them programmatically
afterwards:
for J=1 to 4
OldVal=Set_Property( @Window : ".RADIO." : J, 'TEXT', ' ' )next J
I think I had to use a space and not
the null string.
Good luck!
- Oystein -