Protecdting a connection

A

Ashok

H

How to protect a connection made so that we can avoid the user to chage the connection from 1 point to other of the same shape

Regard
Ashok kumar
 
D

dani

Hi Ashok

If you work with event handling, you can catch the ConnectionDeleted
event and then later undo the user's action.

Another way is that you protect the connectors from selection. The
disadvantage of this approach is that the user also can't reroute the
connector.

Daniel
 
A

Ashok

Hi danie

I guess the same thing, but i want to protect the Begin point and End point of the Connector. So that user is allowed to select the connector but not allowed to change the course of connection

Could you please have a look of handling to protect the Begin and End Point of the connector. It will be a great help

Regard
Ashok Kumar
 
M

Markus Breugst

Hi Ashok,

have you tried the GUARD function?

Go into the ShapeSheet and surround the BeginX, BeginY, EndX, EndY formulas
with GUARD(.....), where ..... is the original formula. Perhaps this is what
you're looking for?

Best regards,
Markus

Ashok said:
Hi daniel

I guess the same thing, but i want to protect the Begin point and End
point of the Connector. So that user is allowed to select the connector but
not allowed to change the course of connection.
Could you please have a look of handling to protect the Begin and End
Point of the connector. It will be a great help.
 
D

dani

Hi Ashok

Do you want do know how event handling is done? If yes, check out the
Visio 2002 SDK, there are examples how to implement an event sink and
also how to use the AddAdvise method.

If you know how event handling is done, you can do the following things
to prevent users from removing connectors:

- register the event ConnectionsDeleted (visEvtDel+visEvtConnect) in
your document's eventlist.

- also register the event VisioIsIdle (visEvtApp+visEvtIdle)

- catch both events in your implementation of the VisEventProc method
and write the handlers for both events. These handlers should do the
following:

1. Handler for ConnectionsDeleted:
Set a flag that the previous operation has to be undone (you cannot
directly undo the ConnectionsDeleted-event when you catch it because the
undo operation is disabled when handling events)

2. Handler for VisioIsIdle
If the flag for undoing operations is set, perform a Application.Undo,
else do nothing

- This way, every time a connector is removed from a shape, it will
instantly be undone.

I hope this somehow helped.

Daniel
 
M

Mike Z

Hi There,

In my case, I usually lock the connector. Of course, it may be unlocked
later if to alternate the connection.

The follows are the snip of code in case it has some use for you.

Good luck!

Mike



//====================================================================

//

//====================================================================

void CSomeClass::DoLockConnector( CVisioShape& visShape, bool bLock )

{

CVisioCell visCellLock;

VBstr bstrLock = _T("1");

if ( !bLock )

{

bstrLock = _T("0");

}

VBstr vbszLockBeg = _T("LockBegin");

VBstr vbszLockEnd = _T("LockEnd");

visShape.Cells( vbszLockBeg, visCellLock );

visCellLock.putFormula( bstrLock );

visShape.Cells( vbszLockEnd, visCellLock );

visCellLock.putFormula( bstrLock );

}



Ashok said:
Hi daniel

I guess the same thing, but i want to protect the Begin point and End
point of the Connector. So that user is allowed to select the connector but
not allowed to change the course of connection.
Could you please have a look of handling to protect the Begin and End
Point of the connector. It will be a great help.
 
A

Ashok

Hi Mik

That was excatly the same thing i was expectiing. I want to avoid the provision to the user to do this action. So it will really help me in avoiding to handle the event

It worked. It is very simple too

Thanks a lot for your effort. I like to says my regards to Dany and Markus for sparing their time too

Regard
Ashok Kumar
 
M

Mike Z

You're quite welcome. It's my pleasure to be able to help a little.

Regards,

Mike

Ashok said:
Hi Mike

That was excatly the same thing i was expectiing. I want to avoid the
provision to the user to do this action. So it will really help me in
avoiding to handle the event.
 

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