[SOLVED]Collapsed group dynamic size |
Post Reply |
Author | |
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
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. |
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
|
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.
|
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
|
Looks like it isn't just a popup issue. Here is the same group where the group isn't collapsed. |
|
agontarenko
Admin Group Joined: 25 March 2016 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |