Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Size of the listbox of combo box (Windows)?

Posted on 2009-03-31
7
Medium Priority
?
864 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 1000 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 1000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 1000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

810 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