Solved

form with anywhere drag properties

Posted on 2002-04-24
6
159 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

9 Experts available now in Live!

Get 1:1 Help Now