Solved

Size of the listbox of combo box (Windows)?

Posted on 2009-03-31
7
829 Views
Last Modified: 2012-05-06
Hi,

I am polishing rather old GUI of the application. The window is resizable -- home made layout is programmed via MoveWindow() (created in the pre-window-layout-manager era). One of the used controls is a combo-box. The rectangle of the combo box is set to determine the desired size of the list box when the combo is dropped down. However, the rectangle goes out of the window. It overlaps also the tab rectangle and causes the frame around the tab display area to be erased even when the combo box is closed -- see the circled areas on the image and the missing tab border between the two circles.

The question is how it should be done correctly?

Thanks,
    Petr
2009-03-31-160105.png
0
Comment
Question by:pepr
  • 3
  • 2
  • 2
7 Comments
 
LVL 9

Accepted Solution

by:
JohnGaby earned 250 total points
ID: 24030040
You might try controlling the size of the drop down list box by using the CB_SETMINVISIBLE and CB_SETDROPPEDWIDTH messages, rather than the MoveWindow function.

http://msdn.microsoft.com/en-us/library/bb775915(VS.85).aspx
http://msdn.microsoft.com/en-us/library/bb775901(VS.85).aspx
0
 
LVL 39

Assisted Solution

by:itsmeandnobodyelse
itsmeandnobodyelse earned 250 total points
ID: 24030324
With GetComboBoxInfo you could get the handle of the listbox. Then you could call MoveWindow for that window also.

If you don't have to support different sizes or different screen resolutions, you also could add a combobox to the resource of the dialog form which is proper sized both in combobox and listbox part. Then, make it invisible. Later, with MoevWindow you wouldn't resize the existing combobox but only move from the hidden place to the final place and call ShowWindow(hwndCbx, SW_SHOW).
0
 
LVL 28

Author Comment

by:pepr
ID: 24037671
OK. The problem of the JohnGaby's recomendation is that CB_SETMINVISIBLE requires common controls version 6. This way it does not work in Win 2000. Is it true? (Not having Win2000 in hands.)

Is it possible to implement something like CB_SETMINVISIBLE caused behaviour "easily" also for Windows 2000? Or would you prefer to capture CBN_DROPDOWN, get the handle of the listbox part and move it?
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 9

Expert Comment

by:JohnGaby
ID: 24040285
Have you tried it under Win 2K and seen that it doesn't work?  I seem to recall that the common controls are updated when you install updated versions of IE, but perhaps I am mistaken.

You might be able to set the size yourself as itsmeandnobodyelse suggested, but you would probably have to do it in response to the CBN_DROPDOWN notification message.

http://msdn.microsoft.com/en-us/library/bb775810(VS.85).aspx
0
 
LVL 28

Author Comment

by:pepr
ID: 24040686
I did not try as I have no Win 2000 around. I will try it a bit later.
0
 
LVL 39

Assisted Solution

by:itsmeandnobodyelse
itsmeandnobodyelse earned 250 total points
ID: 24047064
>>>> Have you tried it under Win 2K and seen that it doesn't work?

It depends mostly on the compiler version and *not* on the Windows version whether new messages or notifications can be handled.

But you may have to set your windows version for developing to a newer version in order to get the features compiled.

I. e. in many windows headers you'll find sequences like

#if _WINNT_WIN32 >= 0x0500
...

If now the _WINNT_WIN32 isn't set properly (or isn't defined at all) you can't use these features or will have no success.

You easily can set these version macros to the needs of your developer machine (in the C++ preprocessor settings) and you will see that it mostly will work at Win2k as well especially if there are the newest service packs installed.
0
 
LVL 28

Author Closing Comment

by:pepr
ID: 31564835
Thanks to both! It helped.
0

Featured Post

The curse of the end user strikes again      

You’ve updated all your end user’s email signatures. Hooray! But guess what? They’re playing around with the HTML, adding stupid taglines and ruining the imagery. Find out how you can save your signatures from end users today.

Join & Write a Comment

Suggested Solutions

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now