Occurs when a node is removed (extracted or deleted) from the graph.
Use the OnRemoveNode event when you want to do something every time a node is removed from the graph.
Namespace: GGraph
Delphi
|
public
property OnRemoveNode: TNodeNotifyEvent read FOnRemoveNode write FOnRemoveNode;
|
Value
Type: TNodeNotifyEvent
The following code keeps a list box synchronized with a graph. The listbox contains all the nodes in the graph:
Delphi
|
procedure TForm1.AddNode( Sender: TObject; ANode: TGGraphNode );
begin
ListBox1.Items.AddObject( ANode.Caption, ANode );
end;
procedure TForm1.RemoveNode( Sender: TObject; ANode: TGGraphNode );
begin
ListBox1.Items.Delete( ListBox1.Items.IndexOfObject( ANode ) );
end;
procedure TForm1.NodeCaptionChange( Sender: TObject; ANode: TGGraphNode; var NewCaption: String );
begin
ListBox1.Items[ ListBox1.Items.IndexOfObject( ANode ) ] := NewCaption;
end;
begin
// connect the events to the graph
Graph.OnAddNode := AddNode;
Graph.OnNodeCaptionChange := NodeCaptionChange;
Graph.OnRemoveNode := RemoveNode;
end;
|
|