From: Milind G. <mil...@gm...> - 2012-02-21 19:26:23
|
Hi John, Thanks for the reply. I created a minimal example (attached and pasted). This example works fine in windows but doesn't show anything in Linux. Also another thing I noticed in my original program is that when the GUI is shown the list Controls in which I have added a lot of elements show scroll bars also! But no elements are visible. ------------------------------------------------------------------------------------------------------------------------------ -- Load the wxLua module, does nothing if running from wxLua, wxLuaFreeze, or wxLuaEdit package.cpath = package.cpath..";./?.dll;./?.so;../lib/?.so;../lib/vc_dll/?.dll;../lib/bcc_dll/?.dll;../lib/mingw_dll/?.dll;" require("wx") frame = nil -- Create a function to encapulate the code, not necessary, but it makes it -- easier to debug in some cases. function main() -- create the wxFrame window frame = wx.wxFrame( wx.NULL, -- no parent for toplevel windows wx.wxID_ANY, -- don't need a wxWindow ID "wxLua Minimal Demo", -- caption on the frame wx.wxDefaultPosition, -- let system place the frame wx.wxSize(450, 450), -- set the size of the frame wx.wxDEFAULT_FRAME_STYLE ) -- use default frame styles local sizer = wx.wxBoxSizer(wx.wxHORIZONTAL) local listCtrl = wx.wxListCtrl(frame, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize,bit.bor(wx.wxLC_REPORT,wx.wxLC_NO_HEADER)) -- Add Item local col = wx.wxListItem() col:SetId(0) listCtrl:InsertColumn(0,col) local newItem = wx.wxListItem() newItem:SetId(0) newItem:SetText("Test Item") listCtrl:InsertItem(newItem) sizer:Add(listCtrl, 1, bit.bor(wx.wxALL,wx.wxEXPAND,wx.wxALIGN_CENTER_HORIZONTAL,wx.wxALIGN_CENTER_VERTICAL), 1) frame:SetSizer(sizer) sizer:SetSizeHints(frame) frame:Layout() -- show the frame window frame:Show(true) end main() -- Call wx.wxGetApp():MainLoop() last to start the wxWidgets event loop, -- otherwise the wxLua program will exit immediately. -- Does nothing if running from wxLua, wxLuaFreeze, or wxLuaEdit since the -- MainLoop is already running or will be started by the C++ program. wx.wxGetApp():MainLoop() On Tue, Feb 21, 2012 at 1:42 AM, John Labenski <jla...@gm...> wrote: > On Tue, Feb 21, 2012 at 3:44 AM, Milind Gupta <mil...@gm...> > wrote: > > After digging a bit deeper I find that the items are added to the control > > since subsequent calls to InsertItem does detect them but they are not > > visible in the GUI. I tried setting the text foreground color also to > black > > Do you call Freeze() on it before adding the items and forget to call > Thaw()? > > I see that you are skipping every other item since you call > GetNextItem() twice, but only check the value of it once and more > dangerously, don't check that you haven't fallen off the end of the > list after the second call. > > You could simply just add a few items where you know they'll be and > see if that works. > > Regards, > John > > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > wxlua-users mailing list > wxl...@li... > https://lists.sourceforge.net/lists/listinfo/wxlua-users > |