Catch "BeforeShapeConnection" operation?

A

andrewLLL

Hi all,

Is there a way to check whether or not a connection between two shapes is
good or bad before they are actually connected? Visio does a nice thing by
showing a Red box and a tool tip saying "Glue to connection point", but these
two things are hard to catch by programming. Anybody knows how?

I want to overwrite the above message "Glue to connection point" and if
possible, show somthing else instead of red box indicating a connection is
about to be made.

Thanks

Andrew
 
J

JuneTheSecond

It seems to me that a red box and a tool tip is isued after connection is
completed.
My recommendation is to use ConnectionsAdded events in "ThisDocument", like;
Private WithEvents pge As Visio.Page
Private Sub Document_DocumentSaved(ByVal doc As IVDocument)
Set pge = ActivePage
End Sub
Private Sub pge_ConnectionsAdded(ByVal Connects As IVConnects)
MsgBox "pge_ConnectionsAdded to " & Connects.ToSheet.Name
End Sub
Private Sub pge_ConnectionsDeleted(ByVal Connects As IVConnects)
MsgBox "pge_ConnectionsDeleted from " & Connects.ToSheet.Name
End Sub
 
C

Chris Roth [ Visio MVP ]

As far as I know, it's very difficult to do things to Visio *while* you are
dragging. It's kind of in-between states during drag, and I don't think the
automation model is really set up for this. Although this seems to be
improving, as the Mouse Move events were added to 2003.

I'm sure you can't change the "Glue to connection point" tooltip, unless you
are using the Visio control and somehow manage to draw some custom graphics
over the control yourself.

As for events, I think you only have connections added/deleted, which is a
bit late in your case.

There's a small chance I've missed something, so cross your fingers that one
of the smart guys sees this message too ; )

--

Hope this helps,

Chris Roth
Visio MVP
 
A

andrewLLL

Thanks Chris. I am using Visio 2003 drawing control in my application. Yes I
can easily add a tool tip box to show my own message (don't need to touch the
Glueto tool tip), but without an "BeforeShapeConnection" or
"QueryCancelConnection" etc., I don't know when to pop up my own tool tip.

Andrew
 
A

andrewLLL

Thanks. But when you see the red box and tool tip, the "ConnectionAdded"
event has not been triggered until you release the mouse. I want to be able
to disconnect (when seeing the information on the tool tip) by dragging away
without releasing the mouse and triggering "ConnectionAdded" event.

Andrew
 
J

JuneTheSecond

Thanks. But when you see the red box and tool tip, the "ConnectionAdded"
event has not been triggered until you release the mouse. I want to be able
to disconnect (when seeing the information on the tool tip) by dragging away
without releasing the mouse and triggering "ConnectionAdded" event.

Thanks, now, I see that you are right.
 

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