Page 1 of 1

Move focus to selected cell

Posted: Tue Feb 18, 2020 7:51 am
by hung10ngoc
Please kindly advise how to move focus to the selected cell.

E.g. when set the 'A50' in the cell name and Enter, the display will show the A50 cell.

Thank you in advance for your help!

Re: Move focus to selected cell

Posted: Wed Feb 19, 2020 3:15 am
by hung10ngoc
Solution is:

XSS.SetCursorPos(SheetIndex, 0, 49);

Re: Move focus to selected cell

Posted: Wed Feb 19, 2020 12:18 pm
by hung10ngoc
App will show properly if moving focus forward, means from cell with low address to higher one, for example A1 -> BC10. However, when going backward the display is not expected: Cursor moves to correct address but screen remains the same.

I am thinking of going back to A1 cell, refresh the sheet and move focus to the desired one in the case we have to move backward.

Any idea is really appreciated and thankful.

Re: Move focus to selected cell

Posted: Thu Feb 20, 2020 9:02 am
by larsa
Hello

Use:

Code: Select all

  FXSS.XLS[0].SelectedAreas.CursorCell(5,5);

Re: Move focus to selected cell

Posted: Thu Feb 20, 2020 11:03 am
by hung10ngoc
Hi Lars,

Thank you for your reply but unfortunately, it still does not work.

You can try yourself with the 'XLSSpreadSheetAdvanced.dproj' sample.

Re: Move focus to selected cell

Posted: Thu Feb 20, 2020 12:23 pm
by larsa
Hello

You must also call

Code: Select all

FXSS.Invalidate;
in order to make changes visible.

Re: Move focus to selected cell

Posted: Fri Feb 21, 2020 1:06 am
by hung10ngoc
Dear Lars,

I have tried your suggestion but the result still keeps unexpected for backward focus changing.

Call FXSS.InvalidateAndReloadSheet, tests with/without data have the same results.

Please kindly advise.

Re: Move focus to selected cell

Posted: Tue Mar 03, 2020 4:00 am
by hung10ngoc
After trying many attempts, the solution is so simple:

FXSS.Read;

Re: Move focus to selected cell

Posted: Mon Nov 22, 2021 6:42 pm
by hugvis
Hi
Anything descriped here does not works here in Delphi 10.3.3
How is possible to move visually the focus and corresponding frame to a given cell and move worksheet in sight if it outsite visible area ?
Rg.

Re: Move focus to selected cell

Posted: Thu Nov 25, 2021 10:10 pm
by larsa
Hello

This question is about TXLSSpreadSheet and not TXLSGrid, which is a toy compared to TXLSSpreadSheet.