?
Solved

Size of the listbox of combo box (Windows)?

Posted on 2009-03-31
7
Medium Priority
?
857 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 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
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 
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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

A small collection of useful tips and tricks for Windows 10 users that I decided to write as a result of recent questions that were asked and answered at Experts Exchange. Two short video tutorials included. Enjoy..
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).
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.
Suggested Courses

765 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