ADXIE Commands (checkable menu item) has different state on different IE tab

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

ADXIE Commands (checkable menu item) has different state on different IE tab
 
czetsuya




Posts: 44
Joined: 2011-05-01
Hi,

I've created a plugin which has a dropdown (toolbar menu item) with 2 values (active and inactive), let's call this variable flag. When active is selected it becomes disabled otherwise inactive. The current value is stored on a file using ADXIESharedMemory as documented from: http://www.add-in-express.com/creating-addins-blog/2009/06/19/internet-explorer-plugin-settings-synchronize/. It works well on a single IE tab instance, when I close IE and reopen it, the last value saved is queried.

Then for example the current tab flag value is false, then create a new tab it's flag value is false, but when I try to change the flag value on the second tab it did not reflect on the first tab.

What could be wrong? When the value is change on one tab why is the toolbar menu item from other tab not update?

Thanks,
czetsuya
Posted 17 May, 2011 22:39:42 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
Hi Czetsuya,

When you open a new tab, IE creates a new separate instance of your toolbar.
You need to synchronize your settings between tabs/instances using the SendMessage method of the toolbar. Then you can process your messages in the OnSendMessage event handler.
Posted 18 May, 2011 05:24:57 Top
czetsuya




Posts: 44
Joined: 2011-05-01
Hi Sergey,

Just to verify, is this feature available in IE7? I'm getting NullReferenceException on RefreshOptions when I tried to follow the code that I've downloaded on IE7 (ADXIESharedMemory code).

Thanks,
czetsuya
Posted 18 May, 2011 06:00:07 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
Yes, it should work in IE7.

Do you get the error in the code of the 'Synchronize settings' example or your own implementation?
Posted 18 May, 2011 06:15:18 Top
czetsuya




Posts: 44
Joined: 2011-05-01
Hi Sergey,

On my own implementation using the code from: ADX_IE_Shared_Memory_CS (Synchronized Setting Project).

The difference is that the example used a IEBarToolbar, while I use IEToolbar. In IEToolbar there is no IEBarModule_Load event, I tried: OnTabActivated, DownloadBegin, but didn't work.

**Seems it's working with: OnTabActivated

Thanks,
czetsuya
Posted 18 May, 2011 06:59:12 Top
czetsuya




Posts: 44
Joined: 2011-05-01
Hi Sergey,

After several tries, confirmed the example project Synchronizing Settings throw a NullReferenceException, the same as the one from my implementation.

See errors:

System.NullReferenceException: Object reference not set to an instance of an object.
at ADX_IE_Shared_Memory_CS.GlobalData.SaveOptions()
at ADX_IE_Shared_Memory_CS.GlobalData.UpdateOptions(IEBarModule module)
at ADX_IE_Shared_Memory_CS.IEBarModule.buttonApply_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

*To replicate the error run IE7, open the IEToolbarModule, open another tab. An error would be thrown.

*Note, I never changed anything from the downloaded project.

Thanks,
czetsuya
Posted 18 May, 2011 07:43:21 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
Czetsuya, IEToolbar provides the Load event. Just open the Events tab in the VS Properties window. Double click on the Load event and VS will generate the IEToolbar_Load event handler.
Posted 18 May, 2011 07:47:00 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
To replicate the error run IE7, open the IEToolbarModule, open another tab. An error would be thrown

I had already fixed this issue in the past. Have you downloaded the example today?
Posted 18 May, 2011 07:49:24 Top
czetsuya




Posts: 44
Joined: 2011-05-01
Hi Sergey,

Not today, but certainly not last month.

Will try to download the latest one.

Basically, what changes have you done?

Is this the updated code?
http://www.add-in-express.com/files/howtos/blog/adx-ie-shared-memory-cs.zip

Using the latest code I've verified that the error still persists on IE7, how to replicate:
1.) Open IE7
2.) Open another tab (even about:blank page would do)
3.) Close the first tab
4.) Open another tab and a NullReferenceException would be thrown.

*Note: this error is only on IE7.

Thanks,
czetsuya
Posted 18 May, 2011 07:58:04 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
I can't test it in IE7 at the moment. I will reply you tomorrow.
Posted 18 May, 2011 08:19:00 Top