Print Page | Close Window

Have same button with different size in 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=23354
Printed Date: 04 May 2024 at 9:42pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Have same button with different size in a ribbon
Posted By: fleg
Subject: Have same button with different size in a ribbon
Date 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,




Replies:
Posted By: olebed
Date Posted: 01 June 2017 at 1:34pm
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


Posted By: fleg
Date Posted: 02 June 2017 at 2:44am
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



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