Dynamically populating a stack menu bar
Posted: Sat Jan 16, 2010 9:55 pm
Sorry, I've been searching the forums here and trying everything I can think of, but I just can't get this to work.
Basically, at runtime something will happen, and I'd like to populate one of my stack's menus with a list of options. As a close example to what I want to do, let's say I'm making a text editor. And one of my menus is the "Font" menu to change the font of the selected text. I use the menu builder to create my basic menu, and on preOpenStack I get all the fontNames that are "ANSI" and want to add them to that menu. Right now I basically do...
However, the menu doesn't populate with the list of fonts.
If I open up the message box and type put the text of button "Font" it will correctly show the list of fonts. If I open up the inspector, though, the menu items of the button are what they were originally. And - obviously - the actual menu items haven't changed in the menubar. I'm not sure if there's a command I need to call to update the menu or if I'm setting the wrong property.
If it matters, I'm developing on OS X (in case OS X and Windows are different in this regard).
Thanks!
Jeff M.
Basically, at runtime something will happen, and I'd like to populate one of my stack's menus with a list of options. As a close example to what I want to do, let's say I'm making a text editor. And one of my menus is the "Font" menu to change the font of the selected text. I use the menu builder to create my basic menu, and on preOpenStack I get all the fontNames that are "ANSI" and want to add them to that menu. Right now I basically do...
Code: Select all
on preOpenStack
get the fontNames
## process it to get just the ones that are "ANSI"
set the text of button "Font" to it
end preOpenStack
If I open up the message box and type put the text of button "Font" it will correctly show the list of fonts. If I open up the inspector, though, the menu items of the button are what they were originally. And - obviously - the actual menu items haven't changed in the menubar. I'm not sure if there's a command I need to call to update the menu or if I'm setting the wrong property.
If it matters, I'm developing on OS X (in case OS X and Windows are different in this regard).
Thanks!
Jeff M.