Changing tooltip text for CToolBar programmatically - mfc

I'm maintaining an MFC application with a toolbar. Now I need to programmatically change the text in the tooltips that are shown when you hoover over the toolbar buttons:
MFC takes this text (here "About") from the from the string table in the resources where the string ID has the same number as the command ID, (here ID_APP_ABOUT).
But I just need to change these texts programmatically (e.g "My About" instead of "About").

Related

Win32: How to access Windows Listview Header Control Filters

According to MSDN documentation you can add Filter bar to ListView :
By specifying the HDS_FILTERBAR window style for a header control, you can enable the placement of filter edit boxes underneath the column headings. A filter button appears beside the edit box.
I can access filter strings via HDITEM and HDTEXTFILTER but how to change underlying Edits and Buttons ?
Let's assume i would like to change default filter text placeholder from "Enter text here" to "Type here" like it's possible with Edit_SetCueBannerText or change filter button look ?
Assumption : Windows Vista + , Common Control 6.0 +
If you don't mind some hacks - you can get to child windows using for example EnumChildWindows() - then you may be able to send commands, etc. using the hwnd. Use "spy++" on your running program first to investigate the structure of parent/child window relations.

How to create a listbox type child control which hold both text item and text with checkbox item using microsoft MFC

How to create a control in mfc which takes both checkbox and text in one column.
You are looking for CMFCPropertyGridControl.
I'd also risk a look at the CMFCTasksPane control.

Prevent menu text from ellipsizing

I have a fairly straightforward menu that I am showing in an Activity, but some of the menu items have text that is too long to fit on screen. The default behavior for menus appears to be ellipsizing the text, as shown below.
Menu XML that I'm inflating in onCreateOptionsMenu():
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#+id/menu_too_long"
android:title="This text is a tad too long"
android:icon="#drawable/ic_glass_logo"/>
</menu>
Is it possible to get the menu item text to adjust its size or wrap to a second line when it is too long? In other words, I would like menus inflated from XML to behave more like CardBuilder.Layout TEXT.
I would like to avoid creating my own menu and continue using Glass's built-in menu APIs.
Changing the formatting of the menu labels is not possible through public APIs. From a UX point of view, menu labels longer than two or three words seems undesirable. Consider that if you enable voice menus in your application, those commands should be brief that the user can speak them conveniently.
If the length of your menu text is because there is supplemental information that you can separate from the "action" that the menu performs, consider using MenuUtils.setDescription to move the supplemental information into the footer of the menu item, which can hold more content. You can call this method from within onCreateOptionsMenu or onPrepareOptionsMenu.

Crash/Assertion after calling ForceRecalcLayout

I have added Ribbon to an existing MFC application.
The ribbon is created using the Editor.
In one of the panel I have a Custom CMFCRibbonGallery (derived from) whose contents (icon) I change dynamically. (It is much like the Styles Gallery in Excel.
After every time I change the contents I call ForceRecalcLayout which most of the time results in an Assert usually on m_pHighlighted or m_pPressed. Please see the attached snaphot1.jpeg, this Assert happened while I was moving the mouse over the Ribbon Gallery elements (Expanded mode popup) while ForceRecalcLayout was called.
On a different use case if I add the Sub Item (like we have "New Cell Style" in Styles Gallery of Excel) to the QAT using the context menu and then try to create a New cell style I get an Assert on the CMFCRibbonButton. Refer snapshot2.jpg
When just the icon changes it is sufficient to invalidate the ribbon.
Only if the size of the individual items are changed you Need to call RecalcLayout.
I see no reason to call ForceRecalsLayout.

Remove items form an MFC Ribbon

OK, here's the scenario: we have a file which determines which options will be present in an mfc ribbon depending on previously chosen criterias. So, if I have a button which opens a group of other buttons, do I have do delete the items from this group before deleting the main button? It looks like MainOption->sub1, sub2...