Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Class Events

0 views
Skip to first unread message

Clown Kiss

unread,
Dec 2, 2004, 10:01:46 AM12/2/04
to
I'm trying to create a class that has events that can be assigned to a
parent object's defined functions. Similar to the OnClick event or the
OnTimer event. I've listed an example of how I create one object
followed by how I create my own object.

TShape *myShape;
myShape = new TShape(Panel1);
myShape->Name = "Shape1";
myShape->Shape = stCircle;
myShape->Parent = Panel1;
myShape->Hint = "PLC Status";
myShape->OnMouseUp = OPCShapeMouseUp; // This is what I want
myShape->OnMouseDown = OPCShapeMouseDown; // This is what I want


This is how I declare and initialize my class:
TmyClass_Env *myClass;
myClass = new TmyClass_Env(MainForm);
myClass->Description = "My Test Class";
myClass->OnMessage = OnMyClassMessage; // This doesn't work

I'm not sure how to declare the OnMessage event within my class. I
would like the OnMessage event to pass an AnsiString that the parent
object can either display in a message box or print to a memo or a log
file. This OnMessage event would fire when called from within a member
function of TmyClass. Thank you for any help!

0 new messages