and tomorow?blueznl wrote:I'd settle for just a simple mousebutton() but I'm not that demanding... today.
WindowMouseButton()
Fine too. But no later. (And don't say tomorrow tomorrow, as tomorrow is today... euh...)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
- Rook Zimbabwe
- Addict

- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
Is it tomorrow yet?
I cannot strongly enough urge the ability to return the mousebutton... and mousebuttonup values...
I think they could work similar in Windows and Linux... and on Mac with a 2 or three button mouse like I have seen for the more serious G5 units...
Maybe PB should forget legacy Mac code and look forward like Unlce Steve did?
I cannot strongly enough urge the ability to return the mousebutton... and mousebuttonup values...
I think they could work similar in Windows and Linux... and on Mac with a 2 or three button mouse like I have seen for the more serious G5 units...
Maybe PB should forget legacy Mac code and look forward like Unlce Steve did?
- tinman
- PureBasic Expert

- Posts: 1102
- Joined: Sat Apr 26, 2003 4:56 pm
- Location: Level 5 of Robot Hell
- Contact:
I know this is an old thread, but is there anything happening on this front? I'd love native events for mouse handling, and events for keyboard as well (key down / key up - shortcuts just don't cut it in all cases ;).
At the moment I've got the choice of using:
1) the Windows API. Fine, but I'll never get it working on Linux or Mac, as I have no knowledge/experience there.
2) 2D games libraries, which you are recommended not to use.
At the moment I've got the choice of using:
1) the Windows API. Fine, but I'll never get it working on Linux or Mac, as I have no knowledge/experience there.
2) 2D games libraries, which you are recommended not to use.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
(WinXPhSP3 PB5.20b14)
..mousebutton
Anyway... Thanks 'Berikco' for your code
It seams to work fine without any crashes for me in both, Linux and Vista.
..
Of course 'for newbies like me' , the code needs be update like:
Code: Select all
OpenWindow(0, 0, 0, 300, 200,"Test", #PB_Window_SystemMenu)
;OpenWindow(0, 0, 0, 300, 200, #PB_Window_SystemMenu, "Test")
hWnd = WindowID(0) ;hWnd = WindowID()
UseGadgetList(WindowID(0)) ;CreateGadgetList(WindowID(0))
This has been posted also a zillion times, I guess, but it may be of use to someone:
Code: Select all
Procedure.i x_leftmousebutton() ; return current state of left mousebutton
;
; retval: #True - mouse button down
; #False - mouse button up
;
; notes:
;
; - does not use events!
; - use #wm_lbuttonup and #wm_lbuttondown for event based handling
;
If GetSystemMetrics_(#SM_SWAPBUTTON) = 0
ProcedureReturn x_bool(GetAsyncKeyState_(#VK_LBUTTON))
Else
ProcedureReturn x_bool(GetAsyncKeyState_(#VK_RBUTTON))
EndIf
EndProcedure
Procedure.i x_rightmousebutton() ; return current state of right mousebutton
;
; notes:
;
; - does not use events!
; - use #wm_lbuttonup and #wm_lbuttondown for event based handling
;
If GetSystemMetrics_(#SM_SWAPBUTTON) = 0
ProcedureReturn x_bool(GetAsyncKeyState_(#VK_RBUTTON))
Else
ProcedureReturn x_bool(GetAsyncKeyState_(#VK_LBUTTON))
EndIf
EndProcedure
Procedure.i x_mousewheel(mode.i) ; returns number of lines up / down upon using the scrollwheel after a #WM_MOUSEWHEEL event
Protected d.i
;
; *** returns number of lines up / down upon using the scrollwheel after a #WM_MOUSEWHEEL event
;
; in: mode.i = 0 - one line per message, return -1 for up, +1 for down
; = 1 - use windows setting for calculating number of lines, from -n to +n
; retval: < 0 - up
; > 0 - down
;
If mode = 0
d = x_sgn( EventwParam() >> 16 )
Else
;
; #SPI_GETWHEELSCROLLLINES = 104
;
d = 0
SystemParametersInfo_(104,0,@d,0)
d = (EventwParam() >> 16)*d/120
;
EndIf
ProcedureReturn d
EndProcedure
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )


