Page 1 of 1

Event mouse (#PB_Event_leftButtonUp and so)

Posted: Fri Jul 10, 2015 8:55 am
by [blendman]
Hi

I could be great to have the event :

Code: Select all

#PB_Event_leftButtonUp
#PB_Event_leftButtonDown
#PB_Event_RightButtonUp
#PB_Event_RightButtonDown
#Pb_Event_MouseMove
#Pb_Event_MouseWheel
For Windows, we have that :

Code: Select all

#WM_LBUTTONDOWN
#WM_LBUTTONUP
#WM_RBUTTONDOWN
#WM_RBUTTONUP
#WM_MOUSEWHEEL
#WM_MOUSEMOVE
But for linux and mac users ?

Re: Event mouse (#PB_Event_leftButtonUp and so)

Posted: Fri Jul 10, 2015 9:40 am
by Shardik
You should take a look into #PB_EventType_*: :wink:

#PB_EventType_LeftButtonDown
#PB_EventType_LeftButtonUp
#PB_EventType_LeftClick
#PB_EventType_LeftDoubleClick
#PB_EventType_RightButtonDown
#PB_EventType_RightButtonUp
#PB_EventType_RightClick
#PB_EventType_RightDoubleClick
#PB_EventType_MiddleButtonDown
#PB_EventType_MiddleButtonUp
#PB_EventType_MouseEnter
#PB_EventType_MouseLeave
#PB_EventType_MouseMove
#PB_EventType_MouseWheel

But the actual problem is that these event types still have to be implemented cross-platform in many of PB's gadgets ...

Re: Event mouse (#PB_Event_leftButtonUp and so)

Posted: Fri Jul 10, 2015 9:51 am
by [blendman]
Shardik wrote:You should take a look into #PB_EventType_*
Hi

I know eventType, but they need special gadget (#pb_EventType_LeftButtondown need canvas for example)
I need : "Event" (mouse), not "eventtype" ;)

A simple example to see the difference :

Code: Select all

OpenWindow(0, 0, 0, 220, 100, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)


Repeat
  
  Event = WaitWindowEvent()
  EventType   = EventType()
  
  
  Select event
      
    Case #WM_LBUTTONDOWN
      Debug "mouse left (with WaitWindowEvent())!"
  EndSelect
  
  Select EventType
    Case #PB_EventType_LeftButtonDown
      Debug "mouse left (with eventtype...!)"
  EndSelect        
  
Until Event = #PB_Event_CloseWindow
With some of my applications (map editor, 2D painting), I need event : #WM_LBUTTONDOWN , #WM_LBUTTONUp, and so (right, mousemove, wheel...), but they aren't crossplatform.

Re: Event mouse (#PB_Event_leftButtonUp and so)

Posted: Fri Jul 10, 2015 11:59 am
by Shardik
[blendman] wrote:I know eventType, but they need special gadget (#pb_EventType_LeftButtondown need canvas for example)
Therefore I also wrote:
Shardik wrote:But the actual problem is that these event types still have to be implemented cross-platform in many of PB's gadgets ...
You are right in that the CanvasGadget is the best supported gadget regarding #PB_EventType_*.

But there are also 3 mouse event constants defined as window events:
#PB_Event_LeftClick
#PB_Event_LeftDoubleClick
#PB_Event_RightClick

If you change #WM_LBUTTONDOWN in your example against #PB_Event_LeftClick, you will also receive the debug message "mouse left (with WaitWindowEvent())!". But I think you are more interested in detecting whether a mouse button is down or released in a window and this is currently not possible without API...

Re: Event mouse (#PB_Event_leftButtonUp and so)

Posted: Sat Jul 11, 2015 7:49 am
by [blendman]
Hi

Thank you for your answer.

Yes, those event are interesting.
It seems that #PB_Event_LeftClick = #PB_EventType_LeftButtonUp
And I need #PB_EventType_LeftButtonDown, and other events like mousemove, wheel ;).
(I use #PB_Event_LeftDoubleClick in my application)