Page 1 of 1
Option button and the label
Posted: Tue Mar 11, 2014 1:51 pm
by Mag
Hi all,
I noticed that if I change the label of an option button then the selected item I see when I open the option button is not the one that match to the label (in fact it's selected the one I choose latest).
Is there a way to update also the selected item along the label? Any help will be appreciated!

Re: Option button and the label
Posted: Tue Mar 11, 2014 2:17 pm
by FourthWorld
If you set the label using the menuHistory property the control will have the behavior you're looking for.
Re: Option button and the label
Posted: Tue Mar 11, 2014 3:26 pm
by Mag
Thank you Richard, another thing learned.
PS
I wonder if there is also a way to avoid that is sent the message menuPick... (I'm using the Option Button to open a window, each item corresponds to a window).
Re: Option button and the label
Posted: Tue Mar 11, 2014 4:17 pm
by Klaus
Hi Mag,
I think you can:
...
lock messages
set the menuhistory of btn ...
unlock messages
...
Best
Klaus
Re: Option button and the label
Posted: Tue Mar 11, 2014 4:27 pm
by FourthWorld
Klaus' suggestion is a good one, and if you do it often you can wrap it in a handler like this so it's a one-liner whenever you need it:
Code: Select all
on SetOption pBtnObj, pItem
lock messages
set the wholematches to true
set the menuHistory of pBtnObj to lineoffset( pItem, the text of pBtnObj)
unlock messages
end SetOption
FWIW, I submitted a request to extend the behavior of "set the label..." this morning, and Mark Waddingham noted some interesting aspects I'd not originally considered - feel free to chime in with your own thoughts there:
http://quality.runrev.com/show_bug.cgi?id=11917