TeeGrid OnTap

TeeGrid VCL / FMX for Embarcadero RAD Studio, Delphi, C++ Builder and Lazarus Free Pascal.
Post Reply
TheOtherPrefontaine
Newbie
Newbie
Posts: 17
Joined: Tue Aug 22, 2023 12:00 am

TeeGrid OnTap

Post by TheOtherPrefontaine » Mon Sep 25, 2023 1:16 am

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

TheOtherPrefontaine
Newbie
Newbie
Posts: 17
Joined: Tue Aug 22, 2023 12:00 am

Re: TeeGrid OnTap

Post by TheOtherPrefontaine » Sun Oct 08, 2023 12:54 am

Really would like a reply to this. It has me stumped.

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TeeGrid OnTap

Post by Marc » Mon Oct 09, 2023 4:18 pm

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
Steema Support

TheOtherPrefontaine
Newbie
Newbie
Posts: 17
Joined: Tue Aug 22, 2023 12:00 am

Re: TeeGrid OnTap

Post by TheOtherPrefontaine » Mon Oct 09, 2023 11:37 pm

Thanks mcuh! I'll try it out tonight.

TheOtherPrefontaine
Newbie
Newbie
Posts: 17
Joined: Tue Aug 22, 2023 12:00 am

Re: TeeGrid OnTap

Post by TheOtherPrefontaine » Tue Oct 10, 2023 2:07 am

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;

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TeeGrid OnTap

Post by Marc » Tue Oct 10, 2023 4:28 pm

Great, thanks for the feedback.

TheOtherPrefontaine
Newbie
Newbie
Posts: 17
Joined: Tue Aug 22, 2023 12:00 am

Re: TeeGrid OnTap

Post by TheOtherPrefontaine » Wed Oct 11, 2023 10:27 pm

Unfortunately TeeGrid1.Rows.RowAt only works to row 7. Past that it returns -1, even though there are several rows past that.

TheOtherPrefontaine
Newbie
Newbie
Posts: 17
Joined: Tue Aug 22, 2023 12:00 am

Re: TeeGrid OnTap

Post by TheOtherPrefontaine » Fri Oct 13, 2023 7:09 pm

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.

TheOtherPrefontaine
Newbie
Newbie
Posts: 17
Joined: Tue Aug 22, 2023 12:00 am

Re: TeeGrid OnTap

Post by TheOtherPrefontaine » Tue Oct 17, 2023 1:57 pm

So is this a bug?

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TeeGrid OnTap

Post by Marc » Thu Oct 26, 2023 11:10 am

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
Steema Support

TheOtherPrefontaine
Newbie
Newbie
Posts: 17
Joined: Tue Aug 22, 2023 12:00 am

Re: TeeGrid OnTap

Post by TheOtherPrefontaine » Fri Oct 27, 2023 3:15 am

Hi Marc,

I'm using a Galaxy S10E.

-garry

TheOtherPrefontaine
Newbie
Newbie
Posts: 17
Joined: Tue Aug 22, 2023 12:00 am

Re: TeeGrid OnTap

Post by TheOtherPrefontaine » Mon Nov 13, 2023 11:45 am

Amy ideas on this?

TheOtherPrefontaine
Newbie
Newbie
Posts: 17
Joined: Tue Aug 22, 2023 12:00 am

Re: TeeGrid OnTap

Post by TheOtherPrefontaine » Fri Nov 17, 2023 6:15 am

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!
Attachments
CutPaste_2023-11-17_00-03-43-486.png
CutPaste_2023-11-17_00-03-43-486.png (130.21 KiB) Viewed 46386 times

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TeeGrid OnTap

Post by Marc » Mon Dec 04, 2023 3:57 pm

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
Steema Support

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TeeGrid OnTap

Post by Marc » Mon Dec 04, 2023 8:24 pm

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
Steema Support

Post Reply