Hello Jay,<br><br>To process an exit event, or rather a close event, utilize evt_close event handler. Also, what errors are you getting with 1.9.3/4?<br><br><div><span class="gmail_quote">On 1/19/08, <b class="gmail_sendername">
Jay McGavren</b> <<a href="mailto:jay@mcgavren.com">jay@mcgavren.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
OK, back with another iteration of the same problem... I updated my<br>game demo, but the Close button failed to respond when (and only when)<br>there were too many objects onscreen. The drawing loop is probably<br>lasting longer than my drawing timer interval. I was able to
<br>reproduce the problem in my (probably familiar by now) test script<br>just by boosting the number of lines drawn per frame.<br><br>After each frame, I tried Wx::App.dispatch, Wx::App.dispatch while<br>Wx::App.pending, and Wx::
App.yield, all without effect. The<br>(commented out) statements are in the code below.<br><br>I'm running Ruby 1.8.6 on Windows with wxRuby 1.9.2 (1.9.3 and 1.9.4<br>both give me errors).<br><br>If wxRuby is busy drawing when the close button is clicked, is the
<br>window close event getting lost altogether, or merely going unhandled?<br> If it's just going unhandled, how can I find it and process it? Help<br>is, as always, most appreciated!<br><br>-Jay McGavren<br><a href="http://jay.mcgavren.com/zyps">
http://jay.mcgavren.com/zyps</a><br><br><br> require 'rubygems'<br> require 'wx'<br><br> class MyApp < Wx::App<br><br> def on_init<br><br> #Containing frame.<br> frame = Wx::Frame.new(nil, :size => [300, 300])
<br> frame.show<br><br> #Offscreen drawing buffer.<br> buffer = Wx::Bitmap.new(300, 300)<br><br> #Displays drawing.<br> window = Wx::Window.new(frame, :size => [300, 300])<br> window.evt_paint
do |event|<br> update_window(window, buffer)<br> end<br><br> #Initialize drawing loop counter.<br> @i = 0<br><br> #Animate periodically.<br> timer_id = Wx::ID_HIGHEST + 1<br> t = Wx::
Timer.new(self, timer_id)<br> evt_timer(timer_id) do<br> animate(window, buffer)<br> #No effect.<br> #self.dispatch<br> #No effect.<br> #self.dispatch while self.pending<br> #No effect.
<br> #self.yield<br> end<br> t.start(33)<br><br> end<br><br> def animate(window, buffer)<br> green_pen = Wx::Pen.new(Wx::Colour.new(128, 255, 128), 3)<br> black_pen = Wx::Pen.new(Wx::Colour.new
(0, 0, 0), 0)<br> buffer.draw do |surface|<br> #Clear screen.<br> surface.pen = black_pen<br> surface.brush = Wx::BLACK_BRUSH<br> surface.draw_rectangle(0, 0, 300, 300)<br> #Draw lines.
<br> surface.pen = green_pen<br> surface.pen.cap = Wx::CAP_ROUND<br> 30000.times do |j|<br> x = @i + j<br> surface.draw_line(x, 0, x+100, 100)<br> end<br> end<br> #Update screen.
<br> update_window(window, buffer)<br> @i += 1<br> @i = 0 if @i > 300<br> end<br><br> def update_window(window, buffer)<br> window.paint do |dc|<br> #Copy the buffer to the viewable window.
<br> dc.draw_bitmap(buffer, 0, 0, false)<br> end<br> end<br><br> end<br><br> app = MyApp.new<br> app.main_loop<br>_______________________________________________<br>wxruby-users mailing list<br><a href="mailto:wxruby-users@rubyforge.org">
wxruby-users@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/wxruby-users">http://rubyforge.org/mailman/listinfo/wxruby-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>Mario Steele<br><a href="http://www.trilake.net">
http://www.trilake.net</a><br><a href="http://www.ruby-im.net">http://www.ruby-im.net</a><br><a href="http://rubyforge.org/projects/wxruby/">http://rubyforge.org/projects/wxruby/</a><br><a href="http://rubyforge.org/projects/wxride/">
http://rubyforge.org/projects/wxride/</a><br><a href="http://rubyforge.org/projects/vwmc/">http://rubyforge.org/projects/vwmc/</a>