Setting ShowCaption for all controls in a TadxRibbonTab

Add-in Express™ Support Service
That's what is more important than anything else

Setting ShowCaption for all controls in a TadxRibbonTab
I would like my users to be able to toggle ShowCaption for all controls in a Ribbon Tab 
Roger Middlebrook


Guest


Is there a simple way to go through all the controls in a TadxRibbonTab to toggle ShowCaption wherever possible? I can't see it... Sorry
Posted 24 Jun, 2011 07:01:30 Top
Andrei Smolin


Add-in Express team


Posts: 18794
Joined: 2006-05-11
Hi Roger,

You can cast TadxRibbonTab to IadxRibbonControl, scan controls returned by IadxRibbonControl.GetControls, cast each control to IadxRibbonControl and call SetShowCaption.


Andrei Smolin
Add-in Express Team Leader
Posted 24 Jun, 2011 08:15:37 Top
Roger Middlebrook


Guest


Thanks Andrei

That sounds a lot easier than what I was doing, which was calling RTTI to see if the control had a ShowCaption property so I can set it, and recursing if RTTI told me the control had a Controls property.

My code does work but not on all the controls I want. Please consider the following:

myTab (TadxRibbonTab)
- File (TadxRibbonGroup)
- - Open (TadxRibbonButton) [msoID='FileOpen']
- - Save (TadxRibbonButton) [msoID='FileSave']
- Edit (TadxRibbonGroup) [msoID='GroupClipboard']

I want all the controls to hide their captions, including those in the Edit group (Cut, Copy, Paste and FormatPainter) which I have not added explicitly. Is this possible??
Posted 24 Jun, 2011 08:38:28 Top
Roger Middlebrook


Guest


Andrei, where is IadxRibbonControl defined please?
Posted 24 Jun, 2011 08:47:38 Top
Andrei Smolin


Add-in Express team


Posts: 18794
Joined: 2006-05-11
oops! IadxRibbonComponent, not IadxRibbonControls. It's in adxAddIn.pas.


Andrei Smolin
Add-in Express Team Leader
Posted 24 Jun, 2011 08:55:44 Top
Roger Middlebrook


Guest


Thanks Andrei

You may have missed some detail in my earlier post. If you are able to offer some guidance here I would be very grateful.


Please consider the following:

myTab (TadxRibbonTab)
- File (TadxRibbonGroup)
- - Open (TadxRibbonButton) [msoID='FileOpen']
- - Save (TadxRibbonButton) [msoID='FileSave']
- Edit (TadxRibbonGroup) [msoID='GroupClipboard']

I want all the controls to hide their captions, including those in the Edit group (Cut, Copy, Paste and FormatPainter) which I have not added explicitly. Is this possible??


Many thanks
Posted 24 Jun, 2011 09:13:04 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Roger,

Thank you for the details.

I want all the controls to hide their captions, including those in the Edit group (Cut, Copy, Paste and FormatPainter) which I have not added explicitly. Is this possible??


It is not possible because you did not add those controls explicitly and consequently there are no controls for which the ShowCaption property can be applied. Please try to add a custom group with these controls (like you did in your first group), then you will be able to manage each control's properties.
Posted 24 Jun, 2011 09:34:47 Top