Re: [WIN] "open" simple combo box programmatically
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Oct 20, 2000
- 602 views
Matt, I've run into a problem with using CB_SHOWDROPDOWN to "open" a SIMPLE combo box programmatically. When it's opened programmatically with CB_SHOWDROPDOWN, it's *not* always the right size to hold all elements of the list, but if I open it "manually", it is. I made the act of selecting an item in one simple combo box's list populate a second combo box, and then used CB_SHOWDROPDOWN immediately after that to make the second combo box's list open automatically. That makes the second list open, but it doesn't always open to the *size* necessary to show all the elements in the list (the number of elements in the list will vary, depending on what was selected in the first list); but if I *manually* click on the "edit" line portion of the second combo box, the list *always* expands to show all the elements in the list, no matter how few or many, and it's just the right size, not too big and not too small. But when the second combo box's list is expanded by CB_SHOWDROPDOWN, sometimes it fits the number of elements, and sometimes it's too big, and sometimes it's too small (seems to depend on what was shown just *before*, and by what *method*, auto dropdown, or manual. Is there some way to get the automatic dropdown from CB_SHOWDROPDOWN to function like the manual click on the "edit" line does, so the list automatically opens to the right size to show all elements of the list? BTW: I'm using a SIMPLE combo box on purpose, as opposed to a "regular" combo box, as it makes the "edit" line into a static text box instead of being editable, and I think maybe the *style* definitions for "simple" combo box in Win32Lib may be at least a part of what's going on, because "simple" CB has no scroll bar, and I think maybe CB_SHOWDROPDOWN may be showing the list in relation to the scroll bar that isn't there (in other words, it only shows *some* of the elements of the list, expecting that a scroll bar would be there to be used to show the rest of them). Any ideas?? Dan ----- Original Message ----- From: "Matthew Lewis" <MatthewL at KAPCOUSA.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Friday, October 20, 2000 8:22 AM Subject: Re: [WIN] "open" simple combo box programmatically > Dan B Moyer wrote: > > > Is it possible to "open" a simple combo box programmatically? > > Yes. Send the CB_SHOWDROPDOWN message: > > CB_SHOWDROPDOWN > > wParam = (WPARAM) (BOOL) fShow; // the show/hide flag > lParam = 0; // not used; must be zero > > -- Sample usage > > constant CB_SHOWDROPDOWN = 335 -- not defined in win32lib > junk = sendMessage( MyCombo, CB_SHOWDROPDOWN, True, 0 ) > > -- end sample > > Matt