I've had this sorta problem before, what you need to do is keep track of the mouse position, like, x / y and oldx oldy. then you move the button according to the difference between the two. Hope that helps
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Nate Lovallo Sent: Thursday, June 27, 2002 3:33 PM To: [EMAIL PROTECTED] Subject: [hlcoders] More Drag and Drop vgui Probs Ok, ive basically got it working, but theres 2 problems. 1. The button lags behind my mouse, and ofter the cursor leaves the button when you drag it. For now im just makig it stop dragging if this happens, but Id really like to make it catch upto the mouse. 2. Everytime first time cursorMoved gets called after mouePressed, it sets the buttons position to the middle of the screen here is my code: void CHandler_DragIt:: mousePressed(MouseCode code,Panel* panel) { panel->getApp()->getCursorPos(mousex,mousey); m_bDragging = true; m_pCommandButton->getPos(m_iaDragStart[0],m_iaDragStart[1]); ConsolePrint( "mousedown\n" ); } void CHandler_DragIt::mouseReleased(MouseCode code,Panel* panel) { ConsolePrint( "mouseup\n" ); m_bDragging = false; App::getInstance()->setMouseCapture(null);//??? } void CHandler_DragIt::cursorMoved(int x,int y,Panel* panel) { if(m_bDragging) { char sz[32]; panel->getApp()->getCursorPos(x,y); m_pCommandButton->setPos((x-m_iaDragStart[0]),(y-m_iaDragStart[1])); sprintf (sz, " %d , %d\n", (x-m_iaDragStart[0]), (y-m_iaDragStart[1])); ConsolePrint(sz); } } Cheers Inbeastic _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

