Keyboard shortcuts

Discuss any general programming issues here
Post Reply
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Keyboard shortcuts

Post by djrikki »

Hello,

Got a bit of a problem:

Code: Select all

installeventhandler({OnKeyDown = p_keyboardShortcuts})

while fileselected = false
	waitevent
wend

function p_keyboardShortcuts(msg)
	switch msg.action
		case "OnKeyDown"
			if iskeydown("LCONTROL") = true
				debugprint(msg.key)
			endif
	endswitch
endfunction
Or even:

Code: Select all

if msg.key = "p" and iskeydown("LCONTROL") = true; Parent
	debugprint(msg.key)
endif
Ideally I want to set up shortcuts like RAMIGA+P = parent, RAMIGA+N = create new drawer, but I can't even read LCONTROL or even LSHIFT on this amigaone keyboard. Help doesn't even say anything about the Amiga keys to tbh so I don't if I can do that, but a control key would be nice at least. Help!?
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Keyboard shortcuts

Post by airsoftsoftwair »

The Amiga keys are called the command keys for platform independence. On Windows the command keys are mapped to the Windows key, on Mac OS X to the Mac command key etc.

Querying key combinations like LCONTROL+P is not easy because qualifier keys like control, shift, command often modify the key codes of the rest. So "P" might not always get through correctly. Better don't rely on this because it is pretty lowlevel. It would need a different API to ensure cross-platform compatibility.
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: Keyboard shortcuts

Post by djrikki »

Hi Andreas,

I suspected LCOMMAND/RCOMMAND would equal the Amiga keys, I'll take a look at this again sometime to try and get it working, for now other things to be working on.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
Post Reply