[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Reading X,Y-pos while moving Form

Posted on 2000-02-16
11
Medium Priority
?
165 Views
Last Modified: 2010-04-04
I'm trying to get the windows X,Y pos while moving the form.
The movement is initiated through performing wm_syscommand.
Like this:  form.Perform(WM_Syscommand,$F012,0);

I tried Using the WM_WindowPosChanging Message to read the pos, but i can't figure it out.

Any help appreciated

Raidos
0
Comment
Question by:raidos
[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
  • 2
  • 2
  • +3
11 Comments
 
LVL 3

Expert Comment

by:ckaneta
ID: 2528509
here's a hint, when you move a form it gets repainted, too
0
 
LVL 6

Expert Comment

by:edey
ID: 2528558
or you could trap the WM_MOVING message

GL
Mike
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2528578
Here it is:

type
  TForm1 = class(TForm)
  private
    { Private declarations }
    procedure Move(var Message: TWMChar); message WM_MOVE;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Move(var Message: TWMChar);
begin
  Caption := IntToStr(Left);
//  Caption := IntToStr(Top);
end;
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:edey
ID: 2528603
note, WM_MOVE is fired *after* the window has moved

GL
Mike
0
 
LVL 3

Author Comment

by:raidos
ID: 2528643
Hmm, thanks for your comments.

Allthough this is not really what i'm looking for.
I need to read the pos of the forms Outline that
gets displayed while moving the form

0
 
LVL 3

Expert Comment

by:bryan7
ID: 2528667
listenning
0
 
LVL 3

Expert Comment

by:ckaneta
ID: 2528698
question: do you have it set up so a user can only drag from the titlebar or from anywhere on the form?

either way, I guess it would work the same, so here's another idea...
get the mousepos, save the forms top and left positions, and set a flag on an LButton down event, on a if the flag is set when you get a Move message, calculate the outlines top, and left from the forms old top and left from the current position of the mouse.

0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2528785
Ahh... you have 'Show window contents while dragging' turned off.... right?
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 2528797
euhm, why not using the WM_MOVING message?

Thus eventually the same solution as Epsylons, but use WM_MOVING instead of WM_MOVED...

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
  private
    { Private declarations }
  public
    { Public declarations }
  protected

 procedure FormMoving(var MSG : TMessage); message WM_MOVING ;

  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormMoving(var Msg: TMessage);
begin
  inherited;
  showmessage('New form position : '+inttostr(left)+','+inttostr(top));

end;


end.
0
 
LVL 3

Author Comment

by:raidos
ID: 2528929
Found a solution to my problem
I goes like so:

Procedure WMMoving(Var Message: TMessage);
Var
  Wpos : Prect;
Begin
  WPos := Pointer(Message.LParam);
  If WPos.Left < 10 then Begin
    WPos.Left := 0;
    WPos.Right := Form.Width;
  End;
  Inherited;
End;

Now, how should i post the points?
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 200 total points
ID: 2531755
Just grade it  :o)
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

650 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