Trouble with DirectGUI and suppressMouse

I’m getting a weird problem here. I have an input class that monitors input and listens for events. One of the primary functions here is to figure out how to interpret mouse clicks so I have event-functions for left-click down, left-click up, etc. etc.

I also have buttons that need to be in the environment. When I select an object in the 3D (render scenegraph) space, I have functions that load up specific buttons on the screen related to that object. The problem that I’m having is that when I click a directbutton in the 2D scene graph (parented to render2d) the global input class is interpreting the left-click-up as a deselect command in the 3D environment.

Basically “suppressMouse = True” isn’t working and I have no idea why.

Here’s the code for the button creation:

methodname = '_icon' + str(count)  
method = getattr(self,methodname)	
buttonmap = loader.loadModel('models/Overlay/'+item+'/model.egg')

icon = DirectButton(geom = (buttonmap.find('**/native'), buttonmap.find('**/rollover'), buttonmap.find('**/clicked'), buttonmap.find('**/disabled')), borderWidth = (0,0), frameColor = (0,0,0,0), rolloverSound = None, clickSound = None, scale = .2, command = method, suppressMouse = True, pos = (base.camLens.getAspectRatio()*.1*count,0,-.75))

icon.reparentTo(prime2d)

As described in this thread: https://discourse.panda3d.org/viewtopic.php?t=5068, suppressMouse only suppresses the “down” events, not the “up” events. So listen for left-click down, not up.

David

Thanks for the response. I had already looked through the post you linked.

This answers part of my question, the trouble is that I need to listen to both mouse down and up events as I have drag boxes as part of my program for selecting multiple nodes. The click up is the termination of the drag box and so it’s necessary to have an event trigger at that point.

I can probably program in a work-around.

Sure. The workaround should be simple: set a flag on button-down. On receipt of button-up, don’t do anything unless the flag is set. (Then clear the flag.)

David

precisely what I did- works great.

Thanks.