Have same button with different size in a ribbon |
Post Reply |
Author | |
fleg
Groupie Joined: 11 July 2012 Status: Offline Points: 45 |
Post Options
Thanks(0)
Posted: 01 June 2017 at 11:22am |
Hi,
In a RibbonBar I'm doing the following. In 2 different tabs, I'm adding a button with the same ID, on the first tab, I want to have a large button (32x32) pCXTPRibbonGroup->Add(xtpControlButton, verifyID(ID_ACTION))->SetIconSize(CSize(32, 32)); and have a small button on the second tab (16x16). pCXTPRibbonGroup->Add(xtpControlButton, verifyID(ID_ACTION))->SetIconSize(CSize(16, 16)); Before creating button, I assign Icon to action ID calling XTPImageManager()::SetIcons(), once for 32x32 once for 16x16. Problem is both buttons appear big (32x32), so SetIconSize() seems to have no effect on my case. Workaround is to have 2 separated ID, like ID_ACTION_16, ID_ACTION_32 But It makes code more complicated and might cause some errors. any method better than CXTPControl::SetIconSize() could be used for that ? Thanks, |
|
olebed
Admin Group Joined: 01 July 2014 Location: Ukraine Status: Offline Points: 841 |
Post Options
Thanks(0)
|
Hello fleg,
You can get desirable behavior by using SetStyle() method. By default used xtpButtonAutomatic style. With xtpButtonAutomatic size of ribbon buttons depend on existing free space. And can be changed from big to small with resizing of window. With xtpButtonIconAndCaption and xtpButtonIcon the icon always will be small. Except you set some big size pControl->SetIconSize(CSize(32, 32)); Regards, Oleksandr Lebed |
|
fleg
Groupie Joined: 11 July 2012 Status: Offline Points: 45 |
Post Options
Thanks(0)
|
Hi Oleksandr,
This is working perfectly. Might be nice to have mention in documentation of GetSize() to indicate this strick about the button style. Many thanks for the help. Fabien |
|
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 |