SimpleGraph : fixed sized shapes/ RESOLVED

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

SimpleGraph : fixed sized shapes/ RESOLVED

Postby dlewin » March 20th, 2007, 9:28 pm

Hello
First of all thanks for such components with a real code quality.
As I'm new to SimpleGraph I have dificulty to create a predifined shape : I want an application that can create automatically linked rectangle with a fixed size on a click event.
The better would be a sized adapted to the text inside the shape (rectangle).

Thanks in advance.

David


PS : I did not found that topic in the forum
Last edited by dlewin on March 24th, 2007, 9:41 am, edited 1 time in total.
dlewin
Active Member
Active Member
 
Posts: 5
Joined: March 20th, 2007, 9:22 pm

Postby Kambiz » March 21st, 2007, 8:47 pm

Use OnMoveResizeObject event to prevent resizing of the objects.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby dlewin » March 21st, 2007, 10:09 pm

I have to admit some details were missing : I want a predifined size rectangle to be created when user click on a "create task" (for example) button .

In fact it is like change the default creation size of the rectangle
dlewin
Active Member
Active Member
 
Posts: 5
Joined: March 20th, 2007, 9:22 pm

Postby HPW » March 22nd, 2007, 6:19 am

Then use OnObjectInsert.
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby dlewin » March 22nd, 2007, 3:43 pm

yes I found it on the doc, it's seems right for that but before how to to do it programatically: I did not found out how. Maybe TgraphicObject.add or insert ? if yes is there a little code of it as in the demo it's done by the user.

PS : kambiz in the readme.html there is a little correction from
Code: Select all
TGrephObjectClass = class of TGraphObject  to
TgraphObjecTClass
dlewin
Active Member
Active Member
 
Posts: 5
Joined: March 20th, 2007, 9:22 pm

Postby HPW » March 22nd, 2007, 7:23 pm

Maybe you can use also:
Code: Select all
SimpleGraph1.InsertNode(noderect ,TRoundRectangularNode)

ObjectAtPt1 := TyOURfORM.SimpleGraph1.FindObjectAt(posx, posy);
ObjectAtPt2 := TYourForm.SimpleGraph1.FindObjectAt(eposx, eposy);

ALinkClass.CreateNew(TYourForm.SimpleGraph1, ObjectAtPt1, [], ObjectAtPt2)

Stripped out of a greater context, not tested.
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby dlewin » March 23rd, 2007, 11:20 am

thanks for the answer, is that ok ?

Code: Select all
var
noderect : Trect ;
AlinkClass : TGraphLink ;
begin
AlinkClass := TGraphLink.Create(SimpleGraph1) ;

SimpleGraph1.InsertNode(noderect ,TRoundRectangularNode)   ;

ObjectAtPt1 := FORM1.SimpleGraph1.FindObjectAt(10, 10);
ObjectAtPt2 := FORM1.SimpleGraph1.FindObjectAt(20, 20);



as I did not found how to make Objects, I was wondering if


Code: Select all
function MakeSquare(const Center: TPoint; Radius: Integer): TRect;

function MakeRect(const Corner1, Corner2: TPoint): TRect;


is this ok for that automatic cration ? if yes
I did not succeed to create it correctly

//=========mod edit: merge================

what I meant by correctly is

Code: Select all

procedure TForm1.BitBtn1Click(Sender: TObject);
var
noderect, carre : Trect ;
Centre : Tpoint ;

begin
AlinkClass := TGraphLink.Create(SimpleGraph1) ;
Centre.X := 10 ;
Centre.Y := 10 ;

carre := MakeSquare(Centre, 2);

end ;


does not show anything;

elsewhere insertnode in my previous post code was giving "something" because of scrollbars apearing, but same : nowhere to see any shape ...
dlewin
Active Member
Active Member
 
Posts: 5
Joined: March 20th, 2007, 9:22 pm

Postby Kambiz » March 24th, 2007, 12:09 am

Well, I'm confused with your codes dlewin.

Are you looking for something like this:
Code: Select all
SimpleGraph1.InsertNode(MakeRect(Point(100, 100), 10), TRectangularNode) ;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

re

Postby dlewin » March 24th, 2007, 9:39 am

this is the answer I was looking for.
I made another code from this one (because of a TRect error) and now
I can "generate" a shape with a predifined size.

Now I will try with drag-n-drop (visio's style)

Thanks for all answers.
dlewin
Active Member
Active Member
 
Posts: 5
Joined: March 20th, 2007, 9:22 pm


Return to DELPHI AREA Products

Who is online

Users browsing this forum: Bing [Bot] and 1 guest