On 8/8/05 12:26 PM, "Robert Presender" <[EMAIL PROTECTED]> wrote:

> Using rev 2.5.1, OS 10.3.9
> 
>   I want to activate a menuItem of a menu btn of a particular stack from
> a handler in a different stack.  For testing,  I put the below script
> into the message box
> 
> doMenu menuItem 1 of btn "X"  of  group "MenuBar 1" of stack "Y"
> 
> The result was: doMenu (the name of menuItem 1) is not implemented.
> 
> Would appreciate suggestions of how to activate a menuItem as indicated
> in line 2 above.

Well, menu selections from the menu itself create menuPick messages which
are usually trapped in the menu button itself. Some people like to put the
code directly in the button for the menu item's functionality, like:

-- File menu
on menuPick pChoice
   switch pChoice
      case "Open"
         answer file "Select a file to open:"
         if it <> "" then
            -- rest of script here
         end if
         break
      case "Print"
         -- etc.
         break
   end switch
end menuPick

Personally, I like to move the actual menu action code somewhere else, like
in a stack script, library or backscript so that I can call it from other
places, like:

-- File menu
on menuPick pChoice
   switch pChoice
      case "Open"
         FileOpen
         break
      case "Print"
         -- etc.
         break
   end switch
end menuPick

So in this case, activating the "Open" menu item would be simply executing
"FileOpen" and have it run a handler elsewhere.

However, if you are "stuck" with activating code that is *in* the button,
you need to send the menuPick message along with the proper param to the
button in question. Using the example above, that would be:

  send "menuPick" && quote & "Open" & quote to button "File"
  of group "MenuGroup"

Hope this helps,


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]


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

Reply via email to