[Resolved] Mouse Event Problem

The goal is simple: on mouse2, perform an action. The problem is also simple: mouse2 won’t pass an event. I have absolutely no idea what could be wrong. Just before it, I have mouse1 pass an event, and it works flawlessly. I tried narrowing down the problem area to my self-made collision detection method, but was stunned to find that it wasn’t my method that was the problem at all. I changed the mouse2 command to a method which simply printed “Right Clicked,” and nothing printed upon pressing mouse2. I’ve even tried replacing “mouse2” with “mouse3” in case mouse2 was the only one not being read, and still nothing happened. Mouse1 seems to be the only one being detected. But wheel_up and wheel_down work as well.

self.accept("mouse1", self.collisionCheck, ['target'])
self.accept("mouse2", self.collisionCheck, ['action'])

I’ve tried looking for a solution in the manual and forums, but alas I’ve found nothing. Is there a Panda3D setting or something of the sort that causes mouse2 and mouse3 to be ignored? I can’t imagine why there would be, but I’m at wit’s end here.

self.accept("mouse3-up", self.switchFunction)

works for me.
using 1.5.3 pro-rsofts build, dep package under ubuntu 8.04

Well, now, this is odd. I previously tried swapping the mouse1 and mouse2 events with mouse1-up and mouse2-up, and still mouse2 didn’t work. You mentioned mouse3-up as working. So I went back to mouse1 and mouse2, but duplicated the command for mouse2 into mouse3-up, and for some reason it worked! All the mouse events registered. I reverted mouse3-up back, and mouse2 stopped working again. I commented out the mouse3-up event entirely, but still mouse2 didn’t work. So I’ve concluded that mouse3-up, for some seemingly paranormal reason, has to do something in order for mouse2 to work. Faulty logic? I would have thought so, too. I’m still toying with it to see if I can find out exactly what’s going on here; why mouse3-up would have anything to do with mouse2 at all.

Edit: After some tinkering, I’ve found that it’s not just mouse3-up that allows mouse2 to work, but also mouse3. I isolated mouse3-up to ensure that commenting one event out would still work, and it did. Then I isolated mouse3, giving it the same command as mouse2, and mouse2 was able to function. Now, if my command would have anything to do with specific mouse events, then I’d be less surprised–I’d have something wrong. But remember that I tested this with a simple print method. I just tried commenting mouse2 and using only mouse3, but it’s giving the same result it did before. Why are mouse2 and mouse3 depending on each other?

Hey, Thomas, you said you have 1.5.3 up and running, right? I’ll probably upgrade to it in a bit, but are you able to reproduce this dependency between mouse2 and mouse3? I know you said mouse3-up worked for you, but isolating it (by commenting out mouse2, mouse2-up and mouse3) didn’t work for me. I’m wondering if it has to do with 1.5.2.

mouse 2 usualy is the middle mouse button. mouse3 the right one. at least on my OS. mouse 2 usualy can be found by pressing the wheel down.

Aha. You replied while I was editing my post. I’ve never heard of mouse2 being bound to the wheel. In all my experience, I’ve seen that referred to mouse3, while mouse2 would refer to the right mouse button. That’s very interesting. Note: I’ve always run on Windows. That could be the reason for the difference.

Edit: Well, would you look at that? The mouse2 event really does work with the middle mouse button. Hey, thank you for letting me know about that. Ha! I can now look back on this whole thing and laugh at my ignorance. I’ve been sitting here testing the wrong button for each one. I’m still intrigued by this concept of mouse2 being middle mouse button. The way I’ve always understood it was that mice would have two primary buttons and a nice little added ‘button’ with the addition of a wheel.

i dont think it was modified recently. so it should not really matter what version you’r using. my code works on both, windows and linux the same way. … or i didnt really notice a difference :wink: after all panda should behave the same on all OS-es, so it simply might be an “uncommon” mapping for you.

I know this is years old, but my gosh - couldn’t that have been in the manual? In a time when mice had only two buttons (if at all) mouse2 was of course the right button. For me this mapping is also very uncommon and I thought panda does not accept the right mouse button…

1 Like