TSimpleGraph and OnClick event

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

TSimpleGraph and OnClick event

Postby onlytk » November 9th, 2005, 9:13 pm

Hello, i have to put a node when a user do click over the component SimpleGraph (canvas), but there isn't the event OnClick, how can i do that?
onlytk
Active Member
Active Member
 
Posts: 9
Joined: October 30th, 2005, 1:46 am

Postby Radagast » November 9th, 2005, 10:04 pm

Well, if ther isn't OnClick, OnMouseUp/Down/something else then I think all clicks takes component beyond SimpleGraph (for example form). If so you just need to check (in OnMouseDown/Up) if coordinates of mouse cursor are in area of your graph and then add a node.
Maybe it's not that simple, but it's worth trying. Just put ShowMessage('It works'); inside OnMouseClick/Down of form put SimpleGraph on it and try clicking it.
I'm not using SimpleGraph, so excuse me for saying something stupid if I did it.
EDIT: The other way is creating your own loop for taking care of Windows Messages that changes only standard reaction on clicking, and if click is outside of SimpleGraph's area just runs normal reaction (I think something like 'inherited' should do).
Radagast
Active Member
Active Member
 
Posts: 24
Joined: May 1st, 2005, 9:32 pm
Location: Poland

Re: TSimpleGraph and OnClick event

Postby lbc » November 10th, 2005, 9:39 am

Hello

onlytk wrote:Hello, i have to put a node when a user do click over the component SimpleGraph (canvas), but there isn't the event OnClick, how can i do that?


a user (G. Vaccaro) has added a modification to insert shape by click you may visit the following thread:

http://www.delphiarea.com/forum/viewtopic.php?t=448

hope that helps
lbc
Junior Member
Junior Member
 
Posts: 48
Joined: February 4th, 2004, 7:50 am
Location: Italy

Re: TSimpleGraph and OnClick event

Postby onlytk » November 10th, 2005, 1:35 pm

thanx lbc, i'll try that code. :D
onlytk
Active Member
Active Member
 
Posts: 9
Joined: October 30th, 2005, 1:46 am

Postby Kambiz » November 10th, 2005, 1:47 pm

onlytk,

Wait please!

In the new release, I've added missing OnClick and OnObjectClick events to the SimpleGraph.

In a few hours I'll upload the files.

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

Postby onlytk » November 10th, 2005, 4:54 pm

Ok Kambiz, i'll wait the new version, hehehe. :D

another question, is how can I determine if an object is unselected, in one event, example:

I'm doing the next: the user select a node and in a panel I have located a EditBox, and when the user select a node with the event OnObjectSelect I i get the text of the node and i put it in the editbox, but when the user deselect it my editbox persist with the text of the node, what is the event that i have to manage for it?. I'dont speak english very well, sorry if someone don't understand me :oops:

Cheers
onlytk
Active Member
Active Member
 
Posts: 9
Joined: October 30th, 2005, 1:46 am

Postby Kambiz » November 10th, 2005, 10:42 pm

Hi,

OnObjectSelect occurs when selection state of an object changes.

You have to check the Selected property of GraphObject parameter to see whether the object is selected or deselected.

By the way, version 1.65 of the control is available to download.

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

Postby onlytk » November 11th, 2005, 12:15 am

thanks kambiz, thanx a lot :D
onlytk
Active Member
Active Member
 
Posts: 9
Joined: October 30th, 2005, 1:46 am

Postby lbc » November 11th, 2005, 11:05 am

Kambiz wrote:In the new release, I've added missing OnClick and OnObjectClick events to the SimpleGraph.



thank you Kambiz, great!

for anyone interested here is a simple snippet to insert a rectangular node at 10,10 by clicking (SG is of course a SimpleGraph)

Code: Select all
procedure TForm1.SGClick(Sender: TObject);
var
    R: TRect;
begin
 SG.DefaultNodeClass := TRectangularNode;
  R :=  MakeRect(Point(10,10),Point(100,100));
  SG.InsertNode(@R);
end;

lbc
Junior Member
Junior Member
 
Posts: 48
Joined: February 4th, 2004, 7:50 am
Location: Italy


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 1 guest