Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Ribbon - some observations/suggestions
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Ribbon - some observations/suggestions

 Post Reply Post Reply
Author
Message
ijwelch View Drop Down
Senior Member
Senior Member


Joined: 20 June 2006
Status: Offline
Points: 262
Post Options Post Options   Thanks (0) Thanks(0)   Quote ijwelch Quote  Post ReplyReply Direct Link To This Post Topic: Ribbon - some observations/suggestions
    Posted: 20 June 2006 at 5:18am
Here's some observations/suggestions for the ribbonbar:

The QuickAccessControls item collection has a 1 based index, as opposed to the rest of the controls which are zero based.

As a control can appear >1 times on the ribbonbar object, it's a bit of a pain having to loop through RibbonTabs, followed by RibbonGroups, followed by Items, in order to (for example) set the enabled property for a particular control id. Perhaps we can have a method to retrieve a collection of CommandBarControls that share the same id? Or in this case, a RibbonBar.EnableControlsByID (ID) method?

It'd be nice to have a Visible property on the QuickAccessControls object.

It'd also be nice to be able to hide tabs (eg if there's only one). By this I don't mean hide the entire tab, but just the bit you click on at the top.

Version 10.2 includes the system icon. The only way to get it visible is to use the EnableFrameTheme method. mmm. I want the icon/quick access bar to look like that but I don't want my form skinned.
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 20 June 2006 at 11:01am
Originally posted by ijwelch ijwelch wrote:

As a control can appear >1 times on the ribbonbar object, it's a bit of a pain having to loop through RibbonTabs, followed by RibbonGroups, followed by Items, in order to (for example) set the enabled property for a particular control id. Perhaps we can have a method to retrieve a collection of CommandBarControls that share the same id? Or in this case, a RibbonBar.EnableControlsByID (ID) method?
 
What's wrong with ON_UPDATE_COMMAND_UI ?
 
Codejock support
Back to Top
ijwelch View Drop Down
Senior Member
Senior Member


Joined: 20 June 2006
Status: Offline
Points: 262
Post Options Post Options   Thanks (0) Thanks(0)   Quote ijwelch Quote  Post ReplyReply Direct Link To This Post Posted: 21 June 2006 at 2:17am
Not a lot. Although it can lead to a waste of resources, more variables, etc. I like to run code to enable/disable controls when needed, not every 10ms or so.

The enabled property was just an example. Another common task would be to set the checked property. Right now, to do that, I've got to loop through every tab, every group, and every control.

A ControlsByID collection seems a pretty obvious requirement anyway considering the hierarchy of the control, and is probably implemented internally anyway.

Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 21 June 2006 at 9:20am
Originally posted by ijwelch ijwelch wrote:

Not a lot. Although it can lead to a waste of resources, more variables, etc. I like to run code to enable/disable controls when needed, not every 10ms or so.
 
MFC updates the UI only when it's in idle state, so nothing to worry about.


Originally posted by ijwelch ijwelch wrote:

The enabled property was just an example. Another common task would be to set the checked property. Right now, to do that, I've got to loop through every tab, every group, and every control.
 
Call CCmdUi::SetCheck in the ON_UPDATE_COMMAND_UI handler.
 
 
P.S.: You can also use FindControl to find a control by id anywhere on the Ribbon. If you have a lot of duplicated commands on the Ribbon you might need to rethink your UI Wink
Codejock support
Back to Top
ijwelch View Drop Down
Senior Member
Senior Member


Joined: 20 June 2006
Status: Offline
Points: 262
Post Options Post Options   Thanks (0) Thanks(0)   Quote ijwelch Quote  Post ReplyReply Direct Link To This Post Posted: 21 June 2006 at 3:14pm
"MFC updates the UI only when it's in idle state, so nothing to worry about."

Ok.

"P.S.: You can also use FindControl to find a control by id anywhere on the Ribbon. If you have a lot of duplicated commands on the Ribbon you might need to rethink your UI."

If the end user can customize the toolbar then it's necessary to be able to find all instances of a tool.

Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 21 June 2006 at 3:34pm
Originally posted by ijwelch ijwelch wrote:

If the end user can customize the toolbar then it's necessary to be able to find all instances of a tool.
 
Again, you should update your UI state using ON_UPDATE_COMMAND_UI handlers. That will automatically update all controls with the same id.
 
You can even update a command range (ON_UPDATE_COMMAND_UI_RANGE) with a single handler.
 
You should not call Enable/SetCheck methods of the controls because then you are tying your code to the XTP classes without the need of doing this.
 
It shouldn't matter if a command is a menu item or or button on the Ribbon, the control takes care how to display its current state.
 
 
Codejock support
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.156 seconds.