TValueListEditor: Cell doesn't get updated when Strings is changed under certain conditions
Original Reporter info from Mantis: Bart @flyingsheep
-
Reporter name: Bart Broersma
Original Reporter info from Mantis: Bart @flyingsheep
- Reporter name: Bart Broersma
Description:
If you have a TValueListEditor and have goAlwaysShowEditor in Options, then when (by code) you channge an item of the Strings property, and the item you change is on the current row, then the cell contents of [current col,current row] does not get updated, and will be lost.
Steps to reproduce:
Put a TValueListEditor on a form.
Include goAlwaysShowEditor in Options
Assign items to it's Strings property like e.g.
One=1
Two=2
Three=3
In a buttons onclick do
ValueListEditor1.Strings[0] := 'Five=5';
Build, run, click the button.
Expected result
The first row should read: |Five|5| (| being the column separator)
Observed result
First row reads: |Five|1|
(I'll attach a sample program, when I'm back home again)
Additional information:
This problem also occurred with Strings.Assign, Strings.SetText, Strings.Insert etc.
There I have fixed it by temporarily disabling the goAlwaysShowEditor in overridden InsertItem, Clear and Delete.
That approach however won't work with Strings.Put, because when you type in the grid, the Editor's TextChanged will update the cell, which in turn in TValueListEditor will eventually update the Strings associated with that cell, and Strings.Put is called.
If you disable goAlwaysShowEditor in Strings.Put, the Editor is hidden and then shown again, with the text selected. In effect it behaves as if you can only type 1 character in the control.
Mantis conversion info:
- Mantis ID: 23875
- OS: Window
- OS Build: Win7
- Build: r40253
- Platform: i386
- Version: 1.1 (SVN)
- Fixed in version: 1.1 (SVN)
- Fixed in revision: r40282 (#e233a671)
- Target version: 1.2.0