RE: On the edge.......

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

Hi,

the main problem is that when an event handler starts running, all other
events are blocked until the event handler finishes.
In your case, once you detect the mouse-down event and "do something", while
that something is doing its stuff, the mouse-up event is blocked, waiting
for you to finish doing something!

That's why we added the doEvents() routine in win32lib.

Using the newer version of the library try something like this...

---------------
integer StopIt

procedure dosomething()
    StopIt = False
    -- Loop around until I'm signalled to stop.
    while StopIt = False do
        doEvents(0) -- allow some window events to get through.
        . . . what ever . . .
    end while
end procedure

procedure test_mouse(integer event, integer x, integer y )

    if event = WM_LBUTTONDOWN then
        -- start do my thing.
        dosomething()
     elsif event = WM_LBUTTONUP then
        -- signal that I have to stop now.
        StopIt = True
     end if
end procedure
onMouse[ Win ] = routine_id("test_mouse")
---------------------
cheers,
Derek

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

Search



Quick Links

User menu

Not signed in.

Misc Menu