CommandBar events are removed

J

Jonathan

Hello,

I've a small problem with the commandbar of my add-in in C# (VS2003) :
my events are removed when I create a document.

I've tried with the SDK example, and I've the same problem. So, it
seems to be a Vision problem.

Someone can help me?
 
J

JuneTheSecond

Custom toolbar,( or command bar) belongs to the document where the macro is,
not to the Visio application. So, when new drawing is opened or created, it
will
dissapear.
 
J

Jonathan

In this case, why can I create my command bar outside any document ?
And why does the command bar exist from one document to another one ?

In my case, only the events dissapear.
 
J

Jonathan

I add the events in the DocumentOpened events.
Now, the click events are working, but not the Change events of the
CommandBarComboBox
 
S

Senaj Lelic [DE MVP Visio]

It seems there is a problem in the .NET layer for commandbars - because i
have several controls and they quite often "forget" their code and stay
functionless.
So this is it seems a problem of the .NET support for commandbars
 
M

Mark Nelson [MS]

I have encountered a similar issue with event handlers being ignored or
forgotten. The issue relates to the event handler going out of scope. When
a handler goes out of scope it stops working. However, in .NET the handler
continues to work after it has gone out of scope because garbage collection
has not yet occurred. Eventually garbage collection occurs and the event
handler stops working.

This is difficult to diagnose because the event handler seems to work for a
while. In the Visio 2007 SDK we have changed the sample code for
CommandBars to ensure the event handlers do not go out of scope. You may
want to compare your code with the 2007 SDK to see if this might address the
problem you are seeing.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top