Jump to content

click coordinates


jahlxx

Recommended Posts

Hi,

 

Can you explain a little more ?!

 

Maybe you wanted like this, for example:

procedure TMainForm.UniFormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  ShowMessage(Format('MouseDown: %d,%d', [X, Y]));
end;

Best regards,

Link to comment
Share on other sites

Hi,

Yes it is.

 

example.:

 

procedure ControlDBGridMouseUp (Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
DeltaX,
DeltaY            : Integer;
sParent           : TObject;
begin
  DeltaX := 0;
  DeltaY := 0;
  sParent := Sender;
  while sParent <> nil do begin
       DeltaX := DeltaX + TWinControl (sParent).Left;
       DeltaY := DeltaY + TWinControl (sParent).Top;
       sParent := TWinControl (sParent).Parent;
  end;
 
  crPOS.X := X + DeltaX;
  crPOS.Y := Y + DeltaY;
 
 
  Control.Left := crPOS.X + 5;
  Control.Top := crPOS.Y + 5;

end;

end;

 

Add Control.Parent Top and Left position up to Form.Top;

and coordinates is OK

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...