Can't get command q to work

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Can't get command q to work

Post by teacherguy » Tue Jan 17, 2012 1:18 am

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. :shock:

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Can't get command q to work

Post by teacherguy » Tue Jan 17, 2012 2:42 am

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..

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Can't get command q to work

Post by teacherguy » Tue Jan 17, 2012 3:25 am

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.
Last edited by teacherguy on Tue Jan 17, 2012 3:31 am, edited 1 time in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Can't get command q to work

Post by dunbarx » Tue Jan 17, 2012 3:27 am

Not sure I understand. Are you saying that you have assigned a shortcut to a menuItem and it doesn't work?

Craig Newman

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Can't get command q to work

Post by teacherguy » Tue Jan 17, 2012 3:41 am

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....

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Can't get command q to work

Post by teacherguy » Tue Jan 17, 2012 4:06 am

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Can't get command q to work

Post by dunbarx » Tue Jan 17, 2012 2:51 pm

Hmmm.

Make sure that if you have any commandKeyDown handlers elsewhere in your stack, that these are all passed along...

Craig Newman

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Can't get command q to work

Post by teacherguy » Tue Jan 17, 2012 3:10 pm

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.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7394
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Can't get command q to work

Post by jacque » Tue Jan 17, 2012 7:21 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Can't get command q to work

Post by teacherguy » Tue Jan 17, 2012 8:11 pm

Thank you Jacque. The behavior I'm reporting is from my standalones with the menu up in the menubar.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7394
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Can't get command q to work

Post by jacque » Tue Jan 17, 2012 8:30 pm

Try adding this to your scripts somewhere, maybe in preOpenStack:

set the defaultmenubar of this stack to the long id of grp "myMenuGrp"
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Can't get command q to work

Post by teacherguy » Tue Jan 17, 2012 8:39 pm

Error: compilation error at line 20 (set: missing 'to'), char 12

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Can't get command q to work

Post by mwieder » Tue Jan 17, 2012 8:46 pm

Code: Select all

set the defaultmenubar to the long id of grp "myMenuGrp"

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Can't get command q to work

Post by teacherguy » Tue Jan 17, 2012 8:47 pm

Accepted...compiling

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Can't get command q to work

Post by teacherguy » Tue Jan 17, 2012 8:54 pm

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.
Last edited by teacherguy on Tue Jan 17, 2012 9:23 pm, edited 1 time in total.

Post Reply