
Message Handling - Controls - ATL Composite Controls
Quote:
> 1) I did as per ur advise and it worked for me.
> Do I need to CHAIN the messages in CMyListBox? or Chaining
> is required only if I derive another class from the
> CMyListBox?.
> My intention is to make the default handler to handle the
> other messages, which I am not handling in my class. From
> its behavior I have observed, the messages are reaching
> the default handler, without chaining.
The chaining is required if you derive another class and want a message
map in the base class to get a stab at handling the messages. In the
end, all messages not specifically handled by your message map (or any
other message maps you might be chaining or forwarding to) are forwarded
to the default window proc, which in the case of superclassing (that's
the official name for the technique you are using) is the original proc
for the window class yours is based on (list box in your case).
Quote:
> 1.a) Actually I wanted to draw the Listbox items in the
> custom way, atleast in the cases of mouse movements on top
> of it.
> I added WM_DRAWITEM handler in the Composite Control.
> However, I feel, If I could draw the items from CMyListBox
> based on the properties set for the instance of the
> CMyListBox, it would be good. One scheme I thought was to
> call the method of the appropriate CMyListBox object using
> a switch case statement in the WM_DRAWITEM handler in the
> composite control. Is there a better scheme, where I get
> notifications for draw item in the CMyListBox itself?
Put REFLECT_NOTIFICATIONS entry at the end of your composite control's
message map. This sends certain messages, such as WM_DRAWITEM, right
back to the child window, offsetting the message ID to avoid conflicts.
In your list box class, add a handler for OCM_DRAWITEM message and
handle it as you would WM_DRAWITEM.
--
With best wishes,
Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken