HI I want the User to be able to Add an option menu item.
There are 2 options but in the future there may be additional choices required.
I want the user to be able to add options if required.
When the user selects an empty line I want them to be able to add a third choice that would then show up as a permanent choice.
Please see the attached screen shot.
Adding Options to an option Menu
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Adding Options to an option Menu
Using a combobox might be easier then using a popup menu. The user can type in an unlisted value from the combobox and you can handle the closeField event in that case to ask the user if they want to add it to the option choices. I've attached an example stack of what i'm talking about. I hope this helps.
Tim
Tim
- Attachments
-
- example.zip
- (1.5 KiB) Downloaded 49 times
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Adding Options to an option Menu
Hi.
Not sure where this should start. First, do you know that to add menuItems to a menu-type button you simply set the text of that button to a return-delimited list?
Second, one can install a blank line in the contents of the button, as in:
And then in the button script, something like:
Is this a start?
Craig
Not sure where this should start. First, do you know that to add menuItems to a menu-type button you simply set the text of that button to a return-delimited list?
Second, one can install a blank line in the contents of the button, as in:
Code: Select all
choice 1
choice 2
choice 3
Code: Select all
on menuPick pItemName
if pItemName = "" then --empty line selected
ask "Enter new choice"
put it into line (the menuHistory of me) of me --the menuHistory is the selected line
end if
end menuPick
Craig
Re: Adding Options to an option Menu
You can manage the choices as a return delimited list (eg stored in a text file, database, custom property or whatever, just some text with 1 choice per line).trags3 wrote: ↑Fri Sep 15, 2023 9:26 pmHI I want the User to be able to Add an option menu item.
There are 2 options but in the future there may be additional choices required.
I want the user to be able to add options if required.
When the user selects an empty line I want them to be able to add a third choice that would then show up as a permanent choice.
Setting the text of the option menu button sets the available options
Setting its label sets what is displayed.
You can therefore just manage this all in code.
HTH
S.