Re: CEdit white
"GT" <ContactGT_remove_@hotmail.com> wrote in message
news:4610d64d$0$24409$c3e8da3@news.astraweb.com...
"Tom Serface" <tom.nospam@camaswood.com> wrote in message
news:DEF471E5-CC05-4CF7-8961-008415BC7D4A@microsoft.com...
My knowledge of the inner workings of the MFC fails me here as I don't
know how these label 'things' are actually rendered on the screen. Are
they drawn as part of the CDialog's Paint method, or does the MFC
instantiate CStatic objects for me and tell them to draw themselves. The
first option here means that from an OO point of view, they are not
objects, but attributes of the CDialog. The second option here means that
they are transient objects and have attributes and operations of their
own. I suspect the latter, but when modelling an instance diagram for this
dialog, I would be modelling 7 objects.
Without using MFC, the "label things" are HWND's with a classname of
"STATIC". The fact that they have a classname of STATIC means they have a
WindowProc which contains code that paints "label things". For any HWND
(including those with a classname of "STATIC"), you can "subclass" it by
replacing its WindowProc with your own. So in MyStaticWindowProc, you can
do things like paint label things as foobar things, if you want. You can
change the background color to white, if you want. So to the extent you
consider an HWND an object that you subclass by replacing its WindowProc,
then yes, every control in your dialog is an object. But there is no
physical C++ object. Indeed, most people don't realize that Windows
contains many classes like HWND, HDC, HBRUSH, etc. but they are not called
"classes" because OOP languages had not been created at the time, and
Microsoft was forced to do crazy things like replacing WindowProcs instead
of deriving new classes to affect new behavior.
Fast forward a few years. OOP languages prevail. MFC now lets you add a
phyiscal C++ object (e.g. CStatic) to any number of HWND's in your dialog.
Under the covers, it performs the subclass step (see above) using e.g.
CStatic::WindowProc.
So whether or not you think there is an object there simply by having a
STATIC, or if you actually need a physical C++ class like CStatic in order
for it to count as an object is what we're debating here.
-- David