Matthieu Caron | 29 May 17:30

Ending the wxApp process when a scripted lua frame is closed

Hi everyone.

I think my problem is really simple, but I need some help to understand how it works.

I created a wxwidget project (wxApp) which display a Dialog window with a file picker to let the users select and load their own script. Then, I close the Dialog window and I run the script chosen thanks to the Runfile().
Everything is Ok for this part. The Script works well and my frame coded in Lua appears.

Then, when I want to finish my application, I click on the "close button" of my scripted frame. The frame desappears as well, but I still have a process running (the process of my wxApp) and I can't end it (no more wxFrame). The only solution is to "kill" the process with the task manager.

I looked at the wxLua application in the sources, but I can't understand how the process wxApp is ended...

Hope you could help me.

Matthieu

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
wxlua-users mailing list
wxlua-users@...
https://lists.sourceforge.net/lists/listinfo/wxlua-users
John Labenski | 4 Jun 06:26

Re: Ending the wxApp process when a scripted lua frame is closed

On Thu, May 29, 2008 at 11:30 AM, Matthieu Caron
<caron.matthieu1@...> wrote:
> Hi everyone.
>
> I think my problem is really simple, but I need some help to understand how
> it works.
>
> I created a wxwidget project (wxApp) which display a Dialog window with a
> file picker to let the users select and load their own script. Then, I close
> the Dialog window and I run the script chosen thanks to the Runfile().
> Everything is Ok for this part. The Script works well and my frame coded in
> Lua appears.
>
> Then, when I want to finish my application, I click on the "close button" of
> my scripted frame. The frame desappears as well, but I still have a process
> running (the process of my wxApp) and I can't end it (no more wxFrame). The
> only solution is to "kill" the process with the task manager.
>
> I looked at the wxLua application in the sources, but I can't understand how
> the process wxApp is ended...

The wxApp class calls your wxApp::OnInit() which then calls
wxApp::MainLoop() where the program "hangs" in the event loop. By
default the mainloop will exit when there are no more top level
windows. Do you call  wxApp::SetExitOnFrameDelete(false)?

http://docs.wxwidgets.org/stable/wx_wxapp.html#wxappsetexitonframedelete

Since you show a dialog, close it, then run a program that presumedly
creates a new dialog/frame you may need to set
SetExitOnFrameDelete(false) then close the dialog, load the script,
set it back to true, and then run the script.

Hope this helps,
    John

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

Gmane