Simon Strandgaard
1/6/2005 5:28:00 PM
On Fri, 7 Jan 2005 01:26:29 +0900, Martin DeMello
<martindemello@yahoo.com> wrote:
> How do I read the pressed state of the shift, ctrl etc keys from within
> FXRuby? (And is the correct way to read a Ctrl-A to trap an OnKeypress
> for A and check if Ctrl is pressed?)
def onKeypress(sender, sel, event)
p "keysym=#{event.code} state=#{event.state} text=#{event.text}"
if (event.state & CONTROLMASK) != 0
if event.text == 'a'
p "we got a"
end
end
end
elsewhere you must do
widget.connect(SEL_KEYPRESS, method(:onKeypress))
(untested)
--
Simon Strandgaard