[win32lib] SetCursor problems/fix

new topic     » topic index » view thread      » older message » newer message

Hi,
I'm there again after some time :)

While working with win32lib apps, I noticed that if the app
uses custom cursor for a control using setMousePointer(), the
cursor flashes during moving over the control. So I looked up
win32 reference for SetCursor :

<quote>
If your application must set the cursor while it is in a window,
make sure the class cursor for the specified window's class is set
to NULL. If the class cursor is not NULL, the system restores the
class cursor each time the mouse is moved.
</quote>

I've done a quick fix for this, but it seems to work fine:

* in registerClass(), change
    store( wndClassEx, winExCursor, w32Func( xLoadCursor, { NULL, IDC_ARROW}))
  to :
    store( wndClassEx, winExCursor, NULL)

* in setMousePointer(), remove the condition
    if isScreenPointIn( id, x, y ) then
        ...
    end if

* in fDoMouse(), change lines :

    -- need to set the mouse cursor?
    if window_cursor[id] then                         
        -- set to the requested style
        VOID = w32Func( xSetCursor, {window_cursor[id]} )
    end if

    to:

    -- need to set the mouse cursor?
    if window_cursor[id] then                         
        -- set to the requested style
        VOID = w32Func( xSetCursor, {window_cursor[id]} )
    else
        VOID = w32Func( xSetCursor, {IDC_ARROW} )
    end if

* now it looks better, but Derek may find a better solution
  (like not calling SetCursor for each WM_MOUSEMOVE)

Regards,
      Martin Stachon

martin.stachon at tiscali.cz
http://www.webpark.cz/stachon

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu