Recent

Author Topic: [Unsolved: Not Fixable ]DrawGrid.MouseCoord reports wrong values.  (Read 2031 times)

jamie

  • Hero Member
  • *****
  • Posts: 6131
Maybe I got off the banana boat to early, but reading the help in Delphi clearly tells me
that
 DrawGrid.MouseCoord(X,Y) = APoint which in turn reports the ROW,COL the mouse is
hovering over.
  The Delphi help clearly states "Screen Coordinates" however, It only works using
Client Coordinates.

 The Online Delphi help is clear about this, my old D3 help file is also just as clear however,
the help that comes with lazarus on the subject appears the be cloudy on it's description and clearly wrong if I read it correctly?

"Find the mouse coordinates relative to the grid origin"

I know the help file isn't up to date that comes with the down load package but still
never the less the function is only operating with Client mouse X,Y not screen?

 This is with 1.8.0,  on windows, I do not know if 1.6.4 works correctly or not...

« Last Edit: December 31, 2017, 08:28:22 pm by jamie »
The only true wisdom is knowing you know nothing

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: DrawGrid.MouseCoord reports wrong values.
« Reply #1 on: December 30, 2017, 12:03:55 am »
Hi, this code
Code: Pascal  [Select][+][-]
  1. procedure TForm1.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  2. var aGC: TGridCoord;
  3. begin
  4.   aGC:=StringGrid1.MouseCoord(X, Y);
  5.   writeln('R C ', aGC.x, ' ', aGC.y);
  6. end;
gives the same results in Lazarus 1.9 and Delphi7. Maybe the Delphi docs is inaccurate.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

jamie

  • Hero Member
  • *****
  • Posts: 6131
[Solved as unfixable}Re: DrawGrid.MouseCoord reports wrong values.
« Reply #2 on: December 30, 2017, 02:05:03 am »
I have another theory and that is:

 Its was suppose to do as they say but, by the time it was caught I would be guessing there
was lots of software out there using as is because with my D3 there is no MouseToCell
method but the MouseCoord does exist.

 It only makes perfect sense to have a method like that to capture the cell from other controls
and in my case, I was using a TPopUpMenu, taking the Mouse.CursorPos in one of the menuitems
to detect what cell the pointer is hovering over..

 Using the MouseMove in the Grid is find if you want to use the MouseToCell method but if you
are in the Menu control and you need to know what cell  your pointer is on, the "MouseCoord"
is an attractive method because its documented to do exactly what I needed and most likely
was designed to do so originally.

 I guess you could say it is a documented error but if that being the case all they had to do was fix the docs, which they didn't...

 oh well, I'll close it as unsolved, I used the Old way of obtaining it.

 So now we have two different methods doing the Exact same thing.. How quaint.
« Last Edit: December 30, 2017, 09:15:37 pm by jamie »
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018