Hello, my name is Gregor and I''m new to this list and to wxRuby/wxDialogs. That''s why I wanted to introduce myself shortly. I''m a Ruby fan for 2 years now and I''m doing a lot of web development with Rails and a little Camping and I''m currently writing my Master''s Thesis around Ruby. You may follow my thoughts on my blog www.nach-vorne.de if you want to. I''m trying to get warm with GUI application development with Ruby, of course and I like wxRuby since it gives my a native looking app on Mac (my development platform) and Windows (the target platform). I''m running OS X, Ruby 1.8.6, wxWidgets 2.84 and wxruby2-preview-0.0.40 But let''s speak about the current problem, I''m facing. I''m having a problem, which was already mentioned on this list back in 2004 (http://rubyforge.org/pipermail/wxruby-users/2004-June/000612.html) but I cannot find any hint on a solution. I try building a modeless dialog (a plain WxDialog) with some controls and Ok Cancel buttons. I''m registering the Ok Click Event to store something in the database and closing the dialog using close or hide (I tried both). The dialog closes as expected. But unfortunately the whole application does not close, after I used the dialog. It may only be "closed" using Ctrl+C on the command line. To reproduce the problem you may use the code for SearchDialog in the "Using Dialog to talk to the User II" Tutorial. It acts the same. Thanks for any hints. Regards Gregor
Alex Fenton
2007-Jul-28 13:34 UTC
[Wxruby-users] Modeless Dialog causes Application to hang on exit
Hi Gregor Schmidt wrote:> my name is Gregor and I''m new to this list and to wxRuby/wxDialogs. > That''s why I wanted to introduce myself shortly. >Welcome. Be interested> I try building a modeless dialog (a plain WxDialog) with some controls > and Ok Cancel buttons. I''m registering the Ok Click Event to store > something in the database and closing the dialog using close or hide > (I tried both). The dialog closes as expected. But unfortunately the > whole application does not close, after I used the dialog. It may only > be "closed" using Ctrl+C on the command line. > > To reproduce the problem you may use the code for SearchDialog in the > "Using Dialog to talk to the User II" Tutorial. It acts the same >I get the same issue with that sample on Linux. I think the solution is to call dialog.destroy() when you are sure that the dialog is no longer needed and before the App exits. An App won''t exit cleanly if there are still windows hanging around, even if they aren''t visible. For most windows (eg Frames and modal dialogs) this isn''t a problem, because when a window is closed it implies that the window is no longer needed, and wxWidgets disposes of it. So, no explicit ''destroy'' call is needed. But for modeless dialogs, the dialog could be re-shown at a later point, so destroy has to be called explicitly. AFAIK this is the same in wxPython. HTH alex
Gregor Schmidt
2007-Jul-28 14:30 UTC
[Wxruby-users] Modeless Dialog causes Application to hang on exit
Hello, Thanks for the hint. Now it closes correctly. I''m now registering an event handler for the close event of the dialog and destroy it in there. Perhaps somebody should update the example accordingly to demonstrate a correct solution. Cheers Gregor
Alex Fenton
2007-Jul-28 15:29 UTC
[Wxruby-users] Modeless Dialog causes Application to hang on exit
Gregor Schmidt wrote:> Thanks for the hint. Now it closes correctly. I''m now registering an > event handler for the close event of the dialog and destroy it in > there. >Just a note that an alternative is to create the Dialog with the Frame as the parent, instead of nil i.e. dialog = SearchDialog.new(my_frame) Then when the Frame is closed, the Dialog is automatically disposed of too. So no explicit destroy is needed. It''s just if it''s a free-floating top level window with no parent that it will hang.> Perhaps somebody should update the example accordingly to demonstrate > a correct solution. >Will do. Some of the wiki tutorials are in need of some TLC. alex
Gregor Schmidt
2007-Jul-28 15:36 UTC
[Wxruby-users] Modeless Dialog causes Application to hang on exit
On 7/28/07, Alex Fenton <alex at pressure.to> wrote:> Gregor Schmidt wrote: > > Thanks for the hint. Now it closes correctly. I''m now registering an > > event handler for the close event of the dialog and destroy it in > > there. > > > Just a note that an alternative is to create the Dialog with the Frame > as the parent, instead of nil i.e.Okay, this is what I really wanted. Thanks again. Cheers, Gregor
Possibly Parallel Threads
- [926] branches/wxruby2/wxwidgets_282: Update Dialog wx2.6 -> wx2.8 API, remove deprecations and cruft, update doc
- Camping and ruby2ruby
- screenshots & wxruby apps
- Simulate HTTP put and delete in Camping/SleepingBag
- [ wxruby-Bugs-8130 ] Crash-on-exit when dialogs have been used