WBS Tree from the Visio 2003 SDK

G

garet

Hi All,
I am working to understand the WBS Tree that came with the Visio 2003
SDK. I guess the problem I am having is that there seems to be a lot
going on. So I figured I would try to follow what events are being
triggered, document open, document created, etc. I've been looking at
this for several days and still not getting it. Has anyone ever flow
charted what is happening in it? Are there any external documents
regarding the program? It encapsulates everything I need to do with my
program (which I have working in VBA). But I'm afraid I'm over my head
in the VB.NET.

Any help/pointers would be greatly appreciated!

Regards,
Garet
 
A

Al Edlund

I understand some of the initial confusion, it can be quite daunting.
Although once you spot the fact that they have two modules doing event
handling it makes a little more sense. The eventsink and taskdrawing modules
share the load between them. The other part was using the persistent event
tool from the sdk to discover what was stored in the visio template drawing.
HTH,
al
 
G

garet

Hi Al,
thanks for replying. What comes first? It looks like
handleDocumentCreatedEvent and HandleMarkerEvent are initializing the
addadviseEvents. Which by the looks of things is what initializes the
events. But what triggers the handle procedures? And after
initializing them, what procedure is the one that reacts to the events?

I'm trying to take lesson 2 from the managed code tutorial and put in
the eventsink but cannot figure out how to initialize it. I compiled
it and got no errors but nothing worked either. Then I tried to copy
the demoAddAdvise from the library. I'm getting the distinct
impression that these are all different approaches. So no errors but
no results.

Lesson 2 would be a good example except it only does document events.
I am looking for shape events (which I saw in the code library). Any
thoughts on which way I should run this time ;-)

thanks!!!!!!
garet
 
A

Al Edlund

it starts with the assumption that the addin is compiled and loaded. when
the template is opened by way of visio it fires the marker event which
allows the eventlist handler/addadvise to figure out whether it is a new or
previously created document. after the document is created (if necessary) /
opened it initializes the event handler for task drawing. Task drawing and
eventsink are configured so that they do not both try to handle the same
types of events (so there is no conflict).
al
 
G

garet

Hi Al,
I'm trying a different approach, I'm trying to use the code librarian
example. My logic is that it should be less code. Unfortunately it
doesn't seem to be working. I am getting office is not a member. Not
sure what is causing that. I basically copied the DemoAddAdvise and
the EventSink. Simpler is better. Unfortunately it is a no go. Any
ideas?

Thanks!
Garet
 
A

Al Edlund

"office is not a member" sounds like a .net error. If I received a message
like that I would
first start looking to ensure that the module has the proper Import
statements and that
the necessary resources are in the project.

al
 
G

garet

Hi Al,
After making another revision of the program I have discovered that
copying the code librarian code directly in was what was causing the
problem. Basically I used the VB.NET add-in wizard (SDK?). Created a
new class named eventsink and a module called DemoAddAdviseSample. I
pasted the DemoAddAdviseSample directly in, but on the eventsink class
I pasted in (Implements Microsoft.Office.Interop.Visio.IVisEventProc)
after the Public Class EventSink This resulted in the Function
VisEventProc appearing. I then copied all of the code from the
eventsink (librarian) into the new eventsink class. EXCEPT:
- Public Function VisEventProc( line (maintained what was created)
- Namespace lines

I then adjusted the code in the VisEventProc function to the parameters
in the function. (ie 'source' from the code librarian now needs to be
changed to 'pSourceObj')

It seemed to work. I am still experimenting with it to see if I can
trace it to make sure I understand what is going on. I think the
OnConnection (connect.vb) registers the events you want to monitor.
And the EventSink.vb reacts to the 'registered' events. I'm not sure
what the rest of the code is doing. Is it all for supporting the
events? Does the program continue through any other sub/functions
besides those called by the events? Is there a means to 'step' through
the program to see what is happening?

Thank you again for all of your help!

Regards,
Garet
 
A

Al Edlund

the sdk has an event viewer that can give some insight, as a caution though
a lot of events happen under the cover of visio.
al
 
G

garet

thanks Al for everything. I'm sure I'll be a frequent poster. Wish
there was more documentation/books on writing code for Visio. The
other office stuff seems to be coming together with VSTO, I'm hoping
that Visio will get there.

Thanks again!
Garet
 

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