Link to home
Start Free TrialLog in
Avatar of rickatseasoft
rickatseasoft

asked on

Using ComboBox on FlexGrid - Cant set the ComboBox Size correctly

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
Avatar of AlexFM
AlexFM

Try to add CBS_NOINTEGRALHEIGHT style.
Avatar of rickatseasoft

ASKER

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
Did you try this or not?
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
SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Maybe this is WM_GETMINMAXINFO handler?