Recent

Author Topic: tsworksheet: delete key and readonly property  (Read 1436 times)

kjteng

  • Sr. Member
  • ****
  • Posts: 259
tsworksheet: delete key and readonly property
« on: April 13, 2019, 05:44:16 am »
1.  How do I disable delete key in tsWorksheetGrid ?   Delete key seems not disabled even when the worksheet is protected.
2.  What is the simplest way to make a worksheetgrid read only ? i.e. disallow user to change its content. Currently I am doing it by changing the autoedit and goEditing properties. However this approach cannot prevent e user from erasing cell content by pressing delete key.

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: tsworksheet: delete key and readonly property
« Reply #1 on: April 13, 2019, 11:03:01 am »
1. EL key is disabled when a cell is protected. I guess that there are still other cases like this (e.g. paste from clipboard) which I did not check.

2. Like in a StringGrid, remove goEditing from the Options of the grid?


kjteng

  • Sr. Member
  • ****
  • Posts: 259
Re: tsworksheet: delete key and readonly property
« Reply #2 on: April 13, 2019, 06:08:13 pm »
1. EL key is disabled when a cell is protected. I guess that there are still other cases like this (e.g. paste from clipboard) which I did not check.

2. Like in a StringGrid, remove goEditing from the Options of the grid?

1.
In the latest SVN (r6846), DEL is disabled when worksheet is protected and cell is locked. However, users still can paste with control V.
If I copy the content of an unlocked cell and paste it into a locked cell, the cell would became an unlocked cell. Thus protection  is no longer effective as the users can modify the cell thru this way.

2.
Yes. Remove goEditing from stringgrid1.options will prevent users from editing the stringgrid. However for tsWorksheetGrid, the users still can change the cell content by DEL or control V (past from clipboard) unless the cell is locked AND the worksheet is protected.
« Last Edit: April 13, 2019, 06:17:19 pm by kjteng »

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: tsworksheet: delete key and readonly property
« Reply #3 on: April 13, 2019, 10:28:12 pm »
Try again, should be better now.

With CTRL+V pasting there is a difference to Excel though: Excel can paste in a protected worksheet an unprotected cell to another unprotected cell. In the worksheetgrid of fpspreadsheet this is not possible, no pasting action is allowed at all. This decision was made because the stream written to the clipboard depends on the reader/writer units in the uses clause - if a format is written which does not support protection (e.g. csv, html) then an unprotected cell will be pasted.

 

TinyPortal © 2005-2018