Page 1 of 1

Create menus with transcript code

Posted: Mon Nov 29, 2010 1:45 am
by bobw
I am trying to write a program where menus would be read from a file. This could be an XML or CSV file or some other format. I will probably just use XML, but the format isn't important to me. The file would contain menu names and menu item names for each menu name. I want to set up a menu bar and populate the menus and menu items using code. I wouldn't need more than one menu bar. I have figured out how to create a button, but I can't figure out how to create an option control. My understanding is that the menubar is simply a group of menus, which are pulldown controls.

I may be going about this the wrong way, and there might be an easier way to achieve what I want. Right now, I am wondering if someone can explain how I can create pulldown menus through code or create regular buttons and change them to pulldown controls. If there is a better way than my approach, I would be interested in learning that as well.

Re: Create menus with transcript code

Posted: Mon Nov 29, 2010 2:41 am
by Dixie
hi bobw...

To get you started I have attached a stack... have a look at the scripts of the two buttons...
Then have a look in the dictionary at 'templateButton' and 'templateGroup' ... that'll keep you busy :)

be well

Dixie

Re: Create menus with transcript code

Posted: Mon Nov 29, 2010 11:21 am
by Mark
Dear bobw,

You can set the style of a button to menu, after which you can set its menuMode to pullDown.

If you want to run your stack outside the IDE, then you have only very limited possibilities to change the scripts of your buttons (up to 10 lines).

Kind regards,

Mark

Re: Create menus with transcript code

Posted: Mon Nov 29, 2010 1:11 pm
by bobw
Thanks Dixie. This looks like just what I was wanting. I'm eager to test this out. I thought templates were for creating new cards and I'll had to read up on templateButton now.

Re: Create menus with transcript code

Posted: Mon Nov 29, 2010 1:31 pm
by bobw
Thanks Mark. I haven't tried running as a standalone yet. I'll watch for this limitation.