DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   Watched TopicsWatched Topics     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SimpleGraph Bug

 
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> DELPHI AREA's Products
View previous topic :: View next topic  
Author Message
P_G
Member


Joined: 14 Jun 2004
Posts: 44
Location: Germany

PostPosted: 03/08/05 09:48    Post subject: SimpleGraph Bug Reply with quote

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
View user's profile Send private message
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1044
Location: Tehran, Iran

PostPosted: 03/08/05 10:18    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
P_G
Member


Joined: 14 Jun 2004
Posts: 44
Location: Germany

PostPosted: 03/08/05 10:39    Post subject: Reply with quote

That was really fast. Thanks a lot, Kambiz.

P_G
Back to top
View user's profile Send private message
kokkoras
Senior Member


Joined: 12 Mar 2005
Posts: 250
Location: Thessaloniki, Greece

PostPosted: 21/10/05 22:47    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1044
Location: Tehran, Iran

PostPosted: 26/10/05 09:51    Post subject: Reply with quote

kokkoras,

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

Thanks

_________________
Kambiz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kokkoras
Senior Member


Joined: 12 Mar 2005
Posts: 250
Location: Thessaloniki, Greece

PostPosted: 26/10/05 15:05    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
kokkoras
Senior Member


Joined: 12 Mar 2005
Posts: 250
Location: Thessaloniki, Greece

PostPosted: 26/10/05 15:09    Post subject: Reply with quote

Investigated a bit more. It happens only with romboidals and verticaly positioned links. The direction of the link doesn't matter.
Back to top
View user's profile Send private message Visit poster's website
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1044
Location: Tehran, Iran

PostPosted: 28/10/05 11:22    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> DELPHI AREA's Products All times are GMT
Page 1 of 1

Add to favorites

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group