Page 1 of 1

SimpleGraph

PostPosted: May 23rd, 2003, 2:06 am
by moses
Is it possible with simplegraph to just have it add an image when you click on a button say on the toolbar instead of using a shape, nix the shape and just add a image from a image list or something? if so how?

Jordan

PostPosted: May 23rd, 2003, 10:54 am
by Kambiz
Sorry, but I couldn't get what you mean. :?

Kambiz

Sorry my bad.

PostPosted: May 23rd, 2003, 1:48 pm
by moses
Well lets take the demo, instead of just clicking the circle or box button on the toolbar and click and drag to create that, instead of a circle, what about changing that to a predetermined image, so instead of adding a shape and then right clicking and adding a "background" it would already automaticly add the image when you add the shape, or perhaps just adding the image and no shape? I don't know if that makes more sense, i'm sorry if it doesn't :(

Jordan

PostPosted: May 24th, 2003, 12:04 pm
by Kambiz
Hi Jordan,

You can use the InsertNode method of TSimpleGraph to add a node. The function returns the new created node, so you can change its proprties as you wish.

Cheers,
Kambiz

more

PostPosted: May 24th, 2003, 9:47 pm
by moses
Okay, got that far, but now another question, can i have it so the nodes are movable but not resizable. Also instead of clicking to add the node, what about just clicking a button for a new node and it automaticly adds it to say the upper left and corner of the simplegraph with a specific size and have it none sizeable?

Jordan

PostPosted: May 25th, 2003, 1:59 am
by Kambiz
Hi Jordan,

The component is there and you can do whatever you want. :wink:

You can perevent resizing the nodes by setting CanResize parameter of the OnCanMoveResizeNode event to false. You have also OnMouseDown event, insert the node there and set its width and height to the size that you want.

Kambiz

:)

PostPosted: May 26th, 2003, 5:59 am
by moses
Okay, sorry if i sound like a complete idiot, i usually only need pointing in the right direction to get the brain moving and you've done that, your component is great by the way and thank you for your help.

Jordan

One more thing :)

PostPosted: May 26th, 2003, 6:02 am
by moses
How would i go about adding an image to the canvas of simple graph, i know i just can't use TImage because it isn't on top. i just want to add a image to the center of the canvas of simplegraph and then add things that would appear above it, any suggestions would be great, thank you.

Jordan

PostPosted: May 26th, 2003, 12:36 pm
by Kambiz
For this purpose, you have to subclass your own node class from TGraphNode and then register it in the component.

Kambiz

OnMouseDown

PostPosted: May 26th, 2003, 3:11 pm
by moses
When i try and use the OnMouseDown it doesn't seem to respond to anything, if i put a simple edit1.text := 'yes the mouse is down'; it doesn't change the text, nor does it respond to me trying to insert a node, perhaps i'm doing something wrong?

Jordan

PostPosted: May 26th, 2003, 7:33 pm
by Kambiz
The CommandMode property should be cmViewOnly otherwise the control handles the event.

Kambiz

Okay

PostPosted: May 26th, 2003, 10:03 pm
by moses
okay, thanks, this is my last post

PostPosted: May 26th, 2003, 10:08 pm
by Kambiz
Why the last one? :shock:

heh

PostPosted: May 27th, 2003, 4:51 am
by moses
Well i guess i lied.. i figure that you are ready to kill me or something and i don't want you to do that :)
But your help has been great for the record and i thank you very much for it sir.

Jordan

PostPosted: May 27th, 2003, 4:03 pm
by Kambiz
I am glad that you are not serious about what you said.

If I didn't like to answer to your questions, firstly this forum was not here, secondly I didn't publish any component, and lastly I just didn't answer. :wink:

Cheers,
Kambiz