Link to home
Start Free TrialLog in
Avatar of LittlePerson
LittlePerson

asked on

ComboBoxes

Hi

Must be a bad day today as I can;t get nowt to work!

Combo box in DLG.
member variable assigned - m_lineCombo

OnInitDialog()

m_lineCombo.AddString(" Solid");
m_lineCombo.AddString(" Dashed");
m_lineCombo.AddString(" Dotted");
m_lineCombo.AddString(" Dash-Dot");
m_lineCombo.AddString(" Dash-Dot-Dot");

I get nothing showing in combo box!
Hmmmm!!

Thanks
Avatar of martynjpearson
martynjpearson

It could be because the drop down list hasn't been sized so that it is big enough. In the resource editor, click on the down arrow bit of the combo and drag the rectangle down a bit.

Hope this helps
Martyn
Did you call CDialog::OnInitDialog before adding the strings?  That should have thrown an assertion, though.  I assume you aren't just looking for m_lineCombo.SetCurSel(0)

Avatar of LittlePerson

ASKER

I add the strings at the end of OnInitDialog().
The Combobox looks fine for size, just that there is nothing dropping down - not even and empty
item. Nowt, Nothing, the old hole in the donut trick!

You would have thought this was Monday!"@%$#

Cheers
If you click on the control, can you use the up and down cursor keys to scroll between items? If that's the case, then it's definitely the size of the drop down bit. If not, then you could try rebuilding all just in case some resources have got mixed up, but I would have thought that would have caused ASSERTs.

Look on the bright side, it can't be that long 'til hometime!!

Martyn
A couple other suggestions :
- check the return codes, if CB_ERR, get the GetLastError() code.
- verify that you're not calling ResetContent() later.
The control is visible, but It just ain't doing anything. I deleted .clw (classwizard file) and rebuilt
but no joy.
I have not defined any size for the drop down bit. Do I need too?


Thanks
ASKER CERTIFIED SOLUTION
Avatar of martynjpearson
martynjpearson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I had not clicked on the arrow properly and therefore never new you could
pull that bit down. Can you do this from code?

SetWindowPos - a combo box, when closed, never gets bigger than its edit box, so any extra space at the bottom is automatically part of the drop-down.