Event Propagation

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

Event Propagation
 
Etienne Richards




Posts: 11
Joined: 2012-05-30
I have the following:
Toolbar Module
Menu Strip with multiple menu items (A, A.1, A.2, A.3, B, B.1)

Problem:
When clicking on A, the menu will open to display A.1 and A.2. When dragging the browser to another location the displayed menu does not close and it also does not move with the browser (or minimizing the browser and the menu display will remain).

I have looked and played with most events and have not been able to find an elegant solution.

Any suggestions?
Posted 07 Sep, 2013 13:32:40 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Etienne,

I will reproduce the issue and will try to find a solution for you as soon as possible.
Posted 09 Sep, 2013 11:03:12 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Etienne,

Sorry for the delay. To close the menu you can use the OnUpdateUI event.
Here is a simple solution:

private void IEToolbarModule_OnUpdateUI(object sender, EventArgs e)
        {
            foreach (ToolStripMenuItem item in menuStrip1.Items)
                item.HideDropDown();
        }


To enable the OnUpdateUI event you need to set the 'HandleDocumentUICommands' property of the toolbar module to true.
Posted 11 Sep, 2013 10:02:51 Top
Etienne Richards




Posts: 11
Joined: 2012-05-30
Thanks for looking into this. I have looked at this but it does not look like a viable approach.

Pages like http://t.msn.com/ where images are swapped in and out of the browser document causes the event to fire in the ToolbarModule. This is independent of where focus is. The result would be that a menu gets close because the document was updated.

Also, dragging the browser window does not result in this event being fired. This will result in the menu being left behind.

For what is worth, I am looking at this on Windows 8 x64 IE10.

I hope that you can think of an alternate solution.

Thanks
Posted 12 Sep, 2013 19:14:25 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Etienne,

At the moment I don't have any other solution. The MenuStrip control works bad in IE. I will continue working on this issue and will let you know about results soon.
Posted 16 Sep, 2013 10:41:55 Top
Etienne Richards




Posts: 11
Joined: 2012-05-30
Sergey,

I have been working on a solution that seems like it has some potential. I must be honest, it feels like I am using a sledgehammer where a screwdriver would be be a better tool.

It is rather involved. Here's the outline of what I am doing (some detail removed to simplify the outline):
1. I am setting up an Event Hook on the IEFrame fr om where I get:
a. Capture Start - This covers drag, re-size and some other cases
b. Object Re-ordered - This gives me tab changes
c. Location change - If I want to move an open child window with the move of the frame

2. I am setting up an Event Hook on the Frame Tab from wh ere I get:
a. Object destroyed - This allows me to know when the tab is associated with another IEFrame

3. I am using adxiehtmlDocEvents.OnActivate to:
a. Identify that the HTML Document is now active which should result in closing menu type windows that are open

You can probably see why it feels like I am using a sledgehammer.

Etienne
Posted 25 Sep, 2013 04:53:26 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Etienne,

Sorry for not being reported about my progress. But I didn't find any reliable solution. I noticed that ToolStrip control works a bit better than MenuStrip. At least you will be able to hide dropdowns in the OnUpdate event. Please try to use ToolStrip instead of MenuStrip.
Posted 26 Sep, 2013 08:57:52 Top