TadxRibbonButton Visible PropertyChanging

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

TadxRibbonButton Visible PropertyChanging
 
calou_33 calou_33


Guest


Hello,

I use a tadxribbonbutton with Outlook.Explorer.ContextMenuMailItem and there is code in the onclic event.
In propertychanging i do :
       btn:=(Sender as TadxRibbonMenu).Controls[0].AsRibbonButton;
       btn.visible:=FALSE;


The first time i right clic on a mail, the button is visible and the propertychanging is fired. The second time the button is not visible.

Thanks for help
Posted 20 Oct, 2017 03:58:38 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Hello,

Do you invoke that code in the Click or PropertyChanging event? Of that button or some other button?

In your other topic, I explained that the PropertyChanging event is designed to return a value of the requested property, not to set this (or any other) property of the Ribbon control. Setting a value to the btn.Visible property causes the corresponding instance of the TadxRibbonButton class to return that value whenever Office requests for that value (this is the simple schema described in section Updating Ribbon Controls at Run-Time of the manual). Moreover, btn.Visible := value invalidates that button and this should cause Office to raise PropertyChanging once more; this may result in a mess.


Andrei Smolin
Add-in Express Team Leader
Posted 20 Oct, 2017 04:34:02 Top
calou_33 calou_33


Guest


The code invoke on propertychanging. I understand what you mean for the event. Sorry to have forgotten it.
How can affect the property visible of the ribbonbutton in the value parameter of propertychanging?
if can't do this (transtypage incorrect)

btn:=(Sender as TadxRibbonMenu).Controls[0].AsRibbonButton; 
Value:=OleVariant(btn).Visible; 


Thanks
Posted 20 Oct, 2017 05:56:43 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
I suggest that, in the code of the PropertyChanging event handler, you do not modify any property of the Ribbon component for which the PropertyChanging event is invoked. You use the PropertyChanging event to dynamically supply Office with this or that value of the requested property depending on the context and business rules; to pass Office the resulting value that your code produces, set the value to the Value parameter of the event procedure.


Andrei Smolin
Add-in Express Team Leader
Posted 20 Oct, 2017 06:08:44 Top
calou_33 calou_33


Guest


I understand the meaning. I think i could be able to affect the value parameter when i will be able to cast the context in outlook.explorer

Regards
Posted 20 Oct, 2017 06:57:11 Top
calou_33 calou_33


Guest


You can close this post. It is solved now

Regards
Posted 20 Oct, 2017 09:44:20 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Thank you.


Andrei Smolin
Add-in Express Team Leader
Posted 20 Oct, 2017 10:11:51 Top