Thread View: borland.public.cppbuilder.oodesign
1 messages
1 total messages
Started by Clown Kiss
Thu, 02 Dec 2004 15:01
Class Events
Author: Clown Kiss
Date: Thu, 02 Dec 2004 15:01
Date: Thu, 02 Dec 2004 15:01
26 lines
2054 bytes
2054 bytes
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!
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads