From: Ryan P. <rpu...@gm...> - 2008-01-07 03:57:01
|
On Jan 6, 2008 4:45 PM, Ryan Pusztai <rpu...@gm...> wrote: > The wxSizer::Add() function is not working right when wxLua is used as a > Lua module. > > Example script: > > require( "wx" ) > > frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "wxLua sizer test frame") > > -- Create two controls (note that their parents are the _frame_ (not the > sizer)) > textEntry = wx.wxTextCtrl(frame, 1001, "Enter URL"); > button = wx.wxButton(frame, 1002, "test") > > -- Put them in a vertical sizer, with ratio 3 units for the text entry, 5 > for button > -- and padding of 6 pixels. > sizerTop = wx.wxBoxSizer(wx.wxVERTICAL) > sizerTop:Add(textEntry, 1, wx.wxGROW + wx.wxALL, 6) > sizerTop:Add(button, 1, wx.wxGROW + wx.wxALL, 6) > > -- Set up the frame to use that sizer to move/resize its children controls > frame:SetAutoLayout(true) > frame:SetSizer(sizerTop) > > -- Optional - these will set an initial minimal size, just enough to hold > the > -- controls (more useful for dialogs than a frame) > sizerTop:SetSizeHints(frame) > sizerTop:Fit(frame) > > -- Start the application > wx.wxGetApp():SetTopWindow(frame) > frame:Show(true) > > -- ALWAYS call wx.wxGetApp():MainLoop() last to keep the program active > -- otherwise the lua program will exit immediately > wx.wxGetApp():MainLoop() > > > Error output: > > > $ ./lua test.wx.lua > > d:\devel\wxLua\wxBuilder\lua.exe: wxLua: Expected a number for parameter > > 2, but got 'userdata'. > > stack traceback: > > [C]: in function 'Add' > > test.wx.lua:21: in main chunk > > [C]: ? > > > > What is the problem? Shouldn't this work no matter how I am using wxLua? > I forgot to mention that this is using the dll release of wxLua v2.8.4.2 dll version. I am also using Windows XP. -- Regards, Ryan |