[fxruby-users] Painting a custom control

Wayne Conrad wconrad at yagni.com
Sat Oct 21 13:07:21 EDT 2006


In this code, the closure I've attached to SEL_PAINT is never called.
What's my newbie mistake?

Fox 1.4.34, FXRuby 1.4.7, Debian testing

#!/usr/bin/ruby1.8

require 'fox14'

include Fox

class CustomControl < FXFrame

  def initialize(*args)
    super
    connect(SEL_PAINT) do
      puts 'paint' # Never called
    end
  end

  def getDefaultWidth
    50
  end

  def getDefaultHeight
    50
  end

end

class Main

  def run
    app = FXApp.new
    main = FXMainWindow.new(app, File.basename(__FILE__))
    CustomControl.new(main)
    main.show(PLACEMENT_SCREEN)
    app.create
    app.run
  end

end

Main.new.run if $0 == __FILE__


More information about the fxruby-users mailing list