|
|
Loading wxLua as library into standard lua interpreterSummary
This can be preferrable over using the interpreter that comes with wxLua, for example when an existing application is extended with GUI functionality. The additional DLLs from the wxLua distribution are copied into the same folder as the lua binary. The application needs to be modified a bit, as the example shows:
CodeDownload-- ******** Added: Load wxLua library *********
if not wx then require("wx") end
-- standard hello world application
local frame = wx.wxFrame(wx.NULL,
wx.wxID_ANY,
"wxLua used as library",
wx.wxDefaultPosition,
wx.wxSize(400, 200),
wx.wxDEFAULT_FRAME_STYLE
)
local panel = wx.wxPanel(frame, wx.wxID_ANY)
function OnPaint(event)
local dc = wx.wxPaintDC(panel)
dc:DrawText("Hello World", 100, 100);
dc:delete()
end
panel:Connect(wx.wxEVT_PAINT, OnPaint)
frame:Show(true)
-- ******** Added: Hand over control to wxLua *********
wx.wxGetApp():MainLoop()
Output![]() © Markus Nentwig 2007-2008 The content of this page is provided without any warranty and may not be reproduced without permission. Comments? Questions?Please send me a mail! mnentwig@elisanet.fi |