Easy way to fill in combo box, option menu, pop up menu, dro

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
Jordy
Posts: 32
Joined: Sat Feb 27, 2016 3:59 am

Easy way to fill in combo box, option menu, pop up menu, dro

Post by Jordy » Sun May 01, 2016 4:57 pm

I can successfully create these by typing the choice into the property inspector and then using switch statements inside the code. The problem is that I want to make a huge one with like 300+ choices and all of that work would be very tedious. Is there an easier way to get a list of options into there? I can get the list separated by next line then I could paste that list into the inspector. When the user clicks a choice I would like to put that exact word into a variable.

Jordy
Posts: 32
Joined: Sat Feb 27, 2016 3:59 am

Re: Easy way to fill in combo box, option menu, pop up menu,

Post by Jordy » Sun May 01, 2016 4:58 pm

Also I'm not sure the property inspector would recognize a list separated by enter as separate options it may just try to make the whole list one large option

Randy Hengst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 153
Joined: Thu Jun 29, 2006 4:16 pm

Re: Easy way to fill in combo box, option menu, pop up menu,

Post by Randy Hengst » Sun May 01, 2016 9:41 pm

Assuming I’m understanding you correctly….

You could type all of the lines into an LC field and then put this script into a button:
set the text of button "OptionDemo" to field “OptionList"


Or, create multiple custom properties in the option button itself and then use a script like this:
set the text of button "OptionDemo" to the cOptionListOne of button "OptionDemo"

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Easy way to fill in combo box, option menu, pop up menu,

Post by dunbarx » Mon May 02, 2016 3:08 am

Hi.

Making 300 or even 300,000 menuItems in an optionMenu is easy, even if you don't know what to include in the list.

Code: Select all

on mouseUp
  lock screen
  repeat with y = 1 to 300
    put "XYZ" & y into line y of btn "yourOption"
  end repeat
end mouseUpt
But making the user navigate such a beast is cruel and unusual.

So we must, simply must re-think the UI. Can these go into subcategories, so that a hierarchal menu would do? Can we do almost anything else at all?

Craig Newman.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”