Hi,

could somebody tell me what I'm doing wrong with SetSizeHints() in the
following code? I have a window with a listbox and four buttons and
I want the window to use the size of the vertical boxsizer, so that there
are no blank spaces. I think SetSizeHints() is the function to use for
that but unfortunately, it doesn't work. There's still lots of blank
space in the window, although I'm calling SetSizeHints() on the boxsizer.

Here's the code:

local frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "Test")
local panel = wx.wxPanel(frame, -1) 
local vbox = wx.wxBoxSizer(wx.wxVERTICAL)  
local listBox = wx.wxListBox(panel, wx.wxID_ANY)                       
local buttonSizer = wx.wxBoxSizer(wx.wxHORIZONTAL)
local add_button = wx.wxButton(panel, wx.wxID_ANY, "Add")
local moveup_button = wx.wxButton(panel, wx.wxID_ANY, "Move up")
local movedown_button = wx.wxButton(panel, wx.wxID_ANY, "Move down")            
local remove_button = wx.wxButton(panel, wx.wxID_ANY, "Remove")

buttonSizer:Add(add_button, 0, wx.wxALIGN_CENTER+wx.wxALL, 5)
buttonSizer:Add(moveup_button, 0, wx.wxALIGN_CENTER+wx.wxALL, 5)
buttonSizer:Add(movedown_button, 0, wx.wxALIGN_CENTER+wx.wxALL, 5)
buttonSizer:Add(remove_button, 0, wx.wxALIGN_CENTER+wx.wxALL, 5)
        
vbox:Add(listBox, 0, wx.wxEXPAND+wx.wxALL, 5)   
vbox:Add(buttonSizer, 0, wx.wxALL+wx.wxGROW+wx.wxCENTER)

panel:SetSizer(vbox) 
vbox:SetSizeHints(panel)
                                                                                
frame:Show(true) 
        
wx.wxGetApp():MainLoop()

-- 
Best regards,
 Andreas Falkenhahn                          mailto:andr...@falkenhahn.com


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to