Dropdown height bug in CComboBox (common controls 6.0)? - c++

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 :)

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.

How to fix not working keybind in WebStorm IDE

I generally have a bunch of custom keybinds for WebStorm, but this one particularly does not work - Select opened file. I've bound it with different key combinations (see screenshots below), and also I've verified that it does not conflict with any MacOS keybinds (although even the ones that conflict actually do work).
Also when I hover the actual UI button, it shows different keybind for it (which also does not work).
So, essentially, I have to always click the UI button with the mouse. I'd like to be able to do so with the keybind. I'm not even sure how to troubleshoot this...
Does anyone else using WebStorm have this keybind working properly?
It's a known usability issue, IDEA-271054. The actual action you need assigning a shortcut to is Other | Select File in Project View:

How to modify captions of windows created by visual studio project wizard

I have craeted a Visual C++ project using studio 2010 wizard in which I have added things like FileView, ClassView, PropertiesWindow, OutputWindow etc, with the help of wizard. Now I am interested in changing the default captions/names of one of these items let's say FileView. The FileView has a resource string "IDS_FILE_VIEW" associated with it with value "File View" which is displayed as a caption of the FileView window. If I change the value of above mentioned string in the resources it does not change that caption and still shows "File View" as a caption. Could anyone suggest me that how can I customize captions and other features of such common windows created through studio wizards?
Thanks a lot.
You don't say, but I assume from the "IDS" that you are using the MFC libraries.
In MFC, the resource strings like IDS_FILE_VIEW are defined and used by the designer but it is quite possible to override them. Changing the IDS_FILE_VIEW resource's value will indeed change what is displayed when that resource is used, but you may have (inadvertently) prevented that resource being used where you expect.
I would check through your project files to see where this and related names appear and verify that there are no inconsistencies.
HtH
Ruth

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.

Modifying a ribbon control at runtime

I'm using the Windows Ribbon Framework in an unmanaged C++ application in Visual Studio.
Is it possible to add a button or other control at runtime? I can set up my ribbon using IUIFramework::LoadUI, but I can't modify it afterwards.
It is not possible to add or remove a button at runtime, but you may hide or show a Tab or Group at run time using Application Modes and you can set any button texts and images at runtime.
So you can declare and use multi-purpose buttons that will show only when a specific Application Mode is set and contain runtime defined texts and images.
You can switch modes at runtime depending on what is defined in the markup - see here for details:
After modes are defined in markup,
they can be easily enabled or disabled
in response to contextual events. As
mentioned previously, Ribbon
applications always start in the
default mode 0. After the application
has initialized and mode 0 is active,
the set of active modes can be changed
by calling the IUIFramework::SetModes
function.
There is a comment here to the effect that changes at runtime are quite limited - this is in regard to a third-party wrapper, note.
You can dynamically add items at
runtime only to the galleries
controls:
ComboBox, SplitButtonGallerty,
DropDownGallery and InRibbonGallery
If you know what you want to add from
advance you can use ContextualTabs and
ApplicationModes to change the
visibility of (predefined) tabs and
groups.
Unfortunately, you can add dynamically
groups at runtime.
Note this is a limitation in the
Windows Ribbon Framework and not in
the wrapper library.