Solved

Size of the listbox of combo box (Windows)?

Posted on 2009-03-31
7
845 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 29

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
Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

 
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 29

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 29

Author Closing Comment

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

680 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