Need working example of Hotkey

Discuss any general programming issues here
Post Reply
User avatar
Redlion
Posts: 94
Joined: Sun Jul 10, 2011 5:05 am
Location: Perth, Western Australia

Need working example of Hotkey

Post by Redlion »

Hi all,

I have been trying to get some key combinations as "hotkeys" for a simple editor I have written with HW 6 and MUIRoyale. It kind of works, but it would be great if I could use the keyboard for things like Copy and Paste.

I have a MUI toolbar gadget with a Copy and Paste button (they work fine) but would like a keyboard shortcut tfor the buttons. Using the _C and _P does not work because there is a active MUI Editor gadget.

I found -cxkey hotkey but I have no idea how to get it to work (not running form console)

Does anyone have a simple example of using keyboard sortcut (Hotkeys) like control c to copy and control v to paste.

thanks
Leo
----------------------------------------------------------------------------------------
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Need working example of Hotkey

Post by airsoftsoftwair »

CXKEY is for installing a hotkey combination for the commodities system, so that's nothing that could help you here. The Toolbar.hws example in Examples/External shows how to use hotkeys (i.e. by using an underscore character in the button text) but I think you've already seen that. The problem is that MUI is designed in a way that only the active gadget receives keyboard events, i.e. while the text editor gadget has the focus, only the text editor will receive keyboard events. That's why the toolbar hotkeys don't work at that time. I'm afraid there's nothing you can do against this...
evil
Posts: 177
Joined: Mon Jun 14, 2010 1:38 pm

Re: Need working example of Hotkey

Post by evil »

But specially for Copy and Paste, you can react on those hotkey-events, as you can put those things into menus.
If you for examplehave a Menu Edit with Menupoints Cut/Copy and Paste in it, you simply give them a shortcut-tag in the xml-file and your editor should react on it.

Example of an menu-entry:
<item id="cut" shortcut=\"x\" notify=\"selected\">"Cut"</item>")

Your Program should than react on the RAmiga_c key.
Or did I completely missunderstand the question???

Best regards

George
Post Reply