.NET contextMenuStrip on ADXOlForm (Outlook form) not working

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

.NET contextMenuStrip on ADXOlForm (Outlook form) not working
 
keith baldwin




Posts: 9
Joined: 2010-03-19
I am porting code over to Add In Express

Visual Studio 2008, Outlook 2007, Add-in Express 2009

I have a ADXOlForm that is being presented as an Outlook Folder home page

ExplorerLayout = WebViewPane

The form and the grid on the form are working fine

On the form is a System.Windows.Forms.ContextMenuStrip

Operation is - for select folders I show my custom form in place of the default outlook explorer grid of items in the folder

When someone selects an item in the grid - I enable the context menu

private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
if (dataGridView1.CurrentRow != null)
{
contextMenuStrip1.Enabled = true;
// I have no idea how these menu items keep getting disabled
deleteToolStripMenuItem.Enabled = true;
openToolStripMenuItem.Enabled = true;
}
else
{
contextMenuStrip1.Enabled = false;
}
}

I can step through the call to this method and everything executes okay - but I do not see the context menu.

Any ideas?

Thanks!
Posted 07 Apr, 2010 14:00:07 Top
Andrei Smolin


Add-in Express team


Posts: 14140
Joined: 2006-05-11
Hi Keith,

A wild thought. Try also setting contextMenuStrip1.Visible = true.

If this doesn't help, I'd like that you send me a sample project reproducing that issue to the support e-mail address (see readme.txt). Please make sure your e-mail contains a link to this topic.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 08 Apr, 2010 03:18:17 Top
keith baldwin




Posts: 9
Joined: 2010-03-19
I am emailing you a zipped project

We created a new ADXOlForm that is the Folder Home Page. On this form we have a grid of items. The user can select any item in the grid and then right click to select Open or Delete on the ContextMenu for the selected item.

So again, you select an item in the grid, right click and the context menu should pop up

What I am seeing is - when I set the contextMenu.Visible to true - it shows the context menu in the upper left corner of the screen. The context menu does work - its just not positioned at the cursor. When you right click (as you normally do) the context menu disappears.

Thanks!
Posted 08 Apr, 2010 13:56:36 Top
Andrei Smolin


Add-in Express team


Posts: 14140
Joined: 2006-05-11
Thank you, Keith. I've got your project. I hope I'll be able to tell you something about it later today.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 09 Apr, 2010 01:43:44 Top
Andrei Smolin


Add-in Express team


Posts: 14140
Joined: 2006-05-11
Hi Keith,

I'm sorry, I cannot tell you why the context menu is shown in this way; I haven't used ContextMenuStrip controls. I suppose you need to specify it in the ContextMenuStrip property of the datagrid but if this doesn't work, you'll have to find the reason yourself. I'd suggest to debug this on a Windows Forms application first.

There're too many other problems in your add-in.

1. The add-in does not create a store at startup; comment out Resume Next in AddNewPST to find the reason.
2. The add-in doesn't show your form in the WebViewPane layout because the corresponding ADXOlFormsCollectionItem isn't set up as required.
3. The add-in doesn't show your form in the WebViewPane layout for the folder(s) of the newly created store by default. Please see You cannot add a URL to the Address box on the Home Page tab in Outlook 2007.
4. The add-in produces an exception when I close Outlook because you access Explorer in ADXOlForm1.RefreshFolder and that Explorer is closed by that time.
5. You don't use Marshal.ReleaseComObject in your code. Please see Why to release COM objects in Office add-ins?.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 09 Apr, 2010 12:23:37 Top
keith baldwin




Posts: 9
Joined: 2010-03-19
the code works fine with VSTO - but not with your software

Yes - I hacked a lot of the proprietary code out and it does not shut down properly. But the code works well enough to demonstrate that there is a problem with your software.

And now you are refusing to fix problems with your code?

This will NOT sound good out on the internet

If you don't like my project - then make your own simple project with a grid and a ContextMenu to duplicate the problem.

I'll tell you what. If you want I will create another example project - just to make you happy. And at the same time - I will be happy to publish my findings on the internet to let people know that your software does NOT work as you advertise -

What happened to

-->Support service - that's what is more important than anything else
Like all true programmers we are perfectionists and believe that everything we do must be the best on the globe. No compromises! :) We also strive to make our support service such. And we are happy that day after day we get thanks for our help rendered to the same developers like we are. Look through our forums, what our customers say and a personal notice from the head of our support service to see what our support service really is. <--
Posted 09 Apr, 2010 15:40:24 Top
keith baldwin




Posts: 9
Joined: 2010-03-19
I reverse engineered your DLL and code and figured out how to make the code work.
Posted 12 Apr, 2010 03:05:54 Top
Andrei Smolin


Add-in Express team


Posts: 14140
Joined: 2006-05-11
Keith,

keith baldwin writes:I can step through the call to this method and everything executes okay - but I do not see the context menu.


This is how I see your context menu after I changed the project:

User added an image

I've just sent you the project, please check your Inbox.

keith baldwin writes:
I reverse engineered your DLL


Please note that the EULA states:

Reverse Engineering, Decompilation, and Disassembly. You may not reverse engineer, decompile, or disassemble the SOFTWARE, and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.


Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 12 Apr, 2010 03:44:54 Top