'Synchronise' Form Region State to Ribbon's control

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

'Synchronise' Form Region State to Ribbon's control
Reflecting Form Region State changes to controls on an Inspectors Ribbon 
James Irish




Posts: 6
Joined: 2010-06-17
Hi Guys,

Adx.Net 2010 Standard - Outlook 2007 - Visual Studio 2010

I've working on something very similar to the content of your video demonstration here http://www.add-in-express.com/creating-addins-blog/2011/04/08/outlook-right-subpane-inspector-region-video-howto/

In the demonstration you use three buttons to change the state of the region, my requirement is to use two TOGGLE buttons. i.e.

'Show Status Form' (toggles state between Normal and Hidden)
'Minimise Status Form' (toggles state between Normal and Minimised)

I have been able to hook these toggle buttons up including the disabling of the second button when the form is hidden.

My problem is that the user may click the minimise icon or the close button on the form header itself, thus changing it's state. I am having trouble getting these changes at the form level reflected back to the items on my ribbon control. This is further complicated by the fact that the form is instanced to each inspector window, and therefore 'each ribbon' needs to have it's button state reflected differently.

In traditional VSTO Ribbon XML I could handle the getPressed callback, get the Inspector from Context and the form region for that Inspector, query the forms state and returns true or false to set the toggle state.

How do I achieve the same effect using Add-in Express?

Many Thanks,

James
Posted 30 Aug, 2012 04:39:14 Top
Eugene Astafiev


Guest


Hi James,

You can handle the Activated and Deactivate events of the AddinExpress.OL.ADXOlForm class for getting the RegionState property and to be notified about any changes in the ADXOlForm UI (when it is closed or minimized).

Please be aware that the Ribbon UI is a static thing from its birth. The only possible dynamism is to handle the OnPropertyChanging event of your Ribbon controls. You can read more about this in the http://www.add-in-express.com/docs/net-ribbon-components.php#properties-events section from the online documentation. Please check out the following similar forum threads:

http://www.add-in-express.com/forum/read.php?FID=5&TID=10245
http://www.add-in-express.com/forum/read.php?FID=5&TID=10489
http://www.add-in-express.com/forum/read.php?FID=5&TID=7595
http://www.add-in-express.com/forum/read.php?FID=5&TID=5499

Also you may be interested in the http://www.add-in-express.com/creating-addins-blog/2010/06/25/outlook-regions-forms-size-state/ article on our technical blog.
Posted 30 Aug, 2012 12:13:47 Top
James Irish




Posts: 6
Joined: 2010-06-17
Eugene,
PropertyChanging was just the thing I was looking for! Problem solved.
Many Thanks,
James
Posted 31 Aug, 2012 03:39:30 Top
Eugene Astafiev


Guest


You are always welcome, James! :-)
Posted 31 Aug, 2012 03:53:02 Top