Solved

form with anywhere drag properties

Posted on 2002-04-24
6
160 Views
Last Modified: 2010-04-04
How can I create a form that I can click and drag anywhere on it's surface, not just on the caption bar?
Thanks,
Paul
0
Comment
Question by:annas
6 Comments
 
LVL 5

Accepted Solution

by:
Gwena earned 100 total points
ID: 6967064
Hi :-)

  For easy questions always try this delphi search

sitehttp://www.jounlai.com/3kdt/index.cgi


Here is a link to the info you need... I got it from the search page :-)


http://delphi.about.com/library/weekly/aa061300a.htm


There were a bunch more links... just search using 'drag'

0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 6967334
I use :

procedure TForm1.MouseDown(...);
begin
  ReleaseCapture;
  SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
end;

the idea is to 'trick' the window we're holding it by it's caption bar
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6967792
well, my version

unit moving_whole_form_u;

interface

uses
 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 StdCtrls;

type
 TForm1 = class(TForm)
   CheckBox1: TCheckBox;
 private
   procedure WMNCHitTest(var Message : TWMNCHitTest); message WM_NCHITTEST;
 public
   { Public declarations }
 end;

var
 Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMNCHitTest(var Message : TWMNCHitTest);
begin
 inherited;
 if checkbox1.checked then  //Moving Toggle on/off check
   if message.result = HTCLIENT then //client-area
     message.result := HTCAPTION;  //do so if the caption is clicked
end;

end.


meikl ;-)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 6967793
gwena's second link is a good one :-)
0
 

Author Comment

by:annas
ID: 6967848
Yes that Worked Thanks Gwena and thanx for the search sitre!
Paul :)
0
 
LVL 5

Expert Comment

by:Gwena
ID: 6968753
Your welcome annas :-)

That search site has helped me out a lot!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

943 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

Need Help in Real-Time?

Connect with top rated Experts

3 Experts available now in Live!

Get 1:1 Help Now