Problem changing wxComboBox width

David Carr dc at dcarr.org
Sun Oct 7 16:51:59 PDT 2007


Here is an minimal example of what I have.  How should I change this so
that the wxComboBox is just wide enough to fit the text?  In my actual
application, there are several other widgets in the same sizer with the
wxComboBox.

    wxPanel* root = new wxPanel(this, -1);
    wxBoxSizer* root_sizer = new wxBoxSizer(wxHORIZONTAL);

    wxComboBox* cb = new wxComboBox(root, -1, wxT("Text"),
					    wxDefaultPosition,
					    wxDefaultSize);
    cb->SetSize(100,-1); //try to change the width

    root_sizer->Add(cb, 0);

    root->SetSizer(root_sizer);

Thanks for the help,
David Carr





More information about the wx-users mailing list