Page 1 of 1

More Windows-Functions

Posted: Mon Oct 22, 2007 10:12 pm
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.

Re: More Windows-Functions

Posted: Wed Oct 31, 2007 11:27 pm
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:

Posted: Mon Feb 23, 2009 3:44 pm
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 )?

Posted: Mon Feb 23, 2009 11:44 pm
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 !

Re: More Windows-Functions

Posted: Thu Dec 03, 2009 8:48 am
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