| View previous topic :: View next topic |
| Author |
Message |
P_G Member
Joined: 14 Jun 2004 Posts: 44 Location: Germany
|
Posted: 03/08/05 09:48 Post subject: SimpleGraph Bug |
|
|
Hello out there,
There's a bug in SimpleGraph. It is easy to reproduce in SGDemo:
1. Insert a node
2. Now open the properties window of this node
3. Change the node's shape (Elliptic for example)
4. Click 'Clear Background' (It's unimportant wether the node contains a background image or not)
5. Now click 'Apply changes' and you'll get an exception
Best regards, P_G
|
|
| Back to top |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1044 Location: Tehran, Iran
|
Posted: 03/08/05 10:18 Post subject: |
|
|
Thanks P_G for reporting this problem.
Well, that's not a SimpleGraph bug. The bug is in the "Demo Program/NodeProp Unit/TNodeProperties.ApplyChanges Procedure".
To fix the bug, the following procedure:
| Code: | procedure TNodeProperties.ApplyChanges;
var
I: Integer;
begin
S.BeginUpdate;
try
for I := 0 to N.Count - 1 do
with TGraphNode(N[I]) do
begin
case rgAlignment.ItemIndex of
0: Alignment := taLeftJustify;
1: Alignment := taCenter;
2: Alignment := taRightJustify;
end;
Margin := UpDownMargin.Position;
Text := NodeText.Lines.Text;
Brush.Color := BodyColor.Color;
Pen.Color := NodeBorderColor.Color;
Font := FontDialog.Font;
if NodeShape.ItemIndex >= 0 then
ConvertTo(TSimpleGraph.NodeClasses(NodeShape.ItemIndex));
if Backgnd = 1 then
Background.LoadFromFile(OpenPictureDialog.FileName)
else if Backgnd = 2 then
Background.Graphic := nil;
end;
finally
S.EndUpdate;
Backgnd := 0;
end;
end; |
should be replaced with this one:
| Code: | procedure TNodeProperties.ApplyChanges;
var
I: Integer;
begin
S.BeginUpdate;
try
for I := 0 to N.Count - 1 do
with TGraphNode(N[I]) do
begin
case rgAlignment.ItemIndex of
0: Alignment := taLeftJustify;
1: Alignment := taCenter;
2: Alignment := taRightJustify;
end;
Margin := UpDownMargin.Position;
Text := NodeText.Lines.Text;
Brush.Color := BodyColor.Color;
Pen.Color := NodeBorderColor.Color;
Font := FontDialog.Font;
if Backgnd = 1 then
Background.LoadFromFile(OpenPictureDialog.FileName)
else if Backgnd = 2 then
Background.Graphic := nil;
if NodeShape.ItemIndex >= 0 then
ConvertTo(TSimpleGraph.NodeClasses(NodeShape.ItemIndex));
end;
finally
S.EndUpdate;
Backgnd := 0;
end;
end; |
As you can see, only position of the folowing parts are toggled:
| Code: | if Backgnd = 1 then
Background.LoadFromFile(OpenPictureDialog.FileName)
else if Backgnd = 2 then
Background.Graphic := nil; |
| Code: | if NodeShape.ItemIndex >= 0 then
ConvertTo(TSimpleGraph.NodeClasses(NodeShape.ItemIndex)); |
That's all!
_________________ Kambiz |
|
| Back to top |
|
 |
P_G Member
Joined: 14 Jun 2004 Posts: 44 Location: Germany
|
Posted: 03/08/05 10:39 Post subject: |
|
|
That was really fast. Thanks a lot, Kambiz.
P_G
|
|
| Back to top |
|
 |
kokkoras Senior Member

Joined: 12 Mar 2005 Posts: 250 Location: Thessaloniki, Greece
|
Posted: 21/10/05 22:47 Post subject: |
|
|
Talking about the demo, I just discovered another issue. I had 3 rhomboidals, with 2 of them linked to the third one. I noticed that when the links are absolutely vertical they get into the area of the nodes. This is not happening though with, say, rectangles.
Can anyone else reproduce that?
fotis
|
|
| Back to top |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1044 Location: Tehran, Iran
|
Posted: 26/10/05 09:51 Post subject: |
|
|
kokkoras,
Could you please attach a sample graph file here, to investigate the issue?
Thanks
_________________ Kambiz |
|
| Back to top |
|
 |
kokkoras Senior Member

Joined: 12 Mar 2005 Posts: 250 Location: Thessaloniki, Greece
|
Posted: 26/10/05 15:05 Post subject: |
|
|
| Kambiz wrote: | kokkoras,
Could you please attach a sample graph file here, to investigate the issue?
Thanks |
I have a gif capture attached, together with the sgp source file. If you can not reproduce it, then it must be an issue with some changes I made. I draw arrows at the very end, because I plan to introduce nested graphs (I want visible nested arrows, in front of other nodes).
Sorry, but I can not recall whether the demo was compiled with your version or mine. The most strange is that it doesn;t happen with rectangles.
fotis
|
|
| Back to top |
|
 |
kokkoras Senior Member

Joined: 12 Mar 2005 Posts: 250 Location: Thessaloniki, Greece
|
Posted: 26/10/05 15:09 Post subject: |
|
|
| Investigated a bit more. It happens only with romboidals and verticaly positioned links. The direction of the link doesn't matter.
|
|
| Back to top |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1044 Location: Tehran, Iran
|
Posted: 28/10/05 11:22 Post subject: |
|
|
I checked it out. The problem doesn't occur in my version of SimpleGraph. So, you should review your own modified copy.
_________________ Kambiz |
|
| Back to top |
|
 |
|