Dynamically changing caption und imageMso for Ribbon objects...

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

Dynamically changing caption und imageMso for Ribbon objects...
 
Heinz-Josef Bomanns




Posts: 206
Joined: 2008-02-28
Hi,

ADX 2010 Final, VS 2008, Outlook 2007, 2010: I have an ADXRibbonTab with a group, some menues and some buttons. For some of the buttons i have to dynamically change captions and imageMso depending on several criterias. How do i declare the neccessary call backs to be able to set individual captions and imageMso? Thanks...
__________________
Greetings, HJB
Posted 28 Jun, 2010 00:56:33 Top
Andrei Smolin


Add-in Express team


Posts: 16992
Joined: 2006-05-11
Hi HJB,

You can chabge the caption in two ways demonstrated by the two event handlers below:

private bool isPressed = false;
private void adxRibbonCheckBox1_OnClick(object sender, AddinExpress.MSO.IRibbonControl control, bool pressed)
{
    isPressed = pressed;
    adxRibbonButton1.Caption = "isPressed = " + isPressed.ToString();
}

private void adxRibbonButton1_PropertyChanging(object sender, AddinExpress.MSO.ADXRibbonPropertyChangingEventArgs e)
{
    if (e.PropertyType == AddinExpress.MSO.ADXRibbonControlPropertyType.Caption)
    {
        e.Value = "isPressed = " + isPressed.ToString();
    }
}


The second way allows you to have different captions in different inspectors; you'll need to cast e.Context to Outlook.Inspector and display this or that caption depending on properties of the inspector or its underlying item.

As to changing imageMso on the fly, it isn't possible: the Ribbon doesn't allow this.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 28 Jun, 2010 05:22:42 Top
Heinz-Josef Bomanns




Posts: 206
Joined: 2008-02-28
Hi Andrei,

thanks, changing captions works fine now...

>As to changing imageMso on the fly, it isn't possible: the Ribbon doesn't allow this.

Sorry for beeing a smart-ass :) I used 'getImage="GetImage"' and 'MyRibbon.InvalidateControl "SomeControlID"' in my old VB6 add ins to dynamically change imageMso, works fine. For PropertyChange/PropertyType there's 'ADXRibbonControlPropertyType.ItemImageMso' defined, seems to be for menu items but changing imageMso for menues and buttons this way should work also. Maybe the developers can have a look at this, would be great to have it...
__________________
Greetings, HJB
Posted 28 Jun, 2010 22:03:27 Top
Andrei Smolin


Add-in Express team


Posts: 16992
Joined: 2006-05-11
Hi HJB,

:)

Thank you very much. We will look into this.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Jun, 2010 02:09:45 Top