SimpleGraph Bug

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

SimpleGraph Bug

Postby P_G » August 3rd, 2005, 9:48 am

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
P_G
Senior Member
Senior Member
 
Posts: 51
Joined: June 14th, 2004, 11:13 am
Location: Germany

Postby Kambiz » August 3rd, 2005, 10:18 am

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: Select all
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: Select all
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: Select all
        if Backgnd = 1 then
          Background.LoadFromFile(OpenPictureDialog.FileName)
        else if Backgnd = 2 then
          Background.Graphic := nil;

Code: Select all
        if NodeShape.ItemIndex >= 0 then
          ConvertTo(TSimpleGraph.NodeClasses(NodeShape.ItemIndex));

That's all!
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm

Postby P_G » August 3rd, 2005, 10:39 am

That was really fast. Thanks a lot, Kambiz.

P_G
P_G
Senior Member
Senior Member
 
Posts: 51
Joined: June 14th, 2004, 11:13 am
Location: Germany

Postby kokkoras » October 21st, 2005, 10:47 pm

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
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby Kambiz » October 26th, 2005, 9:51 am

kokkoras,

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

Thanks
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm

Postby kokkoras » October 26th, 2005, 3:05 pm

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
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby kokkoras » October 26th, 2005, 3:09 pm

Investigated a bit more. It happens only with romboidals and verticaly positioned links. The direction of the link doesn't matter.
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby Kambiz » October 28th, 2005, 11:22 am

I checked it out. The problem doesn't occur in my version of SimpleGraph. So, you should review your own modified copy.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Products

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron