Re: SetCursor weirdness
"Igor Tandetnik" <[email protected]>
| Newsgroups | gmane.comp.windows.wtl |
|---|---|
| Message-ID | <[email protected]> |
domehead100 wrote:
> When reviewing the code, I discovered that the class was declared
> like this:
>
> template<class TValidator = CNoSWSValidate>
> class CSelectWindowStaticT : public CWindowImpl<CStatic>
> {
> ...
> }
>
> Note that it is not ": public
> CWindowImpl<CSelectWindowStaticT<TValidator>, CStatic>", it's just ":
> public CWindowImpl<CStatic>"
>
> Yet, all of my message handlers in CSelectWindowStaticT ARE being
> called (OnMouseMove, OnLButtonDown, etc.).
>
> Why? The message map should be calling ProcessWindowMessage for the
> first template argument to CWindowImpl
No. The message map _is_ ProcessWindowMessage - check out what
BEGIN_MSG_MAP macro actually expands to. ProcessWindowMessage is a
virtual function, so a call goes to the most-derived class.
CWindowImpl uses its first parameter only to call GetWndClassInfo,
GetWndStyle, GetWndExStyle and GetWndCaption. I imagine you don't
override any of these.
> Oddity #2
> One of the things the OnLButtonDown handler does is call SetCursor()
> to set the cursor (mouse pointer) to the crosshairs. Then it calls
> SetCapture() to track the mouse movement. As it turns out, the class
> works perfectly when it's ": public CWindowImpl<CStatic>"; e.g., when
> I click on the control the crosshairs seem to move off of the static
> as I move the mouse.
>
> When I derive it correctly, however, then when I click the left mouse
> button the cursor remains the standard arrow and does not change to
> the crosshairs.
In the first case you call ::SetCursor from Win32 API. In the second,
you call CStatic::SetCursor from WTL's atlctrls.h, which translates to
SendMessage(STM_SETIMAGE) and doesn't actually affect mouse cursor in
any way.
Igor Tandetnik
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/wtl/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/wtl/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/