15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


OCX Subclassed ListBox: Missing Messages

Peter C -- PCMurray@vitgbsd3.telecom.com.au
Monday, June 24, 1996


Environment: VC++ 4.1 / Win 95


My goal is to create an owner-draw listbox as a control.
I created an OLE Control project with AppWizard
(OLE ControlWizard) and chose to subclass a LISTBOX as
one of the generation options.

The problem I am encountering is that the WM_DRAWITEM
message never seems to be sent, and therefore OnDrawItem
is not called (as it is in a standard dialog based
subclassed LISTBOX).  I tried making the style
LBS_OWNERDRAWFIXED but to no avail.  I thought this may
be a reflected message (OCM_DRAWITEM) but this message is
not received either.

The only draw-related function that is ever called in the
control seems to be;

OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)

Have I missed something fundamental here,  and/or do I have
to somehow generate my own WM_DRAWITEM messages from the
OnPaint function?

Thanks,
 - Peter Murray, Telstra (Telecom Australia)




Chong Zhang -- cz@dana.ucc.nau.edu
Tuesday, June 25, 1996

As I understood, the WM_DRAWITEM etc. messages are sent to the parent
window of the list box.

On Mon, 24 Jun 1996, Murray, Peter C wrote:

> 
> Environment: VC++ 4.1 / Win 95
> 
> 
> My goal is to create an owner-draw listbox as a control.
> I created an OLE Control project with AppWizard
> (OLE ControlWizard) and chose to subclass a LISTBOX as
> one of the generation options.
> 
> The problem I am encountering is that the WM_DRAWITEM
> message never seems to be sent, and therefore OnDrawItem
> is not called (as it is in a standard dialog based
> subclassed LISTBOX).  I tried making the style
> LBS_OWNERDRAWFIXED but to no avail.  I thought this may
> be a reflected message (OCM_DRAWITEM) but this message is
> not received either.
> 
> The only draw-related function that is ever called in the
> control seems to be;
> 
> OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
> 
> Have I missed something fundamental here,  and/or do I have
> to somehow generate my own WM_DRAWITEM messages from the
> OnPaint function?
> 
> Thanks,
>  - Peter Murray, Telstra (Telecom Australia)
> 
> 



Murray Spenser Cox -- murrayc@gui.com.au
Monday, July 01, 1996

The class of the list box has to be either LBS_OWNERDRAWFIXED or =
LBS_OWNERDRAWVARIABLE, and only then will the message OCM_DRAWITEM be =
sent from the parent window

----------
From: 	Chong Zhang[SMTP:cz@dana.ucc.nau.edu]
Sent: 	Tuesday, 25 June 1996 6:23 PM
To: 	mfc-l@netcom.com
Subject: 	Re: OCX Subclassed ListBox: Missing Messages

As I understood, the WM_DRAWITEM etc. messages are sent to the parent
window of the list box.

On Mon, 24 Jun 1996, Murray, Peter C wrote:

>=20
> Environment: VC++ 4.1 / Win 95
>=20
>=20
> My goal is to create an owner-draw listbox as a control.
> I created an OLE Control project with AppWizard
> (OLE ControlWizard) and chose to subclass a LISTBOX as
> one of the generation options.
>=20
> The problem I am encountering is that the WM_DRAWITEM
> message never seems to be sent, and therefore OnDrawItem
> is not called (as it is in a standard dialog based
> subclassed LISTBOX).  I tried making the style
> LBS_OWNERDRAWFIXED but to no avail.  I thought this may
> be a reflected message (OCM_DRAWITEM) but this message is
> not received either.
>=20
> The only draw-related function that is ever called in the
> control seems to be;
>=20
> OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
>=20
> Have I missed something fundamental here,  and/or do I have
> to somehow generate my own WM_DRAWITEM messages from the
> OnPaint function?
>=20
> Thanks,
>  - Peter Murray, Telstra (Telecom Australia)
>=20
>=20




| Вернуться в корень Архива |