Page 1 of 1
TeeGrid OnTap
Posted: Mon Sep 25, 2023 1:16 am
by 18696547
How can I work with the const Point: TPointF to determine the row that was tapped?
I am trying to change the selected row when the user taps the grid.
TIA
Re: TeeGrid OnTap
Posted: Sun Oct 08, 2023 12:54 am
by 18696547
Really would like a reply to this. It has me stumped.
Re: TeeGrid OnTap
Posted: Mon Oct 09, 2023 4:18 pm
by Marc
Hello,
Apologies for the delay with the reply. The detail for the information required is found via:
Code: Select all
var myColumn : TColumn;
myRow : Integer;
myX; myY: Integer;
begin
//myX := x
//myY := y
myColumn := TeeGrid1.Columns.FindAt(myX,TeeGrid1.Width);
myRow := TeeGrid1.Rows.RowAt(myY,TeeGrid1.Height);
ShowMessage ('Col: ' + IntToStr(myColumn.ID) + ' Row: ' + IntToStr(myRow));
end;
That could source from the x,y of a mousedown/up or the Point of a Tap but we're delayed on getting to the test for the tap.
Regards,
Marc
Re: TeeGrid OnTap
Posted: Mon Oct 09, 2023 11:37 pm
by 18696547
Thanks mcuh! I'll try it out tonight.
Re: TeeGrid OnTap
Posted: Tue Oct 10, 2023 2:07 am
by 18696547
This worked very well:
Code: Select all
procedure TFudleyMain.TeeGrid1Tap(Sender: TObject; const Point: TPointF);
var
myRow : Integer;
myX, myY: single;
hgt : single;
begin
myX := point.X;
myY := point.Y;
hgt := TeeGrid1.Height;
myRow := TeeGrid1.Rows.RowAt(myY,hgt);
TeeGrid1.Selected.Row :=myRow;
end;
Re: TeeGrid OnTap
Posted: Tue Oct 10, 2023 4:28 pm
by Marc
Great, thanks for the feedback.
Re: TeeGrid OnTap
Posted: Wed Oct 11, 2023 10:27 pm
by 18696547
Unfortunately TeeGrid1.Rows.RowAt only works to row 7. Past that it returns -1, even though there are several rows past that.
Re: TeeGrid OnTap
Posted: Fri Oct 13, 2023 7:09 pm
by 18696547
I should clarify what I am trying to do.
This is for mobile only. I would like the user to be able to tap on the row they want to move to, and the selected row/record becomes the one tapped on.
Any help you can offer is appreciated.
Re: TeeGrid OnTap
Posted: Tue Oct 17, 2023 1:57 pm
by 18696547
So is this a bug?
Re: TeeGrid OnTap
Posted: Thu Oct 26, 2023 11:10 am
by Marc
Hello,
I've tried it in the CellEditors project (FMX on Windows) with the following co-ordinates;
Code: Select all
procedure TFormCellEditors.Button1Click(Sender: TObject);
var myColumn : TColumn;
myRow : Integer;
begin
myColumn := TeeGrid1.Columns.FindAt(160,TeeGrid1.Width);
myRow := TeeGrid1.Rows.RowAt(218,TeeGrid1.Height);
and it returns correctly, column 2, row 9.
It may be a problem limited to Tap. What mobile devices have you tried?
With thanks.
Regards,
Marc Meumann
Re: TeeGrid OnTap
Posted: Fri Oct 27, 2023 3:15 am
by 18696547
Hi Marc,
I'm using a Galaxy S10E.
-garry
Re: TeeGrid OnTap
Posted: Mon Nov 13, 2023 11:45 am
by 18696547
Amy ideas on this?
Re: TeeGrid OnTap
Posted: Fri Nov 17, 2023 6:15 am
by 18696547
I've attached a small screen shot.
You can see the selected row, and also a light blue rectangle around the cell I just tapped on. So teegrid knows I tapped there since it painted the light blue rectangle, but its just not moving the selection.
Hope this provides a clue to what's happening. I really need this to work, as users on android will expect a tap to change the selection .
Thanks much!
Re: TeeGrid OnTap
Posted: Mon Dec 04, 2023 3:57 pm
by Marc
Hello Garry,
Apologies that you're not getting a quick answer for this. Resource time is being assigned to the issue and hopefully we can get some feedback to you very soon.
Regards,
Marc
Re: TeeGrid OnTap
Posted: Mon Dec 04, 2023 8:24 pm
by Marc
Hello Garry,
This is still checking out ok on tests on a mobile device. In this case a Realme 6 on Android 11.
I can make the test project available if you think it may be useful. It runs 10,000 lines and marks the selected row as an arrow at row beginning. I put a label in to confirm the selected row.
It reports badly only for the last row on a visible screen where the row is not complete. In this case it returns a -1.
Using RAD Studio 12 with TeeGrid v1.14.
Apologies once again for taking so long to get here.
Regards,
Marc