Font selection questions

Ken Ray kray at sonsothunder.com
Sun Oct 28 14:00:03 EDT 2007


On Sun, 28 Oct 2007 10:25:14 -0700, Mark Swindell wrote:

> In Rev's text formatting palette the Choose Font combo box always 
> shows the font list in alphabetical order from the beginning.
> 
> In my font menu, I would like the font list to pop up at the 
> currently active font (preferably check marked and in the center of 
> the pop-up choices).  How does one direct a menu to pop up from a 
> specific item (the one that is checked, for example)?
> 
> Also:
> 
> How can you return the menuitem number from the menupick?

Both of these are controlled by the "menuhistory" of the button. If you 
set it to a number, then the menu item with that index number is 
displayed when you click on an option button (Macs only, and no other 
menu button supports a default selection). 

So if you had a single option button on a card with three items 
("Choice 1", "Choice 2", and "Choice 3") that is initially displaying 
"Choice 1" on the label. If you "set the menuhistory of button 1 to 2", 
the label of the button changes to display "Choice 2". If the user 
picks "Choice 3", you can determine what number the item is by getting 
the menuHistory:

on menuPick pChoice
  put  "You picked item #" & (the menuHistory of me) && \
    called" && quote & pChoice & quote
end menuPick

Unfortunately, if you're using regular menus, they'll be of the 
"pulldown" variety, and so you can't set which item is shown by default 
in the submenu, but you *can* know what item number they picked.

HTH,

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list