Deleting Collapsing Record Node

Hi Im using GoDiagram version 4.1
Im using CollapsingRecord Node and when I delete the node sometimes this Green border remains and there is no way to get rid of it unless I reopen this dialog.

Thanks,
Ekta

This is the selection highlight, I assume…

Are you doing GoDocument.SuspendsUpdates = true anywhere?

The node was highlighted and when deleted the selection still remained.
I’m not using GoDocument.SuspendsUpdates = true

Does this happen when the user hits the Delete key?

Have you overridden GoView.DeleteSelection or the Selection class itself?

I have wired a button click event to delete the selected node.

Im not overriding DeleteSelection or the selection class.

Can you post your button event code?

private void DeleteStateClicked()
{
if (wfs.View.Selection.Primary is CollapsingStateNode)
{
CollapsingStateNode sNode = wfs.View.Selection.Primary as CollapsingStateNode;
DataRow[] rows = get all the transitions that start from this node
//select all the links
<span =“Apple-tab-span” style=“white-space:pre”> SelectTransitionAndItemLists(0, rows);
rows = get all the rows that end on this node //select all the links
SelectTransitionAndItemLists(0, rows);
}
wfs.StopTransitionSelEvent = wfs.StopParentStateSelEvent = true;
wfs.View.EditDelete();
wfs.StopTransitionSelEvent = wfs.StopParentStateSelEvent = false;
}

Am I doing anything wrong??
The green borders don’t always appear, but its frequent.
Any help would be appreciated!

I’m not sure why you are going to all the trouble to select the links (at least that’s what it looks like you are doing) before calling EditDelete(). EditDelete should delete any links attached to a deleted node.

> wfs.StopTransitionSelEvent = wfs.StopParentStateSelEvent = true;

What side effects does this have? If you remove this line, does the green box problem go away?

True, EditDelete deletes any links attached to the deleted node but does not delete the RecordNodeItem in the other node (the node which is connect by the link from the deleted node).
That’s why i select all the RecordNodeItems from other nodes that are connected by the deleted node.

> wfs.StopTransitionSelEvent = wfs.StopParentStateSelEvent = true;

This line basically help me avoid circular selection. I have the same data in grid format.


But just to try it out, I did comment out that line but I still was able to reproduce the issue were the green selection remained.

Well, I got no theories at this point.

view.EditDelete calls GoView.DeleteSelection(selection).
one of the first things DeleteSelection does is selection.RemoveAllSelectionHandles

If you can send me a sample that duplicates this, I’ll look at that. I don’t suspect something simple will reproduce it though, since I don’t remember ever seeing a problem like this before.

Hi Jake,

Sent you a sample code that reproduces the issue.

Thanks,
Ekta

ok… in OnGotSelection for your Transition class, you do Sel.Add(obj) in a couple of places.

This is the problem… The API Reference for GoObject.OnGotSelection says

“Any implementation of this method should not change which objects are selected.”

and… if you comment out those too sel.Add(obj) lines, the problem goes away.

What is the best way to select those objects when the transition is selected?

I was seeing that code called during the handling of the Delete key, not during selection.