View Issue Details

IDProjectCategoryView StatusLast Update
0025881LazarusLCLpublic2014-03-31 23:20
ReporterZex Atilla Assigned ToBart Broersma  
Status resolvedResolutionfixed 
Product Version1.2.0 
Fixed in Version1.2.2 
Summary0025881: TValueListEditor.InsertRow function is wrongly designed
DescriptionWhat's the purpose of InsertRow when you can't choose at which index to insert the row? What's the Append parameter? This is completely useless. There should be AddRow function to add to the bottom and InsertRow with an index to choose the insertion point.

Moreover, InsertRow doesn't work in the following case:
1. In design time enter some text in Strings property.
2. At run time call InsertRow('SubHeader', '', TRUE);

This won't add the string. Even if you call ValueListEdit1.Clear before InsertRow, it won't add the string.
TagsNo tags attached.
Fixed in Revisionr44566
Attached Files


Bart Broersma

2014-03-18 18:22

developer   ~0073822

AFAIK InsertRow has the same signature as Delphi's one for TValueListEditor.

Bart Broersma

2014-03-19 13:53

developer   ~0073842

1.Since I cannot check this with Delphi: please tell us how Delphi behaves in this case.
2. For what you want to achieve the InsertRowWithValues() method is probably more convenient.

Zex Atilla

2014-03-28 20:27

reporter   ~0074046

Last edited: 2014-03-28 20:32

View 5 revisions

In Delphi the InsertRow works as expected, adds a key with an empty value. In Lazarus it works too, if I enter "key=value" string in Strings property. The problem is that Lazarus IDE uses TMemo control as the property editor for TValueListEditor.Strings. So one can enter just any string.

In Delphi it's not the case. They don't use TMemo in this case (although in other controls they do). But in this special case, for editing TValueListEditor.Strings they use an instance of TValueListEditor control. Because the Strings property is actually the main data of this control. So it makes sense to use the control itself to edit its main data.

In other words, in Lazarus you can enter just any text for the Strings property. I entered a few ordinary lines, while in fact I had to enter:


I made a mistake, but it's because the editor wasn't very intuitive. In Delphi you can't enter text like that, you must enter Keys and Values each in its column. Much more intuitive.

So, the default editor (TMemo) for TStrings should not be used for editing TValueListEditor.Strings property, because in this case TStrings represent two column list, which is best edited using a TValueListEditor. Unless it's a big trouble in which case never mind.

Bart Broersma

2014-03-28 21:59

developer   ~0074047

To make sure, in Delphi:
 InsertRow('SubHeader', '', TRUE);
inserts the Key 'SubHeader' and Value empty string?
(Easily fixable)

How about
 InsertRow('', 'SubValue', TRUE); ?
Will it insert a row without a key, but with a value?

Zex Atilla

2014-03-31 13:23

reporter   ~0074089

Yes, Delphi added both, the "SubHeader" key with an empty value and an empty key with "SubValue", in proper order.

I made a new test, starting with an empty control and executing the following code (in both Delphi and Lazarus):

  ValueListEditor1.InsertRow('aaaaa', '', TRUE);
  ValueListEditor1.InsertRow('bbbbb', 'ccccc', TRUE);
  ValueListEditor1.InsertRow('', 'ddddd', TRUE);

Delphi correctly adds values and displays them in the order of execution. Lazarus displays data in invalid order and skipping one of the values:


bbbbb ccccc

The middle line is empty. That's the line with value ('', 'ddddd') but for some reason the value was cleared. Also, the order is invalid, because 'ddddd' should be last line, not in the middle.

Juha Manninen

2014-03-31 19:03

developer   ~0074101

> for editing TValueListEditor.Strings they use an instance of TValueListEditor control.

Yes, it should be relatively easy to create and register such a property editor also in Lazarus.

Bart Broersma

2014-03-31 23:20

developer   ~0074108

Please test and close if OK.

Issue History

Date Modified Username Field Change
2014-03-18 11:53 Zex Atilla New Issue
2014-03-18 18:22 Bart Broersma Note Added: 0073822
2014-03-18 18:22 Bart Broersma Assigned To => Bart Broersma
2014-03-18 18:22 Bart Broersma Status new => assigned
2014-03-19 13:53 Bart Broersma LazTarget => -
2014-03-19 13:53 Bart Broersma Note Added: 0073842
2014-03-19 13:53 Bart Broersma Status assigned => feedback
2014-03-28 20:27 Zex Atilla Note Added: 0074046
2014-03-28 20:27 Zex Atilla Status feedback => assigned
2014-03-28 20:30 Zex Atilla Note Edited: 0074046 View Revisions
2014-03-28 20:31 Zex Atilla Note Edited: 0074046 View Revisions
2014-03-28 20:32 Zex Atilla Note Edited: 0074046 View Revisions
2014-03-28 20:32 Zex Atilla Note Edited: 0074046 View Revisions
2014-03-28 21:59 Bart Broersma Note Added: 0074047
2014-03-28 22:00 Bart Broersma Status assigned => feedback
2014-03-31 13:23 Zex Atilla Note Added: 0074089
2014-03-31 13:23 Zex Atilla Status feedback => assigned
2014-03-31 19:03 Juha Manninen Note Added: 0074101
2014-03-31 23:20 Bart Broersma Fixed in Revision => r44566
2014-03-31 23:20 Bart Broersma Note Added: 0074108
2014-03-31 23:20 Bart Broersma Status assigned => resolved
2014-03-31 23:20 Bart Broersma Fixed in Version => 1.2.2
2014-03-31 23:20 Bart Broersma Resolution open => fixed