Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease 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!
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 November 21, 2024, 6:55 am This article has been viewed 35395 times. Google search has resulted in 11 hits on this article since January 25, 2004.
|
|