Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - How to force the Ribbon to update its controls
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to force the Ribbon to update its controls

 Post Reply Post Reply
Author
Message
SvenC View Drop Down
Groupie
Groupie


Joined: 02 February 2007
Status: Offline
Points: 79
Post Options Post Options   Thanks (0) Thanks(0)   Quote SvenC Quote  Post ReplyReply Direct Link To This Post Topic: How to force the Ribbon to update its controls
    Posted: 18 April 2011 at 10:10am
I use a SplitButtonPopup in a Ribbon and want to make the last clicked menu item the default for clicking the button itself.
 
To achieve that I reset the ID, Caption, Prompt and IconID of that control after it was clicked.
As the caption text of the different menu entries have different length, the button text get clipped when a longer text replaces a shorter text. Resizing the main window where the Ribbon lives in does redraw the button with its correct size.
 
I tried InvalidateRect(NULL, TRUE) on the mainframe and the ribbon but that did not redraw the window.
Only SetWindowPos with +1 width and SetWindowPos with the old width did update the buttons size.
 
Is there another method to force redrawing ribbon controls?
 
Resizing the main window just does not feel right...
 
Thanks,
Sven
--
SvenC

Toolkit Pro 15.3.1, 16.2.4, 16.3.1, 16.4.0, 17.2.0, 17.3.0, 18.0.1, 18.2 with VC++ 2010, 2012, 2013, 2015, 2017
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2011 at 10:02pm
Hi, have you tried:

GetCommandBars()->RedrawCommandBars();
Back to Top
SvenC View Drop Down
Groupie
Groupie


Joined: 02 February 2007
Status: Offline
Points: 79
Post Options Post Options   Thanks (0) Thanks(0)   Quote SvenC Quote  Post ReplyReply Direct Link To This Post Posted: 19 April 2011 at 1:32am
Thanks mark,
 
no I didn't find that method.
 
And yes, it does redraw the popup control Smile
 
Thank you,
Sven
--
SvenC

Toolkit Pro 15.3.1, 16.2.4, 16.3.1, 16.4.0, 17.2.0, 17.3.0, 18.0.1, 18.2 with VC++ 2010, 2012, 2013, 2015, 2017
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.