Page 1 of 1

Keyboard shortcuts

Posted: Mon May 02, 2011 4:09 pm
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!?

Re: Keyboard shortcuts

Posted: Tue May 03, 2011 7:53 pm
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.

Re: Keyboard shortcuts

Posted: Tue May 03, 2011 10:26 pm
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.