Recent

Author Topic: Form with no Mouse.CursorPos functionality available.  (Read 1301 times)

SA.Blackmon

  • New Member
  • *
  • Posts: 37
  • Just an old retired guy practicing what he enjoys.
Form with no Mouse.CursorPos functionality available.
« 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.)
Thank you for your help,
Sherril

jamie

  • Hero Member
  • *****
  • Posts: 5024
Re: Form with no Mouse.CursorPos functionality available.
« Reply #1 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.
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018