SELECT CASE key.Code
CASE key.Right
Message.Info("Premuto il tasto freccia a destra")
CASE key.Esc
Message.Info("Premuto il tasto Esc")
END SELECT
Ecc...ecc..
Ciao
grazie mille !
però ho un dubbio:
questo codice dovrei metterlo dentro un evento keypress di un form ,ad esempio :
PUBLIC SUB area_KeyPress()
DIM n AS Integer
n=griglia.Find(3)
SELECT CASE Key.Code
CASE key.Up
IF n > 24 THEN
griglia.Fill(0, n, 1)
griglia.Fill(3, n - 25, 1)
ENDIF
END SELECT
END
ma se invece volessi acquisire i tasi durante un evento timer?
:-) :-)
Questo è quello che intendevo io:
Chiamate principali negli oggetti
PUBLIC SUB TreeView1_KeyPress()
MainFrame.keyEvent(key.Code)
END
PUBLIC SUB TextArea1_KeyPress()
MainFrame.keyEvent(key.Code)
END
Sub principale unica di gestione dell'evento nel modulo principale (MainFrame)
PUBLIC SUB keyEvent(Code AS Variant)
SELECT CASE key.Code
CASE key.Right
Message.Info("Premuto il tasto freccia a destra")
CASE key.Esc
Message.Info("Premuto il tasto Esc")
END SELECT
END
Ciao
Funziona alla grande, anche per permettere all'utente di configurarsi i propri:
DIM xbindkeys_output AS String
DIM outputS AS String[]
DIM hotkey AS String
SHELL "touch /tmp/xbindkeysrc"
SHELL "xbindkeys -k -f /tmp/xbindkeysrc" TO xbindkeys_output
outputS = Split(xbindkeys_output, "\n", "", TRUE)
hotkey = Trim(outputS[outputS.count - 1])
Return hotkey
PUBLIC SUB Form_KeyPress()
IF key.code = key.Esc THEN FMain.CLOSE
end
nell' esempio vado a leggere l' evento key_press di fmain, ma puoi leggere tale evento da tutti gli oggetti compatibili :)