Re: Click, drag, release
Tom,
I think *this* version will show you how to do everything you might want.
Dan Moyer
-- <CODE FOLLOWS>
-- code generated by Win32Lib IDE v0.10.6
include Win32Lib.ew
without warning
----------------------------------------------------------------------------
----
-- Window Window1
global constant Window1 = create( Window, "Show all mouse events", 0,
Default, Default, 400, 300, 0 )
global constant LText3 = create( LText, "", Window1, 28, 24, 152, 24, 0 )
global constant LText4 = create( LText, "", Window1, 28, 76, 200, 24, 0 )
global constant LText5 = create( LText, "", Window1, 28, 120, 200, 24, 0 )
---------------------------------------------------------
----------------------------------------------------------------------------
----
integer MouseState
MouseState = 0
procedure Window1_onMouse ( int event, int x, int y, int shift )
if event = MOUSE_MOVE then
setText(LText3, sprint(x) & ", " & sprint(y))
if MouseState = 1 then
setText(LText4, "left down, " & sprint(x) & ", " & sprint(y))
elsif MouseState = 2 then
setText(LText4, "right down, " & sprint(x) & ", " & sprint(y))
elsif MouseState = 5 then -- just in case hold button down after dbl
setText(LText4, "left down, " & sprint(x) & ", " & sprint(y))
elsif MouseState = 6 then -- just in case hold button down after dbl
setText(LText4, "right down, " & sprint(x) & ", " & sprint(y))
else
setText(LText4, "MOVING,no mouse button pressed")
setText(LText5, " ")
end if
elsif event = LEFT_DOWN then
setText(LText4, "LEFT_DOWN ")
MouseState = 1
elsif event = RIGHT_DOWN then
setText(LText4, "RIGHT_DOWN")
MouseState = 2
elsif event = LEFT_UP then
setText(LText4, "LEFT_UP")
MouseState = 3
elsif event = RIGHT_UP then
setText(LText4, "RIGHT_UP")
MouseState = 4
elsif event = LEFT_DOUBLECLICK then
setText(LText5, "LEFT_DOUBLECLICK")
MouseState = 5
elsif event = RIGHT_DOUBLECLICK then
setText(LText5, "RIGHT_DOUBLECLICK")
MouseState = 6
end if
end procedure
onMouse[Window1] = routine_id("Window1_onMouse")
WinMain( Window1, Normal )
-- <CODE ENDS>
----- Original Message -----
From: <thomas at columbus.rr.com>
To: "EUforum" <EUforum at topica.com>
Sent: Saturday, June 08, 2002 1:57 PM
Subject: Click, drag, release
>
> I have a window that I want people to be able to draw on with the mouse.
I
> want to test on every firing of the onMouse event whether the mouse button
> is down or up, so I can program my other routines accordingly.
>
> Right now, the LeftDown and LeftUp events are only fired once per "drag".
I
> do not want to have a variable that stores which the last event was,
because
> if the mouse button is released outside of the window it will continue to
> drag until they click again.
>
> Can somebody help with this problem?
>
> ~Tom
>
>
>
>
|
Not Categorized, Please Help
|
|