Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-01

Need help with TValueListEditor

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Hans-Peter Diettrich

Where can I find sample code for this control?

I want to initialize the content with key/value pairs in code, track changes and/or save the content in OnExit when Modified. Here I ran into any number of quirks and bugs :-(

E.g. the code does not check properly for I<0 in various methods, after subtracting the number of fixed rows/cols, resulting in list index exceptions.

When the user edits the fields, Modified seems to be set only when a new key is added, but not when a value is changed?

DoDi

Reply by email

Howard Page-Clark
to Hans-Peter Diettrich
Hans-Peter Diettrich wrote 12 lines
Where can I find sample code for this control? I want to initialize the content with key/value pairs in code, track changes and/or save the content in OnExit when Modified. Here I ran into any number of quirks and bugs :-( E.g. the code does not check properly for I<0 in various methods, after subtracting the number of fixed rows/cols, resulting in list index exceptions. When the user edits the fields, Modified seems to be set only when a new key is added, but not when a value is changed?

Indeed, if you drop a memo and valueListEditor on Form1 and add two buttons named btnCopyMemoToValueList and btnCopyValueListToMemo with the following event handlers you can see one of the bugs immediately:

procedure TForm1.FormCreate(Sender: TObject);
begin
   ValueListEditor1.Strings.Text :=
   'one=1'+LineEnding+'two=2'+LineEnding+'three=3'+LineEnding+'four=4';
  memo1.Lines.Text :=
'Afghanistan=Kabul'+LineEnding+'Albania=Tirane'+LineEnding+'Algeria=Algiers'+
   LineEnding+'Angola=Luanda'+LineEnding+'Armenia=Yerevan'+LineEnding+
'Australia=Canberra'+LineEnding+'Austria=Vienna'+'Azerbaijan=Baku'+LineEnding;
end;
procedure TForm1.btnCopyMemoToValueListClick(Sender: TObject);
begin
   ValueListEditor1.Strings.Assign(Memo1.Lines);
   ValueListEditor1.Invalidate;
end;
procedure TForm1.btnCopyValueListToMemoClick(Sender: TObject);
begin
   Memo1.Lines.Assign(ValueListEditor1.Strings);
   Memo1.Invalidate;
end;

Perhaps no one has used this component before (I hadn't) to see that it is rather buggy?

Reply by email

Mattias Gaertner
to Howard Page-Clark
Show quoted text 43 lines
On 14/1/12 5:59, Hans-Peter Diettrich wrote: > Where can I find sample code for this control? > > I want to initialize the content with key/value pairs in code, track > changes and/or save the content in OnExit when Modified. Here I ran into > any number of quirks and bugs :-( > > E.g. the code does not check properly for I<0 in various methods, after > subtracting the number of fixed rows/cols, resulting in list index > exceptions. > > When the user edits the fields, Modified seems to be set only when a new > key is added, but not when a value is changed? Indeed, if you drop a memo and valueListEditor on Form1 and add two buttons named btnCopyMemoToValueList and btnCopyValueListToMemo with the following event handlers you can see one of the bugs immediately: procedure TForm1.FormCreate(Sender: TObject); begin ValueListEditor1.Strings.Text := 'one=1'+LineEnding+'two=2'+LineEnding+'three=3'+LineEnding+'four=4'; memo1.Lines.Text := 'Afghanistan=Kabul'+LineEnding+'Albania=Tirane'+LineEnding+'Algeria=Algiers'+ LineEnding+'Angola=Luanda'+LineEnding+'Armenia=Yerevan'+LineEnding+ 'Australia=Canberra'+LineEnding+'Austria=Vienna'+'Azerbaijan=Baku'+LineEnding; end; procedure TForm1.btnCopyMemoToValueListClick(Sender: TObject); begin ValueListEditor1.Strings.Assign(Memo1.Lines); ValueListEditor1.Invalidate; end; procedure TForm1.btnCopyValueListToMemoClick(Sender: TObject); begin Memo1.Lines.Assign(ValueListEditor1.Strings); Memo1.Invalidate; end; Perhaps no one has used this component before (I hadn't) to see that it is rather buggy?

Please create a bug report with a small example project (only sources).

Mattias

Reply by email