EventMouseButton not working!!!!

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

I can't get the EventMouseButton command working.

Regarding the manual, it must be placed after a WaitWindowEvent.

I tested it with the following code. But it's not working.

Can someone help me


result = EventMouseButton()
if result =1 ; mousebutton 1 pressed
MessageRequester("","Left Button Pressed",#PB_MessageRequester_Ok)
Endif



Registered user of PB

C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Manolo.
I can't get the EventMouseButton command working.

Regarding the manual, it must be placed after a WaitWindowEvent.

I tested it with the following code. But it's not working.

Can someone help me


result = EventMouseButton()
if result =1 ; mousebutton 1 pressed
MessageRequester("","Left Button Pressed",#PB_MessageRequester_Ok)
Endif



Registered user of PB

C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
Please, check you previus post.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

You gave an example for a keyboard, not for Mouseevents

EventMouseButton doesn't seems to work



Registered user of PB

C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

Look at the code , with this I want to check for mouseevents
but nothing seems to work.

Repeat

Select WaitWindowEvent()

Case #PB_EventMenu

Case #PB_EventRepaint
; redraw()

Case #WM_CLOSE ; #PB_EventCloseWindow
Quit = 1
;
I want somthing like this, but i cannot find it anywhere
Case #PB_MOUSEDOWN
MessageRequester("","Left button pressed",#PB_MessageRequester_Ok)

Case #WM_KEYDOWN


EndIf

EndSelect

Until Quit = 1


Registered user of PB

C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.
I want somthing like this, but i cannot find it anywhere
Case #PB_MOUSEDOWN
MessageRequester("","Left button pressed",#PB_MessageRequester_Ok)
You were close: use #WM_LBUTTONDOWN (and #WM_RBUTTONDOWN/#WM_MBUTTONDOWN).
Check out the Gadgets.pb file in your Examples/Sources folder for good
examples on interacting with gadgets.


PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

Thanks,

That kind of information is what I want in the manual of PB.

It takes hours to get information like this.

I just found a site about api constants.

For the mousevents I have found the following:

WM_LBUTTONDBLCLK
WM_LBUTTONDOWN
WM_LBUTTONUP
WM_MBUTTONDBLCLK
WM_MBUTTONDOWN
WM_MBUTTONUP
WM_MOUSEMOVE
WM_RBUTTONDBLCLK
WM_RBUTTONDOWN
WM_RBUTTONUP

More of that you can find at:

http://www.vbapi.com/ref/msgc.html#windows



Registered user of PB

C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

Ups, suppose I'm too late:

Code: Select all

 
If OpenWindow(0, 200, 200, 320, 240, #PB_Window_SystemMenu, "Mouse Event Test")
  Repeat
    Event = WaitWindowEvent()
    If Event = 513 ;left mouse button
        MessageRequester("Mouse Event", "Left Mouse Button",0)
    EndIf
    If Event = 519 ;middle mouse button
        MessageRequester("Mouse Event", "Middle Mouse Button",0)
    EndIf
    If Event = 516 ;right mouse button
        MessageRequester("Mouse Event", "Left Mouse Button",0)
    EndIf
  Until Event = 16 ; #PB_EventCloseWindow
EndIf

Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Paul.

These are not PB constants though... they are Windows API constants.
Why not do what everyone else does and download the excellent API Guide and API Viewer from http://www.allapi.net/

Everything your are asking is in there!! (including VB examples that convert easily into PB)
Post Reply