combo drop down behaviour

Hi Robin,

That worked fine… But I am having trouble when I try appending an item later on…Refresh also didn’t fix the problem. the size of the combo control remains the same…

eg:

import wx
class MainWindow(wx.Frame):
def init(self,parent,id,title):
wx.Frame.init(self,parent,wx.ID_ANY, title, size = ( 800,600),
style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)

    self.panel1 = wx.Panel(id=wx.ID_ANY, name='panel1',
          parent=self, pos=wx.Point(16, 8), size=wx.Size(368, 208),
          style=wx.TAB_TRAVERSAL)
    sampleList = ['zero', 'one', 'two', 'three', 'four', 'five','six', 'seven', 'eight']
    self.comboBox1 = wx.ComboBox(choices=sampleList, id=wx.ID_ANY,
          name='comboBox1', parent=self.panel1, pos=wx.Point(24, 64),
          style=0, value='comboBox1')

app = wx.PySimpleApp()
frame = MainWindow(None, -1, “DocBox Client”)
frame.comboBox1.Append(“this is a ver big item added later on”);
frame.Refresh()
frame.Show(1);frame.Hide();frame.Show(1);
app.MainLoop()

cheers

···

Thomas Thomas

phone +64 7 855 8478
fax +64 7 855 8871

Thomas Thomas wrote:

Hi Robin,
That worked fine.. But I am having trouble when I try appending an item later on..Refresh also didn't fix the problem.

Refresh only causes a EVT_PAINT event to be sent, it has nothing to do with sizes of child controls.

the size of the combo control remains the same..

Controls don't resize unless you tell them to in some way, such as with a sizer or explicitly. For example:

  frame.comboBox1.SetSize(frame.comboBox1.GetBestSize())

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!