I'm doing a program that ask a question when the node is inserted, it ask for the input of the name of the node, every node have to a name, and if the user dont put a name the Node have to delete, i do this:
- Code: Select all
procedure TfrmMainWnd.sgAreaObjectInsert(Graph: TSimpleGraph;
GraphObject: TGraphObject);
var
inputOK : Boolean;
strInput: String;
begin
inputOK := False;
if GraphObject is TTriangularNode then
begin
repeat
if InputQuery(Application.Title, 'Name of the Node:', strInput) then
begin
if strInput = '' then
ShowMessage('You have to put a name')
else
TTriangularNode(GraphObject).Text := strInput;
inputOK := True;
end;
end
else
begin
inputOK := True;
sgArea.BeginUpdate;
try
TTriangularNode(GraphObject).Free;
finally
sgArea.EndUpdate;
end;
end;
until inputOK;
end;
end;
Im using only Triangles for the Nodes, but the problem is that when the user push in CANCEL, the the sentence TTriangularNode(GraphObject).Free; stop the application.
someone can help me??? or what i'm doing wrong?