Skip to content

Instantly share code, notes, and snippets.

@damian-m-g
Created January 15, 2013 01:01
Show Gist options
  • Save damian-m-g/4535066 to your computer and use it in GitHub Desktop.
Save damian-m-g/4535066 to your computer and use it in GitHub Desktop.
The event SEL_KEYRELEASE is not triggered correctly on a #FXButton.
#encoding: utf-8
require 'fox16'
include Fox
class HelloWindow < FXMainWindow
def initialize(app)
ventana = super(app, "Hello, World!", width: 600, height: 400)
a = FXPacker.new(ventana, opts: LAYOUT_FILL)
MiBoton.new(a)
end
def create
super
show(PLACEMENT_SCREEN)
end
end
#########################################################################
class MiBoton < Fox::FXButton
def initialize(widget_padre)
super(widget_padre, 'Testing')
connect(SEL_ENTER) do |sender, selector, data|
setFocus
puts "SEL_ENTER"
if (data.state & CONTROLMASK).!=(0)
puts "with ctrl"
else
puts "without ctrl"
end
end
connect(SEL_LEAVE) do |sender, selector, data|
killFocus
puts "SEL_LEAVE"
end
connect(SEL_LEFTBUTTONPRESS) do |seneder, selector, data|
puts "SEL_LEFTBUTTONPRESS"
if (data.state & CONTROLMASK).!=(0)
puts "with ctrl"
else
puts "without ctrl"
end
0
end
connect(SEL_KEYRELEASE) do |sender, selector, data|
puts "SEL_KEYRELEASE"
end
connect(SEL_KEYPRESS) do |sender, selector, data|
puts "SEL_KEYPRESS"
end
end
end
#############################################################
if __FILE__ == $0
FXApp.new do |app|
HelloWindow.new(app)
app.create
app.run
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment