Solved

Using ComboBox on FlexGrid - Cant set the ComboBox Size correctly

Posted on 2006-11-24
8
355 Views
Last Modified: 2013-11-20
I am using a FlexGrid Control, and want to use, depending on the current cell, either a CComboBox or a CEdit.

I have no trouble at all, sizing the CEdit, simply convert TWIPS to Pixels, and, call Create.

With the ComboBox, I am unable to make the height the correct value.  The cells are 15 Pixels tall, and no matter what I do, the CComboBox insists on being 24 pixels tall.

I've set the Font to a smaller font, tried SetItemHeight(), tried MoveWindow(), etc.  Nothing works.

Any Ideas, Rick
0
Comment
Question by:rickatseasoft
  • 4
  • 3
8 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 18007600
Try to add CBS_NOINTEGRALHEIGHT style.
0
 

Author Comment

by:rickatseasoft
ID: 18011355
Alex:

I turns our that a the ComboBox height is determined automatically by the font.  As I mentioned above, I had changed the font, but didn't know that I had to, after changing the font, do an UpdateWindow() in order for the effect to take place.

The upshot is that in order to get the ComboBox down to 15 Pixels, the font has to be set to about 58 points which is really difficult to read.  I wonder about deriving a class, and handling the sizing myself.  If you have any ideas, I am interested.  If not, I will just either deal with the spill over, or make the cells taller.

Thanks, Rick
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 18011727
Did you try this or not?
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:rickatseasoft
ID: 18011977
Alex:

Sorry, I thought it was clear that I did try your suggestion, and it didn't work.  If you are able to make this work, please post some code.

After considerable sleuthing around the internet, and my C++ books, it would seem that the only way alter the height of the ComboBox is to change the font.

Regards, Rick
0
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 250 total points
ID: 18012064
Just wanted to know, this style helps in other situations. But it looks like here this doesn't help.
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 250 total points
ID: 18014499
Could you change the font. Resize. UpdateWindow. (or whatever it is you did do). Then reset the font to the one you want.  Maybe the combo will be tricked and keep the new, smaller, height.
0
 

Author Comment

by:rickatseasoft
ID: 18016520
Andy:

That is a great thought---I know because I already had it.  All kidding aside, thanks for trying.

Interestingly enough, when I changed the font to a smaller font, the ComboBox required an UpdateWindow() to get smaller, but when I changed the font to smaller, did an UpdateWindow(), then changed the font back to large, without an UpdateWindow(), it was large again.  It makes no sense, and I might tackle it sometime this week, but I just ran out of time---other issues are demanding attention right now.

My other thought was to override the WM_MOVE or WM_SIZE handler, and see where that took me.  Unfortunately, when I traced the code using the debugger, it went deep into windows---where the debugger wouldn't take me---without me seeing any mention of any code modify the desired size based on the Font.  In other words, as deep as the debugger would take me a height of 15 remained 15.  Somewhere in windows, beyond my reach, there is some method, function, or something that says, "15 is too small, let's make it 24!"

Of course, maybe I am approaching this in the wrong way.

Thaks for trying, Rick
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 18059461
Maybe this is WM_GETMINMAXINFO handler?
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

815 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

10 Experts available now in Live!

Get 1:1 Help Now