[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


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?
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


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 45

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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 will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

650 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