Fujio Posted June 2, 2021 Share Posted June 2, 2021 In a TUniStringGrid with a 100x100 cell and a display area of 10x10, how can I display the cell with Row=50 and Col=50 in the upper left corner when I press the button? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 2, 2021 Share Posted June 2, 2021 3 hours ago, Fujio said: In a TUniStringGrid with a 100x100 cell and a display area of 10x10, how can I display the cell with Row=50 and Col=50 in the upper left corner when I press the button? Hello, This is not what you wanted, but a close solution for your case: procedure TMainForm.UniButton1Click(Sender: TObject); begin with UniStringGrid1 do begin Col := 50; Row := 50; JSInterface.JSCode('Ext.select("#"+'#1'.id+" .x-grid-cell-selected").elements[0].scrollIntoView();') end; end; Quote Link to comment Share on other sites More sharing options...
Fujio Posted June 3, 2021 Author Share Posted June 3, 2021 Thank you. I tried it, but the cells with Row=50 and Col=50 are displayed in the upper right corner, not the upper left. I wrote the following code, and immediately after execution it is 1.png and after pressing the button it is 2.png. procedure TMainForm.UniButton2Click(Sender: TObject); begin UniStringGrid1.Row:=50; UniStringGrid1.Col:=50; UniStringGrid1.JSInterface.JSCode('Ext.select("#"+'#1'.id+" .x-grid-cell-selected").elements[0].scrollIntoView();') end; procedure TMainForm.UniFormCreate(Sender: TObject); var i,j:Integer; begin for i := 0 to 99 do begin UniStringGrid1.Columns[i].Title.Caption:=IntToStr(i); for j := 0 to 99 do begin UniStringGrid1.Cells[j,i]:=IntToStr(j)+','+IntToStr(i); end; end; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 3, 2021 Share Posted June 3, 2021 Hello, 2 hours ago, Fujio said: I tried it, but the cells with Row=50 and Col=50 are displayed in the upper right corner, not the upper left. Yes, I know. 2 hours ago, Fujio said: I wrote the following code... So, is it OK for you? Quote Link to comment Share on other sites More sharing options...
Fujio Posted June 3, 2021 Author Share Posted June 3, 2021 Hello, >This is not what you wanted, but a close solution for your case: I overlooked this. I'll see if I can't get it to be upper left somehow. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 3, 2021 Share Posted June 3, 2021 12 minutes ago, Fujio said: I'll see if I can't get it to be upper left somehow. I will check too. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 3, 2021 Share Posted June 3, 2021 4 hours ago, Fujio said: I'll see if I can't get it to be upper left somehow. Did some tests... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.