Hello,
I've managed to integrate wxLua into a DLL that my application uses. The
DLL is purely there to provide script capabilities. When a user wants to
run a script, the action ends up in the DLL which uses the following code:
// luaControl constructor. luaControl is derived from wxWindow.
luaControl::luaControl(wxWindow *parent, MINSTANCE mInst, wxMachPluginLuaApp
*pluginApp, HMCPLUG id)
{
wxWindow::Create(parent, ID_LUAWIN);
WXLUA_IMPLEMENT_BIND_ALL
// OnInit() already called
// wxLuaState::sm_wxAppMainLoop_will_run = false;
m_wxlState = wxLuaState(this, wxID_ANY);
}
int luaControl::ExecuteScript(wxString &filename)
{
if (!m_wxlState.Ok()) {
return(-1);
}
int rc = m_wxlState.RunFile(filename);
if (rc != 0) {
wxString emsg = wxlua_LUA_ERR_msg(rc);
mcSetLastError(this->m_cid, (const char *)emsg.char_str());
return(rc);
}
while (m_wxlState.IsRunning())
;
return(rc);
}
This, at first, seems to work fine. The script will execute and show it's
GUI window. Take minimal.wx.lua, for example. But when you are done
playing with the script, you can't close its top level window! I seem to
have painted myself into a corner. I think it has something to do with the
fact that the application as a whole has multiple wxApp classes. One for
the main GUI executable, one for a DLL that is the core of the application,
and one for the scripting DLL. This is on Windows, for the moment, and
wxWidgets is compiled into static libs which all modules link to.
It feels like it is hooking the GUI executable's main loop instead of the
script DLLs main loop. Is there any way to force wxLua to use a particular
wxApp instance? Or am I barking up the wrong tree?
Thanks,
Steve
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users