This modified version of evt_paint sets a variable indicating that a paint event is being handled just before running the event handler. This ensures that any call to Window#paint within the handler will supply a Wx::PaintDC (see swig/Window.i).
Source Code
# File wx/classes/window.rb, line 40 def evt_paint(meth = nil, &block) paint_proc = acquire_handler(meth, block) wrapped_block = proc do | event | instance_variable_set("@__painting__", true) paint_proc.call(event) remove_instance_variable("@__painting__") end __old_evt_paint(&wrapped_block) end
<code/>and<pre/>for code samples.