View previous topic :: View next topic |
Author |
Message |
Yoschi
Joined: 27 Dec 2009 Posts: 6 Location: Germany
|
Posted: Sun Jan 10, 2010 12:12 pm Post subject: Own Event Types |
|
|
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 |
|
|
Mike Wey
Joined: 07 May 2007 Posts: 428
|
Posted: Mon Jan 11, 2010 3:46 pm Post subject: |
|
|
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 |
|
|
|
|
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
|