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

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.

Related

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)

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

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.

MFC Menu Drop Down (Screenshot included)

I'm having difficulties with an MFC application menu drop down. I want the drop down to display all items when it is clicked. Instead it displays arrows which the user must click in order to show the drop down items.
See the pic below. Any help would be appreciated. Thanks!
I believe this is a feature of the MFC feature pack where the menu will hide rarely used items. You should be able to disable this feature using the CMFCMenuBar::SetShowAllCommands method.

Help finding issue with tooltip on CMFCMenuBar

I have an MFC app using the new UI features released in the Feature Pack and I'm having trouble with tooltips on the menubar.
By default, I beleive tooltips are not enabled on menu items. Yet whenever I hover over the 2nd item in any of the menu lists I get a tooltip with "Untitled" in the popup. The only time this does not occur is when the second item is a seperator. This only occurs on the 2nd item, not on any other item in the list. What's also odd is that a tooltip popup appears when hovering over the "Edit" top level menu item.
So to illustrate, top level menu:
File Edit View Help (Hovering over "Edit" displays the tooltip)
To Illustrate the File menu
File
New
Open
Save
Save As
(Hovering over "Open" displays the tooltip)
Again the same behavior occurs for the second item on each of the menu sections. None of the other mennu items display tooltips.
Any help on how I might be able to pin down this probelm is much appreciated.
Found the problem. Without going into the back story, I had to merge resource ID's from another project into the Resource.h file in this project. IDR_MAINFRAME was set to a value of 2 from a very old project. MFC apparently does not like 2 for this resource ID. I change it to 128 which seems to be the default value used by the new app wizard. All is well now.

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.