ok, I'm back online so as promised...

You need to declare the various key and event constants (in capitals)
and can get them from the wiki or by looking at other squeezeplay
applets. I'm  assuming your applet has a menu screen  which your code
references by the object variable 'window'.  If that's the case then
stick the following into your code that creates the menu.

window:addListener(EVENT_KEY_ALL,
function(event)
local keyCode = event:getKeyCode()
local type = event:getType()

if type = EVENT_KEY_PRESS then -- key has been pressed and
released
if keyCode == KEY_GO then
-- do stuff if centre button is pressed.
elseif keyCode == KEY_BACK then
-- do stuff if back is pressed.
elseif keyCode == KEY_PLAY then
-- you get the idea...
elseif keyCde == KEY_HOME
-- this keeps the default action
return EVENT_UNUSED
end
elseif type == EVENT_KEY_HOLD -- key has been held
if keyCode == KEY_ADD then
-- do stuff if add is held
end
end
end
)


I must stress that I'm very new to creating applets so this may not be
the best way (or even a good way) of doing it but it works for me. I'm
also not 100% sure of how or why it works!


-- 
indifference_engine
------------------------------------------------------------------------
indifference_engine's Profile: 
http://forums.slimdevices.com/member.php?userid=20698
View this thread: http://forums.slimdevices.com/showthread.php?t=66354

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to