Link to home
Start Free TrialLog in
Avatar of marcus78
marcus78

asked on

Programmatically set the dropdown height of combo box

I've got a combobox i am dynamically creating.  I can't set the dropdown height of the combobox in devstudio.

I'm doing a
m_combo.Create(WS_CHILD|WS_VISIBLE|CBS_DROPDOWNLIST, rect, this, ID_TEST);

which works fine, but the dropdown has no height.

Thanks for your help,
Marcus
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

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 think rect describes the whole rect when the combo is "dropped down" (that means editline plus list).
Avatar of marcus78
marcus78

ASKER

Dan,

Thanks again!  That is pretty vague. It seems as though the dimensions of the control should be described in <rect>, then a Function Call would set the drop down height.

Also,  Could you cue me in on the best practices around here? Pacman also hinted at the same solution as you did, but I accepted your because it was much more complete.  I definitely don't want to make anyone mad around here, because this is such a great place for info. Is there a better way to accept an answer in this case, or have I done it correctly?

Thanks,
Marcus
>>dimensions of the control should be described in <rect>, then a Function Call would set the drop down height.

ComboBoxes are a bit strange that way.  The height of the "always visible" part of the control is set automatically and is based upon the height of the indivifdual items in the list.

Think of a ComboBox as a List in which the body of the list is hidden.  Then it makes sense that the <rect> must specify that size.  Also remember that if there are few items in the list, the drop-down will be only large enough to show those items.

One other note:  Many programmers don't have a clue about user interface design so they make the drop-down list very short, forcing the user to scroll to see items at the bottom.  It is better to make the list very high so that more items are visible.  The dropdown can extend beyond the bottom of the parent window -- so use that screen realestate.

=-=--=-=-=-=-=
>> Could you cue me in on the best practices around here?
In this case, there is is really no problem -- my solution was first and it was correct and Pacman's comment came after and was not a major contribution.  You only need to worry about dividing up points when two or more experts contribute significantly to the answer.

Another general EE tip:  It is correct to award an A.  If you feel that a comment does not answer the question, you should post follow up comments asking for clarification.  If you don't get a satisfactory answer, it is better to delete the question than to award a "C" just to close the books.

-- Dan
> my solution was first and it was correct and Pacman's
comment came after and was not a major contribution.

DanRollins,

I guess marcus' problem was that he didn't know that the rectangle describes the whole control (including the drop down window). I couldn't read this in your comment so I decided to write it.

regards
Pacman
Hi Pacman,
On rereading my comment, I see that it could easily be construed as a criticism of your comment.  I am sorry.  No insult was intended.

-- Dan
no problem.

Pacman