Profile Picture

Need a Selectable, but Undisconnectable Line

Posted By Jason Irby 8 Years Ago
Author
Message
Jason Irby
Question Posted 8 Years Ago
View Quick Profile
Forum Member

Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 59, Visits: 77
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
Posted 7 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
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