[fxruby-users] FXListBox and SEL_PAINT messages?
David Peoples
davidp at touringcyclist.com
Wed Apr 27 14:21:00 EDT 2005
The documentation says the FXListBox widget sends the SEL_COMMAND and
SEL_CHANGED messages. It doesn't say anything about the SEL_PAINT
message, and my test code (below), if correct, shows that FXListBox
doesn't send that message. Is there a way to cause that message to be
sent? I'm trying to alter the way an FXListBox displays itself.
David Peoples
--- test code start ---
#/usr/bin/env ruby
# Tested on Ruby 1.8.2, FXRuby 1.2.6, Windows XP and SuSE Linux
require 'fox12'
include Fox
class TestWindow < FXMainWindow
include Responder
ID_MYID = FXMainWindow::ID_LAST
def initialize(app)
super(app, "Generic Test", nil, nil, DECOR_ALL, 0, 0, 400, 200)
contents = FXHorizontalFrame.new(self,
LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH)
myListBox = FXListBox.new(contents, self, ID_MYID,
FRAME_SUNKEN|FRAME_THICK|LISTBOX_NORMAL|LAYOUT_FIX_WIDTH,
0, 0, 220, 0)
myListBox.appendItem('An example')
myListBox.appendItem('A longer example')
myListBox.appendItem('Short')
myListBox.numVisible = myListBox.numItems
FXMAPFUNC(SEL_CHANGED, TestWindow::ID_MYID, "onChange")
FXMAPFUNC(SEL_PAINT, TestWindow::ID_MYID, "onPaint")
# I tested this originally using myListBox.connect(...)
# then switched to the FXMAPFUNC() version in case the connect()
# behind-the-scenes magic didn't handle this situation.
end
def create
super
show(PLACEMENT_SCREEN)
end
def onPaint(sender, sel, ptr)
puts "TestWindow.onPaint called."
# This never gets called.
end
def onChange(sender, sel, ptr)
puts "TestWindow.onChange called."
# This gets called as expected.
end
end
application = FXApp.new("Generic Test", "FoxTest")
TestWindow.new(application)
application.create
application.run
--- test code end ---
--
David Peoples davidp at touringcyclist.com
The Touring Cyclist http://www.touringcyclist.com
11816 St. Charles Rock Road, Bridgeton, MO 63044
tel: 314-739-4648 fax: 314-739-4972
More information about the fxruby-users
mailing list