Adding custom handlers to custom objects
Declan McMullen
declan.mcmullen at dmuknet.com
Thu Oct 25 07:52:13 PDT 2007
Hey guys,
Following on from my question about drawing I was wondering if you
could point me in the right direction on this.
I am implementing a simple drawing program that allows a user to draw
onto a panel. There can be multiple objects that they can draw. For
example they can draw a point, and they can draw a line. Both of these
items are objects. What I want to be able to do now is, if I click on
one of these objects, either directly on the point or anywhere on the
line in the case of the line object, I want to be able to trigger an
event.
For a simple example say I draw a line on screen. If I click on it I'd
like to open up a color picker to change the color of the line. Is it
possible for me to add an event handler to that line object that can be
triggered when I click on it ?
So far I've only added events to actual wxWidget objects such as panels,
and menus and toolbars.
I've looked in the book about custom even handlers but I'm unclear as to
how I'd add ID's to my own custom objects. I.e how I could connect say
the id MY_LINE to my line object and thus trigger an event for that ID.
I basically dont understand how I can tie ID's to objects that I create
instead of wxWidget elements.
Can anyone clear up my confusion, or point me to a tutorial or a section
in the book that I'm missing ?
More information about the wx-users
mailing list