[fxruby-users] Painting a custom control

Lyle Johnson lyle at knology.net
Sat Oct 21 13:53:39 EDT 2006


On Oct 21, 2006, at 12:07 PM, Wayne Conrad wrote:

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

The connect() method is used to define message handlers for messages  
sent from a widget to its target. FXFrame doesn't send a SEL_PAINT  
message to its target, so that's why your code never gets invoked.

If you simply want to override FXFrame's default handling of  
SEL_PAINT, I think you'll need to do something like this:

	class MyFrame < FXFrame
		def initialize(...)
			FXMAPFUNC(SEL_PAINT, 0, :onPaint)
		end
		def onPaint(sender, sel, event)
			# Respond to expose event here
		end
	end

Hope this helps,

Lyle


More information about the fxruby-users mailing list