TSimpleGraph Issues (and wish list)

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

Postby kokkoras » August 25th, 2006, 8:33 am

Possible BUG
I have a SG and create a few nodes in it. The default Font of SG is used in the nodes. If I change the Font property of SG then the Font property on nodes changes as well becuase their font points to SG's font. This shouldn't be happen. Graph objects should have their individual font which initialy is a COPY of the default font of SG.

Kambiz, could you please verify this?
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby Kambiz » August 25th, 2006, 4:10 pm

I think this issue was discussed in another thread. As the result, in the next release the ParentFont property does not exist.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby kokkoras » August 25th, 2006, 9:09 pm

Kambiz wrote:I think this issue was discussed in another thread. As the result, in the next release the ParentFont property does not exist.


I suggest to leave it, as it provides an initial font. In my app I use the following procedure to add a node:
Code: Select all
  myNode:= mySG.InsertNode(myRect, TRectangularNode);
  myNode.Text:= 'Hello World';
  myFont:= TFont.Create;
  myFont.Name:= mySG.Font.Name;
  myFont.Size:=  mySG.Font.Size;
  // ....  goes like this for some more mySG.Font preperties
  myNode.Font:= myFont;
  myFont.Free;


That is, I create a new TFont instance, formating it according to SG.Font and point the font of the node to this font. Destroying the temporary font creates no problem (at least it seems so (?)) for the myNode.Font.

After that, changing the font of TSimpleGraph does not affect the nodes.
What do you think? Is it possible to use something similar in the library when you create a GraphObject? Besides, I happens when we change the font of an object using a FontDialog. After such a change the object's font is no longer connected to the font of SG. So why not doing it during object creation?
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby Kambiz » August 25th, 2006, 10:03 pm

For sure the initial font would be the control's font.

By the way, you do not need to write this amount of code, just set ParentFont property to False. In the other hand, to assign a font to another font object, use Assign method.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby kokkoras » August 25th, 2006, 10:33 pm

Kambiz wrote:For sure the initial font would be the control's font.

Of which control? The one that hosts TSimpleGraph?
Kambiz wrote:In the other hand, to assign a font to another font object, use Assign method.
Thanks for the tip :oops:
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby kokkoras » August 25th, 2006, 11:35 pm

Contrary to what expected and to what Delphi help says, Assign does not do what it is supposed to. Trying this:
Code: Select all
  myFont:= TFont.Create;
    myFont.Assign(mySG.Font);
    myNode.Font:= myFont;
  myFont.Free;

and later changing the SG.Font resulted in the same behaviour (node font changes as well). What's wrong?

edit: if I also set node's property ParentFont to false, then it works as desired. I couldn't figure out though what exactly does this ParentFont property do.
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby Kambiz » August 26th, 2006, 8:48 am

There is a mistake in your code. Here is the correction:

Code: Select all
myFont:= TFont.Create;
myFont.Assign(mySG.Font);
myNode.Font.Assign(myFont);
myFont.Free);


In the other hand, you do not need to create a temoporary font object. The following line does the same:

Code: Select all
myNode.Font.Assign(mySG.Font);


Although, even you do not need to do this assignment because this is already done in the constructor of the object.

By setting ParentFont to False, the object saves it's font information, and also changes in SG font doesn't change the object's font.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby kokkoras » August 31st, 2006, 10:32 pm

Well, NOW I can say that SG.Font is very useful if combined with GraphObject.parentFont:=false. My format toolbar is set according to SG.Font when nothing is selected, SG.Font holds the font params for the new objects, while the toolbar displays proper font info when objects are selected and of caurse, allows the modification of font params for the selected.

14. I would like to have an OnSelectionChange event that will fire at the end of an action that modifies the list of selected objects. I am asking for this because the OnObjectSelect event of TSG fires as many times as are the selected objects. I can't figure out though how this could be implemented since objects are selected (deselected) incrementaly. I am thinking of an internal mode starting with the modification start and ending when modification end at which point the requested event fires.

Kambiz, is such an event feasible?
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby Kambiz » September 2nd, 2006, 4:37 pm

It think it needs lot of work.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby kokkoras » September 2nd, 2006, 4:57 pm

Kambiz wrote:It think it needs lot of work.


That is my impression, too. Never mind. Thanks for the reply.
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby kokkoras » September 9th, 2006, 2:28 pm

Dirty Bug Report:

I have a TSG in the main form and I also have code in the OnObjectSelect event handler of TSG. For example, I make a call to SG.SelectedObjects.

When I am exiting my app with objects selected the app is exiting BUT with an EAccessViolation exception. Tracing the code reveals that execution is getting into the OnObjectSelect event handler where the exception occurs.

If no graph object is selected on exit, the app terminates gracefully.

I think the issue is related to how TSG is destroyed uppon application termination. The exact point of exception is not the SG.SelectedObjects call in the event handler. It occurs on the last line of TGraphObjectList.Delete(Index: Integer), that is, NotifyAction(Item, glRemoved); where Item=nil.

Any ideas?

edit: reproduced in a tiny app with the same behaviour
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby Kambiz » September 11th, 2006, 11:30 am

Clear the graph before closing the application. OnCloseQuery can be a good place.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby kokkoras » September 11th, 2006, 11:45 am

Kambiz wrote:Clear the graph before closing the application. OnCloseQuery can be a good place.


Is it a bug or a feature?

edit: are you talking about the OnCloseQuery of the form?
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby Kambiz » September 11th, 2006, 1:40 pm

Yes!
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby kokkoras » September 29th, 2006, 10:56 pm

15. Add GDI+ support (for smooth curves)

edit: Consider the use of Graphics32 library instead.
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

PreviousNext

Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 1 guest

cron