From: Andreas F. <an...@fa...> - 2013-10-02 21:55:46
|
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:an...@fa... |