Create menus with transcript code

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
bobw
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3
Joined: Mon Nov 29, 2010 1:39 am

Create menus with transcript code

Post by bobw » Mon Nov 29, 2010 1:45 am

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.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Create menus with transcript code

Post by Dixie » Mon Nov 29, 2010 2:41 am

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
Attachments
MakeButtonMenu.zip
(2.07 KiB) Downloaded 202 times

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Create menus with transcript code

Post by Mark » Mon Nov 29, 2010 11:21 am

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bobw
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3
Joined: Mon Nov 29, 2010 1:39 am

Re: Create menus with transcript code

Post by bobw » Mon Nov 29, 2010 1:11 pm

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.

bobw
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3
Joined: Mon Nov 29, 2010 1:39 am

Re: Create menus with transcript code

Post by bobw » Mon Nov 29, 2010 1:31 pm

Thanks Mark. I haven't tried running as a standalone yet. I'll watch for this limitation.

Post Reply