Board index » delphi » Converting X,Y coords to Col, Row

Converting X,Y coords to Col, Row

Hello!

In my OnDragOver event (and OnDragDrop) I need to know the Col and Row number
of the X/Y coords.
I can't seem to get it right.
Does anyone have some fancy routine that returns the Col,Row numbers. Keep in
mind that I use scrolling also.

--
Jacob Pedersen
AK Techotel
J.Peder...@techotel.dk

procedure TF3F5Tavle.sgF3F5DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin

 

Re:Converting X,Y coords to Col, Row


procedure TForm1.GridDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
  with (Sender as TCustomGrid).MouseCoord (X, Y) do
    caption := format ('%d:%d', [X, Y]);
end;

Quote
Jacob Pedersen wrote:
> Hello!

> In my OnDragOver event (and OnDragDrop) I need to know the Col and Row number
> of the X/Y coords.
> I can't seem to get it right.
> Does anyone have some fancy routine that returns the Col,Row numbers. Keep in
> mind that I use scrolling also.

> --
> Jacob Pedersen
> AK Techotel
> J.Peder...@techotel.dk

> procedure TF3F5Tavle.sgF3F5DragOver(Sender, Source: TObject; X, Y: Integer;
> State: TDragState; var Accept: Boolean);
> begin

--
========================================
Berend Veldkamp
Visit our web site: http://www.geodan.nl
========================================

Re:Converting X,Y coords to Col, Row


Quote
> In my OnDragOver event (and OnDragDrop) I need to
> know the Col and Row number of the X/Y coords.

Which component are you using? If a grid, use MouseToCell. You may also need
to use ScreenToClient.
--
Rick Rogers (TeamB)
www.componentfactory.com

Re:Converting X,Y coords to Col, Row


r...@fenestra.com (Rick Rogers (TeamB)) wrote in
<806jfu$rt...@forums.borland.com>:

Quote
>> In my OnDragOver event (and OnDragDrop) I need to
>> know the Col and Row number of the X/Y coords.

>Which component are you using? If a grid, use MouseToCell. You may also need
>to use ScreenToClient.
>--
>Rick Rogers (TeamB)
>www.componentfactory.com

Oups.. Sorry, just a regular TStringGrid :)

--
Jacob Pedersen
AK Techotel
J.Peder...@techotel.dk

Other Threads