Solved

Size of the listbox of combo box (Windows)?

Posted on 2009-03-31
7
850 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
best opensource encryption 9 63
Windows Update Could Not Search for New Updates (C8000266) 11 313
Migrate SQL 2005 DB to SQL 2016 4 28
RDP exploit 13 18
Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
Determining the an SCCM package name from the Package ID
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

734 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