Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / wxComboBox..help!!!

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. wxComboBox..help!!!
#4598
Posted by: bec 2004-06-24 09:10:11
Help!!!

Trying to create a combobox inside a wxStaticBox.
I want the combobox size to be fixed at say 100 by 100.

Here is the code from my main frame.
No matter what i seem to do the height of the combo box is always the same.
The width can be changed, so how do i adjust the height?



WidgetsFrame::WidgetsFrame(const wxString& title)
            : wxFrame(NULL, -1, title, wxPoint(0, 50), wxSize(400, 400))
{

    wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set style"));

    wxSizer *sizer = new wxStaticBoxSizer(box, wxVERTICAL);

    sizer->SetDimension(0, 0, 400, 400);

    /*
     *  Create the combo box.
     */
    wxComboBox *cb = new wxComboBox
            (
                this,
                -1,
                "",
                wxDefaultPosition,
                wxSize(100,100),
                0,
                NULL,
                wxCB_SIMPLE
            );
   
    /*
     *  Add it to the sizer.
     */
    sizer->Add
        (
            cb,
            1,
            wxALL,
            10
       );

  sizer->Layout();
}

Message2. Re: wxComboBox..help!!!
#4618
Posted by: guidance 2004-06-25 06:46:36
I suppose combobox height is fixed to one line by the OS, but listbox changeable.
Message3. Re: wxComboBox..help!!!
#4621
Posted by: upCASE 2004-06-25 14:48:17
Hi!
I think Guidance is right. Normally the height of a combobox doesn't change, but only the height of the list that pops up.
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message4. Re: wxComboBox..help!!!
#4670
Posted by: bec 2004-06-29 12:55:39
Hey,

I figured out how to control the height. Well sort of..but hey, it works..

If you intialise the wxComboBox with a dummy array of empty strings, the combo box will be the height required to display the arrat length.

eg.


wxString choices[] =
    {
        _T(""),
        _T(""),
        _T(""),
        _T(""),
        _T("")
    };


    fw_FontFamilyCB = new wxComboBox
        (
            aw_mainBox,
            WID_FONT_FAMILY_CB,
            "",
            wxPoint(10, 20),
            wxSize(180, -1),
            5,
            choices,
            wxCB_SIMPLE | wxCB_SORT
        );


will produce a combobox that can display 5 rows.
Then just clear the combobox when there is meaningful data to insert.

bec.
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Tue 2024-12-10  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0