Keystroke equivalents in MetaCard
John Kiltinen
kiltinen at nmu.edu
Tue Jul 2 15:17:01 EDT 2002
In response to my question about a command+w not being handled as I wanted,
Mark Talluto wrote:
>This tells me that you have another stack (maybe invisible) that has
>focus. Its menus are not set up properly to handled the command - w.
>Clicking on the stack that you think is causing the problem brings focus
>to that stack and you have set its menus up properly. My suggestion
>would be to go through all stacks and make sure that the command -w is
>handled the way it should be.
Thanks, Mark. This was helpful in pointing me in the right direction.
I've got the problem solved now, but I am still not sure exactly what it
was. I will give a desciption of what I have done for the benefit of any
other non-programmers like me who might be reading this and who like to get
themselves in over their heads with MetaCard scripting. Perhaps it will be
of help.
Your raising the question, "What has the focus?" prompted me to add a few
diagnostic "Put the focusedObject" statements into my openStack script. I
discovered that I had quite a few objects on the card in question that had
their traversalOn property set to true, these being objects that did not
need to ever receive the keyboard focus. As I set some of these
traversalOn's to false, other objects were left with the focus at the time
that the keystroke command was not getting properly handled.
I got this matter cleaned up so that now the focused object was reported to
be the card itself immediately after startup. This is exactly what was
reported to be the focus when my little introductory tour was allowed to
run its course and return to the first card.
Since the command+w worked as desired of the tour was allowed to run, I
thought that this ought to solve the problem. It did not. If I opt out of
the tour, which is done by holding down the shift key at startup, then the
focus is reported to be the first card of my stack, just as it is if the
tour runs to its end. Now here is the strange part. In spite of my stack
giving every appearance of being the top stack, when I press command+w, THE
METACARD TOOL PALETTE CLOSES. I do it again, and the MetaCard navigation
palette closes.
I still do not understand this behavior, but I found a way to get what I
want. I added the following commandkeyDown handler to the script for the
card:
on commandkeyDown x
if x = "w" then send "closestackRequest" to stack "Oval Track Puzzles"
end commandkeyDown
This seems to deal with the problem head on. Getting a solution like this,
however, still does not tell me why this stack is giving me the problems on
routing the command+w when the other ones are not.
John Kiltinen
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
John Kiltinen (kiltinen at nmu.edu) Home Office
Professor, Dept. of Math. & CS Tel.(906) 228-8035 or (906) 227-1600
Northern Michigan University Fax (906) 228-4667 or (906) 2272010
Marquette, MI 49855 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
More information about the metacard
mailing list