Topic: Secondary tGrid Row Focus

https://s1.postimg.org/4t0wpbpm7z/zzzzz_Temp65.png


As illustrated on the image above;
Same products tGrid on FORM1 used on frmProducts with less fields.
On click of edit button (ShowRecord) I like it to focus on selected row as in FORM1 tGrid on frmProducts tGrid too. In this case "Door Bell" row.
Is this possible, if so how.


Please see the attached sample project if needed

Post's attachments

Attachment icon Secodary Grid Row Focus.zip 5.14 kb, 326 downloads since 2017-10-12 

Adam
God... please help me become the person my dog thinks I am.

Re: Secondary tGrid Row Focus

Hi Adam,
Probably the most straightforward way (in other words, the one I prefer - LOL!) would be as per the attachment.
However, this will only work if the two tablegrids are sorted in the same sequence (in your example, as they are both basically the same, I can't imagine that they wouldn't be).
Hope this helps,
Derek

Post's attachments

Attachment icon Secodary Grid Row Focus.zip 337.84 kb, 366 downloads since 2017-10-12 

Re: Secondary tGrid Row Focus

Hi Derek,


Thank you very much.....


I haven't seen you around here for few days. I hope all things are OK at your end.


I was wandering if it is possible to do it by using something unique such as code column or record ID, in order to avoid the issue when each table is sorted differently as you mentioned?

Adam
God... please help me become the person my dog thinks I am.

Re: Secondary tGrid Row Focus

In order to avoid sorting issue (when both tGrids are not sorted in the same sequence) I have added a line to Derek's one but didn't work:

procedure frmProduct_OnShow (Sender: string; Action: string);
begin
  frmproduct.tgprodproducts.selectedRow := form1.tgmainprod.selectedrow; // Derek
  frmproduct.tgprodproducts.sortedColumn := form1.tgmainprod.sortedColumn;
end;

Perhaps it needs record ID or rowID added but I cannot construct it correctly

procedure frmProduct_OnShow (Sender: string; Action: string);
begin
  frmproduct.tgprodproducts.selectedRow + RecodID := form1.tgmainprod.selectedrow + RecodID ; 
end;

Dmitry, could you please help?
Please see post #1 on this thread/topic

Adam
God... please help me become the person my dog thinks I am.

Re: Secondary tGrid Row Focus

procedure frmProduct_OnShow (Sender: string; Action: string);
begin
    if Action = 'ShowRecord' then
    begin
        frmProduct.tgProdProducts.dbItemID := Form1.tgMainProd.dbItemID;
        frmProduct.tgProdProducts.ScrollToRow(frmProduct.tgProdProducts.SelectedRow);
    end;
end;
Dmitry.

Re: Secondary tGrid Row Focus

Thank you very much Dmitry..........................
Truly appreciated.................................

Adam
God... please help me become the person my dog thinks I am.