Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Drag of mouse while left button is pressed.
Re: Drag of mouse while left button is pressed. [message #27639 is a reply to message #27628] Tue, 27 July 2010 12:11 Go to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
The code you want is something like:
void LeftDown(Point p, dword keyflags)
{
   SetCapture(); 
   // All mouse events are now directed to this ctrl until ReleaseCapture is called
}

void MouseMovePoint p, dword keyflags)
{
   if (HasCapture())
      // Left mouse is depressed
   else
      // No button pressed
}

void LeftDown(Point p, dword keyflags)
{
   ReleaseCapture(); 
}

There are loads of other ways of doing it, but this is the cleanest for simple behaviour. You can also use LeftHold/LeftDrag but they have a slight delay before being triggered.
 
Read Message
Read Message
Read Message
Previous Topic: How to compare child in function virtual void ChildMouseEvent with ctrl’s value.
Next Topic: How to adjust the height of an InfoCtrl frame’s height.
Goto Forum:
  


Current Time: Sun Jun 22 15:59:10 CEST 2025

Total time taken to generate the page: 0.04272 seconds