Subclassing controls 
Author Message
 Subclassing controls

Is PreCreateWindow() called for controls connected through the
DoDataExchange() function?  I have a CListCtrl derived class
and its PreCreateWindow() function is never called.

Murrgon



Sat, 29 Oct 2005 15:26:23 GMT  
 Subclassing controls

Quote:
> Is PreCreateWindow() called for controls connected through the
> DoDataExchange() function?  I have a CListCtrl derived class
> and its PreCreateWindow() function is never called.

You mean a DDX_Control call in the DoDataExchange function? If so, the
answer is unfortunately 'no'. In this situation, the control has been
previously created (usually by the OS dialogbox creation code) well
before the call to DDX_Control executes. Many times, PreSubclassWindow
can be used instead, but sometimes not -- it depends on what you want to
do.
--
Jeff Partch [VC++ MVP]


Sat, 29 Oct 2005 15:48:44 GMT  
 Subclassing controls
I was able to get around the problem using PreSubclassWindow().
Thanks.
Quote:

> You mean a DDX_Control call in the DoDataExchange function? If so, the
> answer is unfortunately 'no'. In this situation, the control has been
> previously created (usually by the OS dialogbox creation code) well
> before the call to DDX_Control executes. Many times, PreSubclassWindow
> can be used instead, but sometimes not -- it depends on what you want to
> do.



Sat, 29 Oct 2005 16:19:06 GMT  
 Subclassing controls
Hmmm, it would seem not everything is hunky dory.  I am modifying
the style of the control in PreSubclassWindow() so it is ownerdrawn,
however MeasureItem() is never called.  I'm thinking this is because
the window was created earlier and we are just "attaching" ourselves
to it.  Is there any way to get around this?

Murrgon



Sat, 29 Oct 2005 16:26:38 GMT  
 Subclassing controls

Quote:
> Hmmm, it would seem not everything is hunky dory.  I am modifying
> the style of the control in PreSubclassWindow() so it is ownerdrawn,
> however MeasureItem() is never called.  I'm thinking this is because
> the window was created earlier and we are just "attaching" ourselves
> to it.  Is there any way to get around this?

What kind of ownerdraw control is it, and what is its ownerdraw style?
--
Jeff Partch [VC++ MVP]


Sat, 29 Oct 2005 16:42:59 GMT  
 Subclassing controls
Well, it is a CListCtrl and as far as I am aware, they only have one
type of owner draw which is LVS_OWNERDRAWFIXED.  I have used this
before when creating the control myself, however now it would be nice
to be able to use the dialog editor and just subclass it.
Quote:

> What kind of ownerdraw control is it, and what is its ownerdraw style?



Sat, 29 Oct 2005 16:54:42 GMT  
 Subclassing controls
Your assumption is correct, the measure item message was sent before the
control was subclassed. That's why you did not receive it...

Ivan


Quote:
> Well, it is a CListCtrl and as far as I am aware, they only have one
> type of owner draw which is LVS_OWNERDRAWFIXED.  I have used this
> before when creating the control myself, however now it would be nice
> to be able to use the dialog editor and just subclass it.


> > What kind of ownerdraw control is it, and what is its ownerdraw style?



Sun, 30 Oct 2005 12:38:56 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Subclassing controls

2. subclassing controls in dynamically biult dialog box

3. subclassing controls in CFormView

4. Subclassing Controls

5. subclassing controls w/ ActiveX

6. Subclassing Control (pref. RichEdit)

7. Subclassing controls

8. Subclassing controls

9. Subclassing controls in a composite control within the container class.

10. Subclassing the header control inside list control

11. Help:ACIVEX controls- subclassing Windows Control

12. Subclassing an ActiveX control

 

 
Powered by phpBB® Forum Software