Article View: borland.public.cppbuilder.oodesign
Article #125Class Events
From: 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!
Technical Details
Message-ID:
<1101999705.983646.235910@f14g2000cwb.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10db1e,f36f57860dd9d0af,start X-Google-Attributes: gid10db1e,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail From: "Clown Kiss" <ronslocum@hotmail.com> Newsgroups: borland.public.cppbuilder.oodesign Subject: Class Events Date: 2 Dec 2004 07:01:46 -0800 Organization: http://groups.google.com Lines: 27 Message-ID: <1101999705.983646.235910@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: 65.167.23.162 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1101999715 25661 127.0.0.1 (2 Dec 2004 15:01:55 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 2 Dec 2004 15:01:55 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=65.167.23.162; posting-account=kUGteA0AAADdUAAaBmPspRHoMRMHen5f