combo box drop down is not working even after I changed the height in designer - c++

I am trying to give a fix for a combo box drop down list, since its not listing down properly .Only one item is being shown in the list rest all you can see by using arrow keys. I increased the height in designer too, anyways that is not the issue, why because its listing down in some machines and the same version is not working on my machine. I used the DDX_Control to assign this control to a variable.
Do we need to consider any other things which can impact the drop down list??
environment : vs2008, windows 7
May be I didn’t explain the problem in the right manner. After some google search, I came to know that I should mention some more points here.
I embed this combobox in a dialog editor, there are already some comboboxes those are working fine.
They might be created with the earlier versions of VS. Even I tried to set the SetMinVisibleItems on this new combo, but always returns a failure.

The height of a dropped down combobox is indeed the height of the control in the dialog template. If you make your combobox tall enough in the designer, then it should show several lines when opened.
According to what you did, the correct behaviour is the other computers. The wrong behaviour is your computer.
No, there are no other things to consider when designing a combobox. Ues your debugger and try to find out why the height of your combobox was reduced on your computer.

That can happen if the No Integral Height combobox property is set to true, and the height of the listbox component of the combobox has been inadvertently set to that of the combobox component.
The dialog designer allows you to set both of these two heights. Click on the dropdown arrow icon and then the bottom node then adjusts the listbox component. Change that height to be what you want, and set No Integral Height to be false.
This doesn't explain why it works on other machines, but give it a try.

Related

How to set font in edit box part of a CMFCToolBarComboBoxButton?

I'm able to set the font used to draw the drop-down part of a CMFCToolBarComboBoxButton combo box which is embedded in a CMFCToolBar toolbar. However, I'm not able to set/change the font used for the edit field control which is part of the combo box. I.e., when the combo box is collapsed the currently selected item is always drawn with the standard/default font no matter what font is used for the entries when expanding the box.
I successfully change the font of the drop down box part by using a pointer to the underlying CComboBox object retrieved via CMFCToolBarComboBoxButton::GetComboBox() (and then via CComboBox::SetFont(...)). But when using the method CMFCToolBarComboBoxButton::GetEditCtrl() to obtain a pointer to the edit control part (in order to change its font, too) this method always returns a nulltpr. Does anybody know why or more importantly: What is the correct way to set the font used for the edit control part of the box?
I've searched the web now quite a lot but cannot find a solution to the problem. Thanks for any advice!
Additional note: I need to change the used font(s) at run time in my MFC application.
OK, I finally came to the conclusion that it's better to leave these fonts up to the OS settings anyway and not explicitly set them by the application code.
This is not a technically correct answer to the (my own) question, certainly, but may be a good advide for others chasing the same problem.

the combobox dropdown list is so small that an updown arrows appear beside it

I have comboboxes that was built on the OWL I moved them to MFC and I faced alittle problem, the dropdown list of the combobox is so short that it shows only one item and you can navigate to the other items by using udown arrows like in the picture
the image on the left shows the short and incorrect one, the one on the right shows the release version that is working well.
what can cause this problem? and hoe to fix it. think it is style issue
Open dialog template in Resource Editor. Select combobox by mouse. Click on the "Down Arrow" element in the right part of the combobox (in your case it may be left part, according to localization). Then resize the combo to required height - in this state it resizes dropdown list. Build application and test dropdown list height at runtime - it should be OK.
http://msdn.microsoft.com/en-us/library/vstudio/4cta1x1t.aspx
See also: CB_SETMINVISIBLE message - allows to resize dropdown list size programmatically. I have never use it in my programs, though, so this is just a hint.

C++ MFC CComboBox is empty

i've a little comboBox, and i want to fill it with 6 entries... .
i wrote this code:
CComboBox* dropdownList = ((CComboBox*)GetDlgItem(IDC_PROGRAMDROPDOWN));
dropdownList->Clear();
dropdownList->AddString(L"test");
dropdownList->AddString(L"test2");
dropdownList->InsertString(2,L"test3");
dropdownList->InsertString(3,L"test4");
dropdownList->InsertString(4,L"test5");
As you can see I tried AddString(), and InsertString(). both with no effect. I also tried it just with AddString() which should be the correct way at initializing it.
But, my combobox is empty. I already debugged it, and this lines are hit but with no effect.
Do you have any idea?
In the dialog editor, make sure you resize the ComboBox item so that its height is big enough to contain all of the items when the ComboBox is expanded. By default, it'll only be the height of the "edit control" bit of the ComboBox, which limits the expanded height.
So, in the dialog editor, click on the dropdown button bit of the Combo Box and you should see the drag handles change a bit. Drag out the new size to account for all the items in the dropdown list.
thanks for all your answers. But it was an ugly Failure by my IDE -.-. I just recreated the UI-Element and it worked...
I recreated it with the same properties (Copy & Paste)

Dropdown height bug in CComboBox (common controls 6.0)?

I've made a simple MFC application (Visual Studio 2008, dialog based) and added a CComboBox using the resource editor. I used the resource editor to specify the dropdown height. Then I added some code to add 100 texts to the combobox. If I run this simple application the dropdown height is ignored. If I disable the Microsoft.Windows.Common-Controls 6.0.0.0 style (disable the pragma that adds it to the manifest file) then everything works fine.
Has anyone noticed this behaviour (and knows a solution)? I've searched the web and msdn, but no luck so far.
The only solution I've found (thx to someone on the Microsoft MFC newsgroup) is to use the CBS_NOINTEGRALHEIGHT flag that states that the combobox must look to the exact size specified by the user rather then adjusting it automatically (the reason this is a patch is that the flag is normally intended to disable the feature where the dropheight is adjusted so that no partial items are rendered).
The difference is the "new" Common-Controls-6.0-style Combo-box, or the "original" old-style Combo-box (pre 6.0).
I guess Microsoft finally "fixed" the ComboBox control so it dynamically changes the height of the drop-down according to the number of items and the screen real-estate available, which is better than having a fixed height (IMHO).
Unfortunately I have no source for that, just wild guessing :)

MFC - How can I disable a list item?

I have a CListCtrl with checkboxes. I want to be able to disable one of the items so that the user cannot click the checkbox. Is this possible? If so, how?
Edit:
Found the specifics on how to hide a checkbox in another question
Need only some rows in a CListCtrl control to have check boxes
Shortly: Not easily possible.
You'll need to sub-class the CListCtrl and implement this behavior on your own or download for example the MFC Grid Control that allows you to do that.
As for the removing check-boxes idea, yes, that might be possible, MSDN:
Version 4.70. Enables check boxes for items in a list-view control. When
set to this style, the control creates
and sets a state image list with two
images using DrawFrameControl. State
image 1 is the unchecked box, and
state image 2 is the checked box.
Setting the state image to zero
removes the check box.