doMenu limitations/ technique
Ken Ray
kray at sonsothunder.com
Sun Jan 26 08:16:00 EST 2003
Graham,
I'd suggest having all your menu items have one line of code each... calling
a function or handler in the stack script or backscript that can be reached
by other methods. For example, suppose I had a File menu with three items:
"New", "Open" and "Quit". I might script the button as follows:
on menuPick what
switch what
case "New"
FileNew
break
case "Open"
FileOpen
break
case "Quit"
FileQuit
break
end switch
end menuPick
And then in my stack script of my mainstack have the handlers, like this for
Quit:
on FileQuit
-- do my cleanup routines
quit
end FileQuit
This way, if I want to "choose a menu item" from somewhere else, I only need
to call on the handler ("FileQuit" in this example).
A naming convention for menu items is good too... the one I show above can
break down if the combination of your menu name and item is the same as a
reserved token in Transcript, but you get the idea.
Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
----- Original Message -----
From: <livfoss at blueyonder.co.uk>
To: <use-revolution at lists.runrev.com>
Sent: Sunday, January 26, 2003 9:19 AM
Subject: doMenu limitations/ technique
> In the Transcript Dictionary, there is an entry for 'doMenu' which
executes menu commands - something I'd like to do. However there is a
caveat: "The doMenu command is not implemented for all menu items." What
does this mean? How does the engine know which items are being called for,
anyway? If indeed this command doesn't work in full, I suppose one is left
with scripting
>
> send "MenuPick Quit" to btn "File" of cd "myMenus"... or
>
> set the menuHistory of btn "File" of cd "myMenus" to gFileQuitItemNumber
>
> where gFileQuitItemNumber is an integer representing the place of "Quit"
in the file menu... or something like that. Can someone who has already
scripted this suggest the tidiest solution?
>
> TIA
>
> Graham
>
> ------------------------------------------------------------
> Graham Samuel / The Living Fossil Co. / UK & France
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list