Intercepting new card
J. Landman Gay
jacque at hyperactivesw.com
Wed Jul 2 13:01:11 EDT 2008
Mikey wrote:
> Hmm. Well, back in HC, if I wanted to intercept a new card being created, I
> had an on doMenu handler. When I put in an on menuPick handler in RR and
> hit ctrl-n, my handler doesn't get hit, and a new card is created. So if
> this handler should not go in the current stack where should I put it?
>
How is your menupick handler set up? In general, I use only a reference
to a handler in the menupick, and then put the actual working handler in
the message path (card or stack, depending.)
So, I'd have something like this:
on menupick pWhich
case "New card"
doNewCard
break
case <etc>
end menupick
And then in the card or stack:
on doNewCard
<custom stuff here>
create card
end doNewCard
That should work. If it doesn't, then the doNewCard handler isn't in the
message path and you'd need to figure out why.
Often, if you are testing in the IDE, it is Revolution's menus that will
get the message, not yours. Rev will make a new card and your own
menupick will never fire. (You can test whether this is the case by
setting a breakpoint in your menupick handler. If it doesn't break, your
menu isn't getting the command.) To make sure you are really triggering
own menus on Mac, set editmenus to false so that your menu bar is in the
system menu. Or if editmenus is true, specifically choose the New Card
item from your menu using the mouse. On Windows and Linux, use the mouse
to make sure you are triggering your own menu and not Rev's. Or you can
try suspending the development environment to see how it will work in a
standalone.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list