Using ComboBox on FlexGrid - Cant set the ComboBox Size correctly

Posted on 2006-11-24
Medium Priority
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
Question by:rickatseasoft
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
  • 4
  • 3
LVL 48

Expert Comment

ID: 18007600

Author Comment

ID: 18011355

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
LVL 48

Expert Comment

ID: 18011727
Did you try this or not?
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 18011977

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
LVL 48

Assisted Solution

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

Accepted Solution

AndyAinscow earned 750 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.

Author Comment

ID: 18016520

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
LVL 48

Expert Comment

ID: 18059461
Maybe this is WM_GETMINMAXINFO handler?

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
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