` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please add your comments to this article. Please note that you must provide both a name and a valid email address in order for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

OOP: Subclassing and passing class reference via window property
2004-07-29 -- Jens Weiermann
 
Newsgroups: sv.clarion.suggestions Jonathan Kay wrote: > Currently writing a generic class for subclassing is painful; you have to > maintain the address of the class in a QUEUE so you can call virtual methods > from within the sub-classed procedure. And since this has to be module level > data you've got to synchronize it too. I've found a way to make this easier. I'm storing the address of my Clarion class instance in a window property of the sublclassed window (via the SetProp api). This way, I can reference assign that address to a Clarion variable again, like this (part of the WindowProc of the sublassed window): DATA SomeReference &MyClass CODE SomeReference &= (GetProp(hWnd, "MyClassUniqueString")) case Msg of WM_PAINT SomeReference.OnPaint(...) of WM_SETFOCUS SomeReference.OnSetFocus(...) of WM_KILLFOCUS SomeReference.OnKillFocus(...) end I've started rewriting my Sys* product series using this technique and haven't experienced any problems yet... HTH! Jens -- Jens Weiermann solid software http://www.solidsoftware.de


Today is May 8, 2024, 5:41 pm
This article has been viewed 35125 times.
Google search has resulted in 11 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: