FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Own Event Types

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
Yoschi



Joined: 27 Dec 2009
Posts: 6
Location: Germany

PostPosted: Sun Jan 10, 2010 12:12 pm    Post subject: Own Event Types Reply with quote

Hello,

I'm trying to create my own events for a custom widget, but I have no idea how. I will send 2 xy - coordinates to the parent widget after clicking with the mouse.

My idea is if the user clicks the first time with the mouse, the program will save the coordinates and if the user clicks the second time, it will send both coordinates with a custom event.

Can someone help me?

Thanks a lot,
Yoschi

PS: Sorry for bad english
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Mon Jan 11, 2010 3:46 pm    Post subject: Reply with quote

You could set up something like this:

Code:
void delegate(Point, Point)[] onTwoClicksDelegates;

void addOnTwoClicks(void delegate(Point, Point) dlg)
{
   onTwoClicksDelegates ~= dlg;
}

void twoClicks(Point point1, Point point2)
{
   foreach(dlg; onTwoClicksDelegates)
      dlg(point1, point2);
}


And then call twoClicks from when your Widget has received two clicks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
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


Powered by phpBB © 2001, 2005 phpBB Group