Recent

Author Topic: [Closed] FPSpreadsheetGrid question on results of moving cells  (Read 1075 times)

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
[Closed] FPSpreadsheetGrid question on results of moving cells
« on: January 27, 2022, 11:33:22 pm »
Hi,

I'm trying to use a FPSpreadsheetGrid, but when I enter a value into a cell and then press an arrow key or use the mouse to select anopther cell, the value in the cell I've just left (the one I entered the vale into) is null.
E.g.
I type 'hello' into Cells[1,1] and then press right arrow and in the OnSelectCell routine I check the value of Cells[1,1] and its null. This happens with all the arrow keys, the tab key and if I select another cell with the mouse.
However, if I use the return key it work, i.e I enter the hello intp Cells[1,1] and press return, it moves cells according to AutoAdvance and the OnSelectCell event shows that Cells[1,1] has the correct value, hello.

Is this the correct behaviour and ifit is how to I force Cells[1,1] to take the value?

Thanks
Dave

[Edit: If I use OnSelection rather than OnSelectCell it works as expected - guess I'm not clear about the difference, but assume that OnSelectCell is before the cell is actually selected and the therefore before the previous cell is finsihed doing everything it needs to do]
« Last Edit: January 28, 2022, 12:52:58 am by daveinhull »
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

wp

  • Hero Member
  • *****
  • Posts: 9598
Re: FPSpreadsheetGrid question on results of moving cells
« Reply #1 on: January 28, 2022, 12:23:14 am »
I can reproduce this. TCustomGrid from which the WorksheetGrid descends behaves correctly.

I can weakly remember that it was quite tricky to check the syntactic correctness of formulas before a cell is left and had to fight a lot to get it working. Probably this is where this bug came in. I tend not to fix it because I am rather sure that it will break something somewhere else.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
Re: FPSpreadsheetGrid question on results of moving cells
« Reply #2 on: January 28, 2022, 12:44:39 am »
Thanks wp,

I can work around this by using OnSelection, which does show the true value of the old cell when I enter a new cell, rather than onSelectCell.

Dave
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

 

TinyPortal © 2005-2018