Option Menus

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
buchacho
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 50
Joined: Fri Jun 14, 2013 10:22 pm

Option Menus

Post by buchacho » Wed Jun 19, 2013 12:14 am

I have an option menu that is populated with some values. How would I be able to clear all the lines of the option menu, when I am ready to repopulate the whole list of options?

Is there detailed documentation on how to use option menus?

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

Re: Option Menus

Post by Dixie » Wed Jun 19, 2013 12:39 am

To clear the menu items in the option menu

Code: Select all

 put empty into button "theNameOfThebutton"
then put your new list of things into it...

Code: Select all

put "Able,Baker,Charlie,Delta" into theNewList
repeat with count = 1 to the number of items of theNewList
   put item count of theNewList & cr after button "theNameOfThebutton"
end repeat

buchacho
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 50
Joined: Fri Jun 14, 2013 10:22 pm

Re: Option Menus

Post by buchacho » Wed Jun 19, 2013 6:34 pm

Thanks, I did try

Code: Select all

put empty into btn ...
However, it puts the button name into the first option line. Right now I have it as:

Code: Select all

put "-" into btn ....
Not ideal, but it works...

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

Re: Option Menus

Post by Dixie » Wed Jun 19, 2013 6:52 pm

Yes it will do that... my fault.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Option Menus

Post by dunbarx » Wed Jun 19, 2013 7:02 pm

You could put "space" or an invisible character..

Craig Newman

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: Option Menus

Post by snm » Thu Jun 20, 2013 5:38 pm

Dixie wrote:To clear the menu items in the option menu

Code: Select all

 put empty into button "theNameOfThebutton"
then put your new list of things into it...

Code: Select all

put "Able,Baker,Charlie,Delta" into theNewList
repeat with count = 1 to the number of items of theNewList
   put item count of theNewList & cr after button "theNameOfThebutton"
end repeat
Simpler way:

Code: Select all

put "Able,Baker,Charlie,Delta" into theNewList
replace "," with cr in theNewlist
put theNewList into button "theNameOfTheButton"
and no problem with empty menu option.

Marek

Post Reply