CDialog and Mouse clicks
-
What is the best way to detect if a user presses the L button down and releases it within a specified region on a dialog? The way I'm considering doing it is to use the OnLButtonDown and OnLButtonUp methods and set a bool flag when the user presses down whilst within this region and when they release the mouse to check this flag and then check if they are still in the region. Is this the best/recommended way of doing it or is there better more effient ways? TIA,
-
What is the best way to detect if a user presses the L button down and releases it within a specified region on a dialog? The way I'm considering doing it is to use the OnLButtonDown and OnLButtonUp methods and set a bool flag when the user presses down whilst within this region and when they release the mouse to check this flag and then check if they are still in the region. Is this the best/recommended way of doing it or is there better more effient ways? TIA,
-
What is the best way to detect if a user presses the L button down and releases it within a specified region on a dialog? The way I'm considering doing it is to use the OnLButtonDown and OnLButtonUp methods and set a bool flag when the user presses down whilst within this region and when they release the mouse to check this flag and then check if they are still in the region. Is this the best/recommended way of doing it or is there better more effient ways? TIA,
Detect a LButtonDown over the region, capture the mouse when this happens, and then wait for the LButtonUp message. If the LBU is over the region, react. Watch out for things like (De)activate and/or kill focus messages - if the user switches apps while holding down the mouse button, you will need to release the capture. The reason you do not want to just react to LBU is that the user could click and hold the mouse button down, and then drag it over to your app and release. This happens a lot by accident and you would not want to react to that accident. Try that with a standard button control and you will see what I mean. Peace!
-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles