KungPhoo
KungPhoo

Reputation: 754

MFC, Ribbons - CMFCRibbonButton with image: Always show the text

I've got an CMFCRibbonButton that displays a text and an icon. When I compact the ribbon, in the end only the small icon is shown. Is there a way to tell the button not to get compacted into small icon state, but always show the text as well? I tried pButton->SetCompactMode(FALSE); without success.

Upvotes: 0

Views: 708

Answers (1)

thomiel
thomiel

Reputation: 2937

To be sure, CMFCRibbonButton::SetAlwaysLargeImage() is not what you are looking for? I ask, because when only an icon without text is displayed, it is usually the panel the button sits in that has collapsed. See CMFCRibbonPanel::IsCollapsed(). If you want to modify the behavior of the panel so that it won't collape, you could try to subclass CMFCRibbonPanel and play with overrides. The MFC Ribbon is not completely documented but my best bet is CMFCRibbonPanel::IsFixedSize():

class CMyPanel : public CMFCRibbonPanel
{
    ...
    BOOL IsFixedSize() const { return TRUE; }
    ...
}

If this doesn't work you have to see yourself what happens in NotifyControlCommand or OnUpdateCmdUI when the panel collapses and modify the behavior as needed.

Upvotes: 1

Related Questions