Displaying 2 results from an estimated 2 matches for "wrapped_block".
2007 Apr 29
0
[992] branches/wxruby2/wxwidgets_282/lib/wx/classes/window.rb: Fix passing of PaintEvent object in paint handler
...ass="cx"> # handler. This ensures that any call to Window#paint within the
</span><span class="cx"> # handler will supply a Wx::PaintDC (see swig/Window.i).
</span><span class="cx"> def evt_paint(&block)
</span><del>- wrapped_block = proc do
</del><ins>+ wrapped_block = proc do | event |
</ins><span class="cx"> instance_variable_set("@__painting__", true)
</span><del>- block.call
</del><ins>+ block.call(event)
</ins><span class=&qu...
2007 Apr 29
0
[983] branches/wxruby2/wxwidgets_282: Make Window#paint work both inside and outside a paint event handler,
...+ # 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).
+ def evt_paint(&block)
+ wrapped_block = proc do
+ instance_variable_set("@__painting__", true)
+ block.call
+ remove_instance_variable("@__painting__")
+ end
+ __old_evt_paint(&wrapped_block)
+ end
</ins><span class="cx"> end
</span></span></pre></...