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?
-- 
Regards,
Ryan
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to