Race condition when opening new tab/window?

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

Race condition when opening new tab/window?
 
David Sickmiller


Guest


Hi,

I have an onDocumentComplete handler that displays an advanced bar based on the page content. This works reliably when the user clicks fr om page to page within the current tab. However, if the current page opens a new tab or window, the onDocumentComplete handler does not reliably display my advanced bar on that initial page loaded in the new tab/window. Generally it doesn't show the bar. If I add some MessageBox.Show() calls for debugging, it sometimes does show the bar, suggesting there may some sort of race condition.

There are probably a number of events wh ere the sequence is important, including:

  • Registration of the onDocumentComplete handler
  • Calling of the onDocumentComplete handler
  • Instantiation and population of adxieAdvancedBarsManager1.Bars


Can you advise how to most reliably call my function so it always has a chance to analyze the page content and display my advanced bar?

Thanks,
David
Posted 20 Sep, 2011 11:52:05 Top
Sergey Grischenko


Add-in Express team


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

Please try to show the bar in the OnSendMessage event handler. You just need to send a message from the OnDocumentComplete handler using the SendMessage method and process it in the OnSendMessage handler.
Posted 21 Sep, 2011 07:11:54 Top