Populating combo menu

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmari18
Posts: 1
Joined: Mon Jul 18, 2011 4:20 pm

Populating combo menu

Post by jmari18 » Sun Feb 26, 2012 9:39 pm

Need to get some guide on how to populate the combo menu like in Visual Basic.
Is there an additem function?

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

Re: Populating combo menu

Post by Mark » Mon Feb 27, 2012 1:48 am

Hi,

Code: Select all

put "one" & cr & "two' & cr & "three" into btn "Your Combo Menu"
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

KennyR
Posts: 256
Joined: Thu Jan 19, 2012 4:25 am

Re: Populating combo menu

Post by KennyR » Sat Mar 03, 2012 3:47 am

is there a way to populate a menu combo button with variables? For instance....

on mouseUp
local vSomething
put vSomething after btn "MenuCombo"
end mouseUp

Every time I try this bit of code, it wants to replace the previous entry with the new one. I would like to be able to populate a menu with as many items as the user chooses...is this possible without saving entries into a database and THEN populating the button?

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

Re: Populating combo menu

Post by Mark » Sat Mar 03, 2012 12:11 pm

Hi,

Your script won't replace the "previous entry". Can you explain more?

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

KennyR
Posts: 256
Joined: Thu Jan 19, 2012 4:25 am

Re: Populating combo menu

Post by KennyR » Sat Mar 03, 2012 2:14 pm

Hi Mark,

I have been working on a program for the past few months and am about to wrap it up. One section of the program has a card that allows the user to enter a persons name with the "ask "Please enter a name" " command. The variable "it" is then placed as the label of a option menu button. The user then has the option of saving the name into the option menu. I accomplish this by scripting a "save" button that puts the label of the option menu button into a variable called vName. I am trying to take vName and place it into the option menu for later use. It will place the variable in the menu, but the very next time I save another variable into the menu it gets replaced by the new entry. Previously, I had been accomplishing this by saving the name into a SQLite database then populating the button when the card opens. This seems to work fine, but I get some weird characters at the end of the name when the button is populated. Here is a link to what has been giving me problems... http://forums.runrev.com/phpBB2/viewtop ... 12&t=11210 I was sitting here last night thinking about my problem when it occurred to me that I could just fill a option menu with user defined variables instead of saving it in a database, then save the button when the card closes. I am going to look back over my code this morning over a cup of coffee and see what I am doing wrong...any input on your part would be greatly appreciated!

Thanks again Mark!


EDIT* I am an idiot!

I figured out what the issue was....I was taking "it" from the ask dialog and putting it INTO the option menu....it kept replacing the last entry...I would still like your input on the link I posted if you get a chance....Nothing like a fresh mind and a strong cup of coffee to fix a coding problem!

Post Reply