Peter,
I'm not exactly sure I'm answering your intended question but here's some 
thought...If you want to change your menu items dynamically and/or often then 
you can do this directly or indirectly by setting the text of the menu button.  
For example I often used mouseDown to build and set the text of me to tData 
where tData was loaded with a few lines of whatever I wanted the menu selection 
to look like.

on mouseDown
set the text of me to "Buy Low" & cr & "Sell High"
end mouseDown

on menuPick theItem
if theitem is "Buy Low" then <or> if the menuHistory of me is 1 then
answer "Sell your car"
else
answer "Buy a new car"
end if
end menuPick

You can use switch/case instead of if/then for more control over decision 
making.

To set the menu items indirectly through script, you can easily do this through 
another handler (instead of the mouseDown) that builds the menu items one per 
line and then "set" the text of the menu button to the container holding the 
menu items you just built.

Once the menupick occurs you can check for the text of the item itself and make 
decisions or check the menuHistory of the button to find out what line was 
selected.  I hope I'm in sync with your question.


 
______________________________________________________________________________________________

  jim schaubeck                                       jimschaub...@yahoo.com/ 
714.321.4499


________________________________
 From: Peter Bogdanoff <bogdan...@me.com>
To: How to use LiveCode <use-livecode@lists.runrev.com> 
Sent: Tuesday, February 19, 2013 4:20 PM
Subject: menuPick
 
Hi,

I have a menu that I'm creating the text for dynamically. 

So, on menuPick I want to do something based on the menu item chosen. However, 
it will vary all the time.

Can I get the number of the line of the menu that was chosen? How do I handle 
dynamically-generated menu items?

Peter Bogdanoff
UCLA


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to