I want to get a mouse down event (“mouse1”) on a DirectFrame (or button, I don’t really care). I’m trying to make it so I can drag things around on screen. It all works, but I can’t get what button was clicked, unless I start the drag on mouse up with a command.
I know how to have a button command do off when the mouse is released, and I know how to get a mouse down even for the window.
Do I have to mess with my MouseWatcher directly or is there some trick I’m missing?
Also, I noticed DirectButton’s clickable area is a simply axis aligned rectangular bounding box, which is pretty bad when they are rotated. I’m going to be drawing lines somehow (I was thinking DirectFrames), and it would be handy if they were clickable, but the clickable area would be way off. Is there an easy fix/workaround for this?
You provided exactly what I needed despite the confusion. Thanks!
I needed self.frame.bind(DGG.B1PRESS,self.startDrag)
I was unaware of the bind method. I can now drag my frames around.
I’m still looking for a fix for the clickable areas. It seems like one could use the button’s matrix to transform the click position and check if its truly over the button, and I can do this, but it does not solve the whole issue because diagonal buttons on top would capture large areas of clicks preventing clicks that should hit buttons that are behind them.