Page 1 of 1
How can i capture the Mouse Position on screen ?
Posted: Fri Aug 07, 2009 12:39 pm
by ConvertFromOldNGs
by Thai Nguyen >> Mon, 13 Sep 2004 8:32:51 GMT
Dear all,
Which method can we use to capture the mouse position on the screen (x & y ) ?
Thanks,
Thai
Re: How can i capture the Mouse Position on screen ?
Posted: Fri Aug 07, 2009 12:39 pm
by ConvertFromOldNGs
by
johnmunro >> Mon, 13 Sep 2004 8:49:44 GMT
create the following external function
getCursorPos(lpPoint : Point output) : Integer is GetCursorPos in user32;
and here is an example of usage
vars
point : Point;
begin
call getCursorPos(point);
write point;
end;
--
John Munro
FileVision UK Ltd.
The Bioscience Innovation Centre
Cowley Road, Cambridge, UK
CB4 0DS
Telephone: +44 (0) 1223 478200
Fax: +44 (0) 1223 477969
Email:
john.munro@filevision.com
Web:
http://www.filevision.com
The contents of this communication are confidential and are only intended to be read by the addressee. We apologize if you receive this communication in error and ask that you contact FileVision UK Ltd. immediately to arrange for its return. The use of any information contained in this communication by an unauthorized person is strictly prohibited. FileVision UK Ltd. cannot accept responsibility for the accuracy or completeness of this communication as it is being transmitted over a public network. If you suspect this message may have been intercepted or amended, please inform FileVision UK Ltd.
Re: How can i capture the Mouse Position on screen ?
Posted: Fri Aug 07, 2009 12:40 pm
by ConvertFromOldNGs
by
Thai Nguyen >> Tue, 14 Sep 2004 8:42:06 GMT
Thanks John for your help.
I was just wondering how to show a form at the cursor on the screen.
Let me try it.
Re: How can i capture the Mouse Position on screen ?
Posted: Fri Aug 07, 2009 12:40 pm
by ConvertFromOldNGs
by Patwos >> Wed, 15 Sep 2004 13:01:48 GMT
In response to what action will you show the form?
eg: If you want to show a form as a result of a mouseDown operation, then you can already get the cursor position via the information passed into the mouseDown method. For example, the code below pops up a menu when you right mouse click say a table control using the mouse cursor position at the time of the right mouse click: __________________________________________________
tblResults_mouseDown(table: Table input; button: Integer; shift: Integer; x: Real; y: Real) updating;
vars
popupX, popupY : Real;
row, column : Integer;
begin
if button = 2 then
// Copy the passed in parameters relative
// to the table control so we can adjust to the
// appropriate values for popupMenu
popupX := x;
popupY := y;
// Now convert them to relative screen position
table.windowToScreen(
popupX,
popupY
);
// Now convert them relative to the form where
// we want to popup the menu
self.screenToWindow(
popupX,
popupY
);
// Now popup the menu
self.popupMenu(
mnuTablePopup,
popupX.Integer,
popupY.Integer
);
endif;
endif;
end;
__________________________________________________
Hope that helps,
Pat.
Re: How can i capture the Mouse Position on screen ?
Posted: Fri Aug 07, 2009 12:40 pm
by ConvertFromOldNGs
by Thai Nguyen >> Thu, 16 Sep 2004 3:18:48 GMT
Yeah, that's great.
Thanks, Pat.
Thai
Re: How can i capture the Mouse Position on screen ?
Posted: Fri Aug 07, 2009 12:40 pm
by ConvertFromOldNGs
by Patwos >> Mon, 13 Sep 2004 10:10:15 GMT
While John has already given you an answer using Windows API calls, I guess the question then becomes why do you want to identify this information as that may alter whether you want to go down this path or choose some alternative option.
ie: What are you trying to achieve that requires you to determine the mouse x,y co-ordinates?
Pat.
Re: How can i capture the Mouse Position on screen ?
Posted: Fri Aug 07, 2009 12:40 pm
by ConvertFromOldNGs
by cnwjhp1 >> Thu, 16 Sep 2004 3:26:16 GMT
The mouseMove event methods also return x and y.
Cheers,
John P