SimpleGraph Bug
Select messages from
# through # FAQ
[/[Print]\]

DELPHI AREA -> DELPHI AREA's Products

#1: SimpleGraph Bug Author: P_GLocation: Germany PostPosted: 03/08/05 09:48
    —
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

#2:  Author: KambizLocation: Tehran, Iran PostPosted: 03/08/05 10:18
    —
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!

#3:  Author: P_GLocation: Germany PostPosted: 03/08/05 10:39
    —
That was really fast. Thanks a lot, Kambiz.

P_G

#4:  Author: kokkorasLocation: Thessaloniki, Greece PostPosted: 21/10/05 22:47
    —
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

#5:  Author: KambizLocation: Tehran, Iran PostPosted: 26/10/05 09:51
    —
kokkoras,

Could you please attach a sample graph file here, to investigate the issue?

Thanks

#6:  Author: kokkorasLocation: Thessaloniki, Greece PostPosted: 26/10/05 15:05
    —
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

#7:  Author: kokkorasLocation: Thessaloniki, Greece PostPosted: 26/10/05 15:09
    —
Investigated a bit more. It happens only with romboidals and verticaly positioned links. The direction of the link doesn't matter.

#8:  Author: KambizLocation: Tehran, Iran PostPosted: 28/10/05 11:22
    —
I checked it out. The problem doesn't occur in my version of SimpleGraph. So, you should review your own modified copy.



DELPHI AREA -> DELPHI AREA's Products


output generated using printer-friendly topic mod. All times are GMT

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group