More Windows-Functions

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Falko
Enthusiast
Enthusiast
Posts: 271
Joined: Sat Oct 04, 2003 12:57 pm
Location: Germany
Contact:

More Windows-Functions

Post by Falko »

Hi Fred,
you have created following functions for Windows and Desktop:
WindowMouseX() and WindowMouseY()
DesktopMouseX() and DesktopMouseY()

But i missing following functions for Mouseclicks:

WindowMouseButton() ; 1 for left button, 2 for right button and 3 for middle button
the same wish to DesktopMouseButton().

Can you do create this functions for Windowuser?

Regards Falko

Sorry, my english.
www.falko-pure.de
Win11 Pro 64-Bit, PB_6.11b1
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Re: More Windows-Functions

Post by michel51 »

Falko wrote:Hi Fred,
you have created following functions for Windows and Desktop:
WindowMouseX() and WindowMouseY()
DesktopMouseX() and DesktopMouseY()

But i missing following functions for Mouseclicks:

WindowMouseButton() ; 1 for left button, 2 for right button and 3 for middle button
the same wish to DesktopMouseButton().

Can you do create this functions for Windowuser?

Regards Falko

Sorry, my english.
Nice wishes :)
The same for Mac users (and Linux too).
And don't forget, sometimes there is a mousewheel instead of a middle button :wink:
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
Anonymous

Post by Anonymous »

Hi , i up this topic.
WindowMouseButton.i(mask)
WindowMouseWheelDelta.i()

Can you add this functions in the next release for all user ( linux / win / mac )?
User avatar
thyphoon
Enthusiast
Enthusiast
Posts: 345
Joined: Sat Dec 25, 2004 2:37 pm

Post by thyphoon »

+1


I think under windows with WaitWindowEvent() return a value when you push mouse button ! Try it ! i don't know if it's the same stuff whith MacOS and Linux, but you can try !

i hope this help you !
User avatar
thyphoon
Enthusiast
Enthusiast
Posts: 345
Joined: Sat Dec 25, 2004 2:37 pm

Re: More Windows-Functions

Post by thyphoon »

If i up this topic is not to force PBTeam !
i would like to put this code

I forget the name of people(s?) who make this procedure
But it will better if this procedure will be native in PB :D
Edit: source about this code from DarkDragon
http://www.purebasic.fr/english/viewtop ... ouseButton

Code: Select all

Procedure WindowMouseButton(Wnd, ButtonNr)
  CompilerIf #PB_Compiler_OS = #PB_OS_Linux
  ;Linux Version

  Protected gdkWnd.l, x.l, y.l, mask.l

  If Wnd
    *Window.GTKWindow = Wnd
    gdkWnd = *Window\bin\child\window
    gdk_window_get_pointer_(gdkWnd, @x, @y, @mask)
   
    Select ButtonNr
      Case 0
        If (mask & #GDK_BUTTON1_MASK)
          ProcedureReturn 1
        EndIf
      Case 1
        If (mask & #GDK_BUTTON3_MASK)
          ProcedureReturn 1
        EndIf
      Case 2
        If (mask & #GDK_BUTTON2_MASK)
          ProcedureReturn 1
        EndIf
    EndSelect
  EndIf

  CompilerElse
  ;Windows Version

  If Wnd And GetForegroundWindow_() = Wnd
    Select ButtonNr
      Case 0
        If GetAsyncKeyState_(#VK_LBUTTON) > 0
          ProcedureReturn 1
        EndIf
      Case 1
        If GetAsyncKeyState_(#VK_RBUTTON) > 0
          ProcedureReturn 1
        EndIf
      Case 2
        If GetAsyncKeyState_(#VK_MBUTTON) > 0
          ProcedureReturn 1
        EndIf
    EndSelect
  EndIf

  CompilerEndIf

  ProcedureReturn 0
EndProcedure
Post Reply