jahlxx Posted December 13, 2017 Share Posted December 13, 2017 Hi. When a user click the mouse, how can I know the coordinates of the point where he clicked? Is possible? Thanks, Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2017 Share Posted December 13, 2017 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, Quote Link to comment Share on other sites More sharing options...
jahlxx Posted December 13, 2017 Author Share Posted December 13, 2017 Yes, I'm trying it. But, it seems that always, the position is top / left of the page in the web browser Quote Link to comment Share on other sites More sharing options...
irigsoft Posted December 13, 2017 Share Posted December 13, 2017 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 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2017 Share Posted December 13, 2017 Yes, I'm trying it. But, it seems that always, the position is top / left of the page in the web browser No, it works correctly, how and where, to which object the mousedown handler is assigned? Quote Link to comment Share on other sites More sharing options...
jahlxx Posted December 13, 2017 Author Share Posted December 13, 2017 a toolbutton Enviado desde mi SM-A500FU mediante Tapatalk Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 14, 2017 Share Posted December 14, 2017 Hi, a toolbutton Sorry, I couldn't reproduce this issue, please make a testcase Quote Link to comment Share on other sites More sharing options...
jahlxx Posted December 14, 2017 Author Share Posted December 14, 2017 ok. I'll try thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.