Lazarus

Programming => LCL => Topic started by: SA.Blackmon on October 17, 2021, 12:27:53 am

Title: Form with no Mouse.CursorPos functionality available.
Post by: SA.Blackmon on October 17, 2021, 12:27:53 am
If I have posted this in the wrong thread, forgive me, I bumble.

I have a form that has several TFrame's (the same repeatedly.)

I need to get the ControlAtPos in order to correctly direct the mouse click; the problem is there is no Mouse.CursorPos available. Mouse.GetMouseX and Mouse.GetMouseY are available but they raise run time errors.

I suspect it is not the TFrame because I created another form, added the TFrame to it and Mouse.CursorPos was available.

I have attached the form's .pp and .lfm files as well as the file with the TFrame.

I really would like to have this code in the TFrame code in order to centralize the code but that has the same problem. 

Thank you in advance.

Sherril

(I cheated; I zipped up the .lfm files for the frame and the form and added them to this post.)
Title: Re: Form with no Mouse.CursorPos functionality available.
Post by: jamie on October 17, 2021, 02:00:56 am
Mouse class is in Controls unit, just include it in the uses list if needed.

It reports the location in screen X,Y, you then need to use the ScreenToClient call to convert it using the parent TWINCONTROL you're plotting on.
TinyPortal © 2005-2018