Solved

Using ComboBox on FlexGrid - Cant set the ComboBox Size correctly

Posted on 2006-11-24
8
353 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
 

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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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 (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

20 Experts available now in Live!

Get 1:1 Help Now