Profile Picture

Need a Selectable, but Undisconnectable Line

Posted By Jason Irby Last Year
Author
Message
Jason Irby
Question Posted Last Year
View Quick Profile
Forum Member

Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)

Group: Forum Members
Last Active: 7 Months Ago
Posts: 48, Visits: 23
We programatically create lines between shapes.
The user needs to be able to select the line because I show relationship information when they do.
However, we do not want to let the drag the connector off the connected shapes.  But I do need to move the shapes connected to around.

We have diabled the connector endpoints, but they can still grab the middle of the line and drag it off.

I have tried setting the protections to not allow change X or Y; And I have tried setting the moveable filter in the movetool.  In both these cases it almost works but it unselects the line on mouse up after I click on the line to select.  Strangely I can still select the line with a rectangle area drag select.

I also tried catching the eventsink_disconnecting event and canceling but there are places we programatically disconnect lines and I'd have to pause the eventsink or use booleans flags to control that behavior.  There are problems with both of those approaches.

Setting the protections or moveable filter would be the most desirable approach that I've tried if it would just not unselect after I click on the line (note the diagram designer sample app does the same thing.) Can I prevent that?

Is there any other easier option I haven't tried to prevent the user for disconnecting, but not interfere with programatic disconnecting?

Thanks in advance,
Jason












Nevron Support Team
Posted 11 Months Ago
View Quick Profile
Supreme Being

Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)

Group: Moderators
Last Active: Yesterday @ 8:33 AM
Posts: 2,593, Visits: 2,279
Hi Jason,

In order to disable the disconnection of a connector but leave it selectable, you should set its MoveX, MoveY and TrackersEdit protections:

NAbilities protection = connector.Protection;
protection.MoveX = true;
protection.MoveY = true;
protection.TrackersEdit = true;
connector.Protection = protection;


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic