keyboard commands - cut, copy, paste

Using Standalone Maker to build executables or delivering projects for use with the SuperCard Player? Discuss it here.

keyboard commands - cut, copy, paste

Postby Anderson » Tue Dec 10, 2013 6:27 am

My standalone is not executing keyboard commands (cut, copy ,paste) which I have included under the Apple menu.
While selecting type in a cd fld, on command-X the menu lights up but the field is not affected. The menu works properly.
Best Regards,
Rob A.
Anderson.
iMac - High Sierra - SC(current beta)
User avatar
Anderson
 
Posts: 220
Joined: Mon Jul 21, 2008 9:00 am
Location: Perth County, Canada

Re: keyboard commands - cut, copy, paste

Postby codegreen » Tue Dec 10, 2013 6:58 am

That's odd. It's probably worth building an editable version of the standalone and sticking a trace at the top of that itemSelect handler so you can stop and sniff around a bit...

-Mark
codegreen
 
Posts: 1545
Joined: Mon Jul 14, 2008 11:03 pm

Re: keyboard commands - cut, copy, paste

Postby Anderson » Tue Dec 10, 2013 2:09 pm

codegreen wrote:building an editable version of the standalone and sticking a trace at the top of that itemSelect handler

I'm getting the same behavior and trace only activates with the menu click and NOT with the key command.
Anderson.
iMac - High Sierra - SC(current beta)
User avatar
Anderson
 
Posts: 220
Joined: Mon Jul 21, 2008 9:00 am
Location: Perth County, Canada

Re: keyboard commands - cut, copy, paste

Postby codegreen » Wed Dec 11, 2013 12:30 pm

I can't reproduce that behavior here.

In your editable standalone, try holding down the shift key while you select one of those items with the mouse. Does the script that pops up have your trace command in it?

-Mark
codegreen
 
Posts: 1545
Joined: Mon Jul 14, 2008 11:03 pm

Re: keyboard commands - cut, copy, paste

Postby Anderson » Thu Dec 12, 2013 5:04 am

Hi Mark,
Holding shift key while selecting "Cut"...
Code: Select all
on itemSelect
trace
Cut
end itemSelect
Anderson.
iMac - High Sierra - SC(current beta)
User avatar
Anderson
 
Posts: 220
Joined: Mon Jul 21, 2008 9:00 am
Location: Perth County, Canada

Re: keyboard commands - cut, copy, paste

Postby codegreen » Thu Dec 12, 2013 12:30 pm

Is a menuKey message being sent?
codegreen
 
Posts: 1545
Joined: Mon Jul 14, 2008 11:03 pm

Re: keyboard commands - cut, copy, paste

Postby Anderson » Thu Dec 12, 2013 4:27 pm

Command-H works for "hide"
Command-Q works for quit
Anderson.
iMac - High Sierra - SC(current beta)
User avatar
Anderson
 
Posts: 220
Joined: Mon Jul 21, 2008 9:00 am
Location: Perth County, Canada

Re: keyboard commands - cut, copy, paste

Postby codegreen » Thu Dec 12, 2013 8:08 pm

Yes, but what happens if you put this in the project script:

Code: Select all
on menuKey theKey
  put theKey
end menuKey

and then press Cmd-X?
codegreen
 
Posts: 1545
Joined: Mon Jul 14, 2008 11:03 pm

Re: keyboard commands - cut, copy, paste

Postby Anderson » Fri Dec 13, 2013 5:57 am

on command-x "X" appears in the message box
Anderson.
iMac - High Sierra - SC(current beta)
User avatar
Anderson
 
Posts: 220
Joined: Mon Jul 21, 2008 9:00 am
Location: Perth County, Canada

Re: keyboard commands - cut, copy, paste

Postby codegreen » Fri Dec 13, 2013 10:37 am

Your current window isn't a dialog, is it?
codegreen
 
Posts: 1545
Joined: Mon Jul 14, 2008 11:03 pm

Re: keyboard commands - cut, copy, paste

Postby Anderson » Fri Dec 13, 2013 1:14 pm

current window style is Movable
themebackground: default
controls: Draggable
Anderson.
iMac - High Sierra - SC(current beta)
User avatar
Anderson
 
Posts: 220
Joined: Mon Jul 21, 2008 9:00 am
Location: Perth County, Canada

Re: keyboard commands - cut, copy, paste

Postby codegreen » Fri Dec 13, 2013 4:26 pm

Ah, that explains it. When a dialog-style window is open, command key equivalents aren't processed the same way as in non-modal windows. A menuKey message is generated, but if there's an installed menu with that keyboard shortcut it won't be triggered or get an itemSelect.

The exception appears to be any items in the Apple menu, which Apple processes keyboard equivalents for all by itself. Commands such as Quit and Hide (which are handled without application intervention) evidently work just as in non-dialog windows. Equivalents for application-installed items are apparently processed even though we're not actually asking anyone to do it (which is why they're hilighting) but you won't get an itemSelect because SC doesn't execute its menu-processing code when dialogs are up.

If you want command key equivalents to trigger menu items in a dialog window, you'll have to add a menuKey handler to explicitly invoke your itemSelect handlers to the window script (or reorganize the code so both call a common handler).

HTH,
-Mark
codegreen
 
Posts: 1545
Joined: Mon Jul 14, 2008 11:03 pm

Re: keyboard commands - cut, copy, paste

Postby Anderson » Tue Dec 17, 2013 9:35 am

Anderson wrote:If you want command key equivalents to trigger menu items in a dialog window, you'll have to add a menuKey handler to explicitly invoke your itemSelect handlers to the window script (or reorganize the code so both call a common handler).

Thanks Mark,
I have inserted the menuKey handler example from the SC help/ SC language guide.
Is "Select All" something that I can add to that script? I am getting an error alert with command-A.
Anderson.
iMac - High Sierra - SC(current beta)
User avatar
Anderson
 
Posts: 220
Joined: Mon Jul 21, 2008 9:00 am
Location: Perth County, Canada


Return to Building Standalones

Who is online

Users browsing this forum: No registered users and 1 guest

cron