Print Page | Close Window

Grouping Controls on a Ribbon

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=10509
Printed Date: 01 March 2025 at 6:33am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Grouping Controls on a Ribbon
Posted By: Danlar
Subject: Grouping Controls on a Ribbon
Date Posted: 05 May 2008 at 3:58pm
Hello,

I recently discovered the SetControlsGrouping function on CXTPRibbonGroup. For any unfamiliar readers, this function provides two alternative ways to "group" various controls within a single CXTPRibbonGroup. Here is an example from the RibbonSample of two different groups: The one and on the left has ControlsGrouping set to False, and the one on the right has it set to True.



I noticed a ribbon group in Microsoft Excel 2007 that appears to be combining both of these styles within a single CXTPRibbonGroup. Is it possible with CodeJock to make a ribbon group appear like this one from excel? Note that the right half of this Ribbon Group is denoted with a separator, whereas the left half uses ControlsGrouping. I couldn't find a way to use separators when ControlsGrouping is True.



Here is a mock-up of what we would most like our ribbon group to look like; is this possible? Notice how the far left control appears to be "ungrouped," and we have a separator in there, yet some controls are still "grouped" together (below the left combobox and in the top-right corner).



Thanks,
Dan Fike



Replies:
Posted By: cpehonk
Date Posted: 06 May 2008 at 12:56am
Hi Dan,
 
did you already try to use "BeginGroup( TRUE)" on the first added control of the "sub-group" ? Didn't try this myself but it might work for you.
 
It works perfectly for inserting separators so far ...
 
Greetings,
Chris


Posted By: Danlar
Date Posted: 06 May 2008 at 10:44am
Consider the following group:



This group was constructed with the following code:

CXTPRibbonTab* tab = pRibbonBar->AddTab(_T("TestTab"));

CXTPRibbonGroup* group = tab->AddGroup(_T("TestGroup"));

group->Add(xtpControlButton, ID_EDIT_PASTE)->SetBeginGroup(TRUE);
     
group->Add(xtpControlButton, ID_EDIT_PASTE)->SetBeginGroup(TRUE);
group->Add(xtpControlButton, ID_EDIT_PASTE);
     
group->Add(xtpControlButton, ID_EDIT_PASTE)->SetBeginGroup(TRUE);
     
group->Add(xtpControlButton, ID_EDIT_PASTE)->SetBeginGroup(TRUE);
group->Add(xtpControlButton, ID_EDIT_PASTE);
     
group->Add(xtpControlButton, ID_EDIT_PASTE)->SetBeginGroup(TRUE);
group->Add(xtpControlButton, ID_EDIT_PASTE);

group->SetControlsGrouping(FALSE);


Now, if I change that very last line of code to read as group->SetControlsGrouping(TRUE), the group will look like this instead:



The CXTPControl::SetBeginGroup function has different results if you change the argument to CXTPRibbonGroup::SetControlsGrouping. You don't get separators anymore. I'm trying to find a way to blend both results in a single group, the way Microsoft Excel 2007 appears to be doing it in the screenshot of my previous post.

Furthermore, I added calls to CXTPControl::SetStyle to the last two controls in the above code, using xtpButtonIconAndCaption and xtpButtonIconAndCaptionBelow as arguments, and this was the result.



That seems a bit odd.

It doesn't seem that CodeJock is capable of making a ribbon group that looks like the Excel image or the desired mock-up in my original post. I'm just looking to confirm this before I move on.

-Dan


Posted By: cpehonk
Date Posted: 06 May 2008 at 12:51pm
Understood and agreed ...
 
Maybe this is a job for Oleg again ...
 
Greetings,
Chris



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net