[futurebasic] Re: [FB] mouse routine

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2012 : Group Archive : Group : All Groups

From: Carlos Frías <carfrino@...>
Date: Sat, 28 Jul 2012 18:15:04 +0200
Thank you Sir!
It seems to be ok!

----- Original Message ----- 
From: "Robert Covington" <artlythere@...>
To: <futurebasic@...>
Sent: Saturday, July 28, 2012 4:59 PM
Subject: Re: [FB] mouse routine




On Jul 28, 2012, at 10:12 AM, Carlos Frías wrote:

> Hello!
> I'm trying to traslate my old FB programs into the new FBtoC and I'm
> stoped with the mouse.
> Has anyone time to fix this problem? Other wise, are there any
> diferent way to make this?
> I need a solution that keep the return of the mouse parameters and
> print them in the window (like this little program...).
>
> Here is the code:

This should help get you started?

// Begin FBtoC program
// RC


Local Fn MouseIsDown
End fn = (fn GetCurrentButtonState and Bit(0)) <> 0

Local Fn ReportMouse
dim as point mPt
Window output 1
// print, plot
GetMouse(mPt)
print %(20,220)mPt.h,mPt.v
End fn

Local Fn DoMouse
dim as point mPt, pt1,pt2
dim theWnd as long
dim as short mouseFunc

mouseFunc = ABS(MOUSE(0))

theWnd = mouse(_mouseWindow)
window output theWnd
Getmouse(mPt) // initial

Window output theWnd
// print, plot

//or other
pt1 = mPt
while Fn MouseIsDown // avoid beach ball , Fn StillDown, deprecated
GetMouse(pt2)
long if (Fn EqualPt(pt2,pt1) == _False)
beep// Do something, but only if mouse moved
pt1 = pt2
end if
wend

// Alternatively...

/*Select mouseFunc
case 1
// one click, check still down using above code, but place it inside here
case 2// double click
beep
case 3

end Select*/

End fn


Window 1, "Click for mouse moved check"

On Mouse Fn DoMouse
// if wanting 'polling', 30 times something behavior
poke long event -8,2

do
handleEvents
Fn ReportMouse // Will only work with polling enabled
Until gFBQuit

// End
--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
To access the list archives, go to: 
http://freegroups.net/groups/futurebasic/