MouseButtonRelease(#PB_MouseButton_Left)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
minimy
Enthusiast
Enthusiast
Posts: 619
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

MouseButtonRelease(#PB_MouseButton_Left)

Post by minimy »

I think will be very usefull have a command to detect when the button is released in screenmode.
Some thing like this: MouseButtonRelease(#PB_MouseButton_Left)
With only MouseButton(#PB_MouseButton_Left) is very hard to control repeats without API commands. :mrgreen:
Thanks for read this comment.
If translation=Error: reply="Sorry, Im Spanish": Endif
User avatar
mk-soft
Always Here
Always Here
Posts: 6245
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: MouseButtonRelease(#PB_MouseButton_Left)

Post by mk-soft »

You don't need API. Only simple logic ...

Code: Select all

    If MouseButton(#PB_MouseButton_Left)
      If Not leftDown
        leftDown = #True
        leftUp = #False
        Debug "Left Button Down"
      EndIf
    ElseIf leftDown
      leftDown = #False
      leftUp = #True
      Debug "Left Button Up"
    EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
STARGÅTE
Addict
Addict
Posts: 2232
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: MouseButtonRelease(#PB_MouseButton_Left)

Post by STARGÅTE »

Code: Select all

Procedure MouseButtonRelease(Button.i)
	Static Dim Button.i(3) 
	If Button <= 3
		If MouseButton(Button)
			Button(Button) = #True
			ProcedureReturn #False
		ElseIf Button <= 3 And Button(Button)
			Button(Button) = #False
			ProcedureReturn #True
		EndIf
	EndIf
EndProcedure
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
minimy
Enthusiast
Enthusiast
Posts: 619
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: MouseButtonRelease(#PB_MouseButton_Left)

Post by minimy »

Thanks mk-soft and stargate, yes logic! :mrgreen:
If translation=Error: reply="Sorry, Im Spanish": Endif
Post Reply