# Visual Basic > Visual Basic 6 and Earlier >  [RESOLVED] Cairo, Mouse [1] or [2] capture during BubblingEvent?

## -Corso->

Hi Cairo Squad, YAOQ, Yet Another Olaf Question.

How does one check for the button press (Mouse Button 1 or 2) on a widget, during a BubblingEvent?
Like so....

Private Sub W_BubblingEvent(Sender As Object, EventName As String....
If EventName = "W_Click" Or EventName = "W_MouseDown" Then 
-My_Mouse_Button_State = ??????? W.something or other?
--Select case My_Mouse_Button_State

I need to test which mouse button has been struck in this area, or do I need to 'remember the state' via the MouseDown process?

Thank you!

----------


## Schmidt

> How does one check for the button press (Mouse Button 1 or 2) on a widget, during a BubblingEvent?


The Bubbling-Event is a "generic, centralized" EventHandler (which catches *all kind* of Events and EventParameters) -
and therefore we cannot have specifically named Event-*Parameters* (like "Button", "Shift", "x", "y" in case of Mousexxx-Events).

So, that's what the relatively "plain-named" P1,...,P7 Parameter-List of the Bubbling-Event will transport
(in order from left to right - when you count the Event-Parameters/Names of the original EventHandler).

You can always use Debug.Print EventName, P1, P2, P3 inside the BubblingEvent, if you are curious.

Olaf

----------


## -Corso->

So there is no W.Root.GetMouseCursorPos, but for mouse clicks?.... Poooooop.
Debug.print
 0 0 35 13.5 0 0 0
 0 0 34 14.5 0 0 0
 0 0 31 14.5 0 0 0
 0 0 30 14.5 0 0 0
 0 0 28 14.5 0 0 0
 0 0 27 15.5 0 0 0
 0 0 25 15.5 0 0 0
 0 0 24 15.5 0 0 0
 0 0 22 15.5 0 0 0
 0 0 21 15.5 0 0 0
 0 0 20 15.5 0 0 0...
I'm just not feelin' it from these numbers Olaf.  :Confused: 
The 'Class Buttons' I made are good for determining Mouse 1&2.
Basically, on the Inventory Mini List, I wanted to use [Right Click] to close the panel. It works on the panel itself, I coded it into the class buttons, but it doesn't work for a non class button attached to the panel. I tried putting a capture in the MouseDown event to store the Mouse Button state, but it seems to redraw the panel including processing the Right Mouse Click first... Long story short, I wasn't able to beat the Paint function to the punch, it allows the click to occur before it will close the panel.  

So I guess I'll make the 'Take All' button a class button. Which is OK, because that's what all 'text' buttons will be in the future. 

By the way, rather surprised that when you make a General Button, say 'Press Me' and load it into the Cairo List. I made a processing sub that makes said button looked clicked and saved that version into the imagelist as well. Long story short, I only need to draw 1 button to have every other click state, for all buttons, auto-built. That's actually a freaking huge 'wow' in time saving.

----------


## Schmidt

> So there is no W.Root.GetMouseCursorPos, but for mouse clicks?


Well, there is also a W.Root.MouseKeyDown()-Function...
 (which gives you a combination of the current MouseDown-Keys in a Long)

Also the Bubbling-Event can give you the Mouse-Keys 
(when you filter for W_MouseDown/Up-Eventnames):


```
Private Sub Panel_BubblingEvent(Sender As Object, EventName As String, P1, P2, P3, P4, P5, P6, P7)
  Select Case EventName
    Case "W_MouseDown", "W_MouseUp"
         Debug.Print Sender.Widget.Key, EventName, P1, P2, P3, P4
  End Select
End Sub
```

Olaf

----------


## -Corso->

W.Root.MouseKeyDown was the one I needed, thanks Olaf.

----------

