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 

TSimpleGraph and OnClick event

 
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
onlytk
Member


Joined: 30 Oct 2005
Posts: 9

PostPosted: 09/11/05 21:13    Post subject: TSimpleGraph and OnClick event Reply with quote

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?
Back to top
View user's profile Send private message
Radagast
Member


Joined: 01 May 2005
Posts: 24
Location: Poland

PostPosted: 09/11/05 22:04    Post subject: Reply with quote

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).
Back to top
View user's profile Send private message Visit poster's website
lbc
Member


Joined: 04 Feb 2004
Posts: 48
Location: Italy

PostPosted: 10/11/05 09:39    Post subject: Re: TSimpleGraph and OnClick event Reply with quote

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
Back to top
View user's profile Send private message
onlytk
Member


Joined: 30 Oct 2005
Posts: 9

PostPosted: 10/11/05 13:35    Post subject: Re: TSimpleGraph and OnClick event Reply with quote

thanx lbc, i'll try that code. Very Happy
Back to top
View user's profile Send private message
Kambiz
Administrator


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

PostPosted: 10/11/05 13:47    Post subject: Reply with quote

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


Joined: 30 Oct 2005
Posts: 9

PostPosted: 10/11/05 16:54    Post subject: Reply with quote

Ok Kambiz, i'll wait the new version, hehehe. Very Happy

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 Embarassed

Cheers
Back to top
View user's profile Send private message
Kambiz
Administrator


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

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

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


Joined: 30 Oct 2005
Posts: 9

PostPosted: 11/11/05 00:15    Post subject: Reply with quote

thanks kambiz, thanx a lot Very Happy
Back to top
View user's profile Send private message
lbc
Member


Joined: 04 Feb 2004
Posts: 48
Location: Italy

PostPosted: 11/11/05 11:05    Post subject: Reply with quote

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:

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

Back to top
View user's profile Send private message
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