one case for all options in Option Menu
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
one case for all options in Option Menu
Hello,
i got 2 questions of which the first i maybe can figure out myself.
I want to fill the options in the Option Menu with a list from a txt file. (1 option per line)
In this txt file extra options can be added. Via a entry field and a button which adds this line to the txt file.
-How do i populate the Option Menu with such a list? (when opening the stack or when saving the list after adding)
Now the most important:
How can i make sure that no matter which option is choosen in the Option Menu,
that always the same 'case' is being executed like: send "mouseUp" to btn"load"
Because now i have to create a case for each option.
But i don't want to reprogram the Option Menu every time a Choice is added, after all it's an exe by then.
Thanks for any help on this.
Sphere
i got 2 questions of which the first i maybe can figure out myself.
I want to fill the options in the Option Menu with a list from a txt file. (1 option per line)
In this txt file extra options can be added. Via a entry field and a button which adds this line to the txt file.
-How do i populate the Option Menu with such a list? (when opening the stack or when saving the list after adding)
Now the most important:
How can i make sure that no matter which option is choosen in the Option Menu,
that always the same 'case' is being executed like: send "mouseUp" to btn"load"
Because now i have to create a case for each option.
But i don't want to reprogram the Option Menu every time a Choice is added, after all it's an exe by then.
Thanks for any help on this.
Sphere
Re: one case for all options in Option Menu
Dag sphere,
set the text of btn "your option button here..." to url("file:" & "path/to/your/textfile.txt")
...
Maybe:
?
Best
Klaus
...sphere wrote:-How do i populate the Option Menu with such a list? (when opening the stack or when saving the list after adding)
set the text of btn "your option button here..." to url("file:" & "path/to/your/textfile.txt")
...
Sorry, don't get this?sphere wrote:Now the most important:
How can i make sure that no matter which option is choosen in the Option Menu,
that always the same 'case' is being executed like: send "mouseUp" to btn"load"
Because now i have to create a case for each option.
But i don't want to reprogram the Option Menu every time a Choice is added, after all it's an exe by then.

Maybe:
Code: Select all
on menupick WhatEver
do_the_one_thing
end menupick
Best
Klaus
Re: one case for all options in Option Menu
Hi.
The menuItems in an option menu are simply the contents of that button. Did you know that buttons are containers?
I am not sure what your second question is about. You say you want the same "case" regardless of what option is chosen.
You say you want a "case" for new options that might be added on the fly. Well, that can be done, but it will depend either on the text itself, or its position in the list, or, perhaps, a common action dependent on a choice from that list. So, for example, if you loaded the above three menuItems, and each was a reference to a card name, you could:
And now it does not matter what new items are added, as long as there is a card with that name. Do you see? The common action (going to a card) will implement what I think is what you want, but am not sure.
Maybe write back with your comments,
Craig Newman
The menuItems in an option menu are simply the contents of that button. Did you know that buttons are containers?
Code: Select all
put "x" & return & "y" & return & "z" into btn "yourOption"
answer btn "yourOption"
answer the text of btn "yourOption"
You say you want a "case" for new options that might be added on the fly. Well, that can be done, but it will depend either on the text itself, or its position in the list, or, perhaps, a common action dependent on a choice from that list. So, for example, if you loaded the above three menuItems, and each was a reference to a card name, you could:
Code: Select all
on menuPick pItemName
go cd pItemName
Maybe write back with your comments,
Craig Newman
Re: one case for all options in Option Menu
Gutentag Klaus and Hello Craig,
thank you both for your comments.
Meanwhile the first i figured out how to populate the option menu with a list.
With the second question i mean this:
but that did not work.
This seems to work ok
thanks for your superfast help so far!
thank you both for your comments.
Meanwhile the first i figured out how to populate the option menu with a list.
With the second question i mean this:
Code: Select all
on menuPick pItemName
switch pItemName
send "mouseUp" to btn"load"
end switch
end menuPick
This seems to work ok
Code: Select all
on menuPick
send "mouseUp" to btn"load"
end menuPick
Re: one case for all options in Option Menu
Well, if that is what you needed, great. Two things:
1- If you use a switch statement, you must have a case statement:
Or, if you want, lose the menuPick handler entirely, since it is not used, and:
Craig
1- If you use a switch statement, you must have a case statement:
Code: Select all
on menuPick pItemName
switch pItemName
case "anyChoiceAtAllApparently"
send "mouseUp" to btn"load"
break
end switch
end menuPick
Code: Select all
on mouseUp
send "mouseUp" to btn"load"
end mouseUp
Re: one case for all options in Option Menu
Thanks Craig!
The first one i knew, the second not.
Great!
The first one i knew, the second not.
Great!