Page 1 of 2
Can't get command q to work
Posted: Tue Jan 17, 2012 1:18 am
by teacherguy
I have handlers in my standalone for closeStackRequest and for shutdownRequest. These are working fine if you click the red x of the window.
However, I cannot seem to get command q to do anything except make the menubar flash. I have tried:
Code: Select all
on menuPick pItemName
switch pItemName
case "Quit"
close this stack
break
end switch
end menuPick
and
Code: Select all
on menuPick pItemName
switch pItemName
case "Quit"
quit
break
end switch
end menuPick
but nothing happens.

Re: Can't get command q to work
Posted: Tue Jan 17, 2012 2:42 am
by teacherguy
hm, nor command x, c, p, ... why can't I get a handle on this menubar stuff? It's like something is intercepting the keydowns..
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 3:25 am
by teacherguy
Progress! Sent the menubar all the way to the back of the layers...
Update: No, that does not seem to be the factor, it is whether or not the menubar is on the card or in the OS X menu. When it is set to the menubar for the stack, they commandkeys do not work.
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 3:27 am
by dunbarx
Not sure I understand. Are you saying that you have assigned a shortcut to a menuItem and it doesn't work?
Craig Newman
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 3:41 am
by teacherguy
Yeah, the standard shortcuts for editing and quit. I even had the menubuilder start me off with the script etc. Simple right?
When the menu is set as the menubar, the messages don't go through. When the menu is on the card, no problem. I'm thinking it has something to do with layers? I don't see why the layer would change when you put the menu up to the menubar, but....
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 4:06 am
by teacherguy
Bottom line for now: Leaving the menu on the card gives me my edit commands again (cut/copy/paste/undo/select all). Still no command q though. I suppose that has something to do with quit being under the app name in the OS X menubar.
I have several datagrids on my cards that have handlers involving the commandkey (I use the data grid helper and it installs a number of scripts for dragging rows to change their order, command "a" selects all the rows in the datagrid, etc.). So I suspect there is something conflicting here and perhaps if I can get the layers sorted out then the message path will be clear?
I'll battle more tomorrow. Any thoughts appreciated.
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 2:51 pm
by dunbarx
Hmmm.
Make sure that if you have any commandKeyDown handlers elsewhere in your stack, that these are all passed along...
Craig Newman
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 3:10 pm
by teacherguy
Yes, been checking for that, will keep searching.
Does anyone know if using a menu as the "stack menu bar" puts it last in the message path? That's what it seems like.
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 7:21 pm
by jacque
On Mac, if the editmenus is true, the group won't always catch the commandkey. The menu needs to be in the system menu bar to do that consistently. When I have the menus showing on a stack, I just use the mouse to test them.
If your menubar is in the system menu it should work.
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 8:11 pm
by teacherguy
Thank you Jacque. The behavior I'm reporting is from my standalones with the menu up in the menubar.
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 8:30 pm
by jacque
Try adding this to your scripts somewhere, maybe in preOpenStack:
set the defaultmenubar of this stack to the long id of grp "myMenuGrp"
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 8:39 pm
by teacherguy
Error: compilation error at line 20 (set: missing 'to'), char 12
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 8:46 pm
by mwieder
Code: Select all
set the defaultmenubar to the long id of grp "myMenuGrp"
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 8:47 pm
by teacherguy
Accepted...compiling
Re: Can't get command q to work
Posted: Tue Jan 17, 2012 8:54 pm
by teacherguy
No change: Using command in combination with the standard edit keys and/or q causes a flashing of the menubar and no resulting action.
UPDATE: Not quite correct. Quit works, other edit commands do not.