Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - [SOLVED]Collapsed group dynamic size
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[SOLVED]Collapsed group dynamic size

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED]Collapsed group dynamic size
    Posted: 19 February 2024 at 2:18pm
I have been chasing an issue with a collapsed group display being wrong when I click on the group and the popup displays. This is rare for us and I finally found the difference for groups that display fine and those where the display is wrong. It turns out the issue shows up when we have the XCTPRibbonGroup::m_bControlsGrouping flag set.

In order for this problem to show up, large buttons using the style iconAndCaptionBelow are in the group.

I found this method: CXTPRibbonGroup::_CalcSpecialDynamicSize

and this code in the method:

    int nOffset         = (nResultHeight + XTP_DPI_Y(1) - nBaseHeight * nRowCount) / (nRowCount + 1);
    int nTotalOffset = nOffset;

Following that is a loop where nTotalOffset is incremented by an offset based on a control wrap flag. In my case, there is no wrap flag set. I don't think that matters. The problem I have is that nOffset determined by that line where it is declared becomes a rather large value. The the CONTROLINFO rcControl member is offset, the display result is everything is shifted down. Either the buttons are outside the popup rectangle, or the buttons overlap the group caption text centered at the bottom of the popup.

If I change to:

int nOffset = 0;

The display is fine. If I monitor the CXTPControl::SetRect, on groups that don't controls grouping set, when I click those collapsed groups, the top row of buttons in the popup all have a value of 4 for "top". In my case, DPI adjusted to 200%, that value is being set to 43.

If I change the button style to icon, the popup window is still very tall and the buttons are centered in the window. Again, initializing nOffset to zero fixes that issue too.

Is this a bug in CodeJock? Or is there something else I should be looking at? Image where m_bCnotrolsGroups is true:

Image where m_bControlGrouping is false. Same ribbon just a different group:

We set grouping on the "Configurations" group because we have a combo box in it and that solved some layout issues in the group.

When I add all the controls to the group I see this:


If I stop and set the offset to zero I see this:


If I turn off m_bControlsGrouping I get a good look:


So, I have not yet figured it all out. When that combo box is in the group, the popup height isn't correct and I haven't found out yet why.

Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 19 February 2024 at 2:31pm
Gee I hope my images show up! There were there when I posted. I just did a paste from the clipboard and they showed up in the window just fine.

Guess I'll add a few here.

Group with a combobox and no grouping:

Group with combo box with grouping. Note the second control (Save Display Configuration) has bWrap set to true. Setting nTotalOffset to zero doesn't fix the issue in this case and all the controls that follow it only display a slight bit at the very bottom. This is the popup being the wrong size issue (my guess) I mentioned.

And finally, a group without a combo box that uses grouping:

Again, using icon and caption below with grouping is part of the issue.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 19 February 2024 at 2:58pm
Looks like it isn't just a popup issue. Here is the same group where the group isn't collapsed.


Back to Top
agontarenko View Drop Down
Admin Group
Admin Group


Joined: 25 March 2016
Status: Offline
Points: 260
Post Options Post Options   Thanks (0) Thanks(0)   Quote agontarenko Quote  Post ReplyReply Direct Link To This Post Posted: 27 February 2024 at 8:36am
Hello,

I reproduced your problem.

In our samples SetControlsGrouping method used with buttons which has XTPButtonStyle::xtpButtonAutomatic style.

When I used XTPButtonStyle::xtpButtonAutomatic option for each button, then all buttons was big in group.
When I called SetControlsGrouping method then all buttons streel small in group.

I found CXTPRibbonGroup::_CalcSpecialDynamicSize calculate 3 rows of controls.
This made me think that this was done intentionally.

Also I checked our forum and support tickest with 'SetControlsGrouping' text and forund next message
"Yes, unfortunatelly for SetControlsGrouping only small icons used."

So I concluded that when SetControlsGrouping method used, all controls should be small, and if you can to use SetControlsGrouping  with big controls you need to override function virtual int OnCalcDynamicSize(CDC* pDC);.

You can to see next
https://forum.codejock.com/large-and-small-icons-in-the-same-ribbon-group_topic4530.html
https://forum.codejock.com/composite-control-embeded-commandbar_topic7570.html
 
Regards,
Artem Gontarenko


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.