CollapseFloating causing freeze problem

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

CollapseFloating causing freeze problem
 
Mark Williams




Posts: 21
Joined: 2020-06-08
I have a word taskpane which (essentially) hosts a listbox and a button. When an item in the listbox is selected then the button is enabled and made default so it can be pressed via the enter key. This inserts text into the document.

When the taskpane is opened in floating mode it partially covers the word document so when the user clicks the button to insert the text I want to hide the taskpane and return focus to the word document so that the user can see that the text has been inserted.

To do this I have added the following code:

MWCAddIn.HostApp.ActiveWindow.SetFocus;
  if Floating then
    CollapseFloating;


Works great when the taskpane is actually floating.

If the user clicks on the chevrons to pin the taskpane, every time they click the button the taskpane freezes. It's not possible to select any other item in the listbox unless you close the taskpane and reopen or switch to another taskpane and back.

I have discovered that floating is true even if the taskpane is pinned by clicking on the cheverons. I would have assumed floating applied only to taskpanes that are temporarily opened by clicking on their caption.

The problem lies with the call to CollapseFloating, presumably because it can't collapse a taskpane that is not floating. I have tried wrapping the command in try except but it doesn't help.

Is this a bug or intended?

How do I detect if a taskpane has been opened temporarily by clicking on the caption or actually pinned by clicking on the chevrons?

Many thanks.
Posted 08 Sep, 2020 09:32:06 Top
Alexander Solomenko


Add-in Express team


Posts: 137
Joined: 2009-02-27
Hi Mark,

Yes, indeed this happens because of calling CollapseFloating, and we will add a check to this method. In the meanwhile, please use the IsFloating property because Floating is not an Add-in Express property and we do not control it.
Regards,
Aleksandr Solomenko
Posted 09 Sep, 2020 03:06:41 Top
Mark Williams




Posts: 21
Joined: 2020-06-08
Thanks. That works.

Is there a way to detect when the user has clicked on the caption to drop down the taskpane?

I would like the taskpane to be focussed when this happens.
Posted 09 Sep, 2020 05:05:55 Top
Alexander Solomenko


Add-in Express team


Posts: 137
Joined: 2009-02-27
Is there a way to detect when the user has clicked on the caption to drop down the taskpane?

You can use the OnActivate event for this.
Regards,
Aleksandr Solomenko
Posted 09 Sep, 2020 05:32:25 Top