Solved

Disable mouse events while maximizing/minimizing

Posted on 2004-08-19
3
229 Views
Last Modified: 2010-04-05
I use the OnMouseDown, OnMouseMove and OnMouseUp events to draw lines on a TImage. If I maximize/minimize the form it happens that an OnMouseMove event is fired without a corresponding OnMouseDown etc.
Is there a way to disable the events before resizing and enable them after resizing has finished?

Thanks!
0
Comment
Question by:__alex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Expert Comment

by:Colin_Dawson
ID: 11840317
You could add a little extra code to see if the position of the event is within the canvas of the TImage.  It should have the same effect.
0
 
LVL 7

Accepted Solution

by:
LRHGuy earned 200 total points
ID: 11841627
Here's what worked for me...

tForm2=class...
 private
   fMouseOK:boolean;
...

procedure TForm2.FormCreate(Sender: TObject);
begin
  fmouseok:=true;
end;

procedure TForm2.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if fmouseok then begin
   // do work here
  end;
  fmouseok:=true;
end;

procedure TForm2.WMSize(var Message: TWMSize);
begin
  fMouseOK:=false;
  inherited;
end;


By using a "flag" to control when the mouse move is valid...by necessity, the mouse "moves" when the window resizing, at least the coordinates relative to the form. the WMsize turns off the mouse move...at the end of the resize, the mouse is "moved", and we turn it back on after the first call. Works here!
0
 
LVL 2

Author Comment

by:__alex
ID: 11849648
Awesome, thanks!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month3 days, 13 hours left to enroll

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question