[Lazarus] Need help with TValueListEditor
Mattias Gaertner
nc-gaertnma at netcologne.de
Wed Jan 18 18:52:19 CET 2012
On Sat, 14 Jan 2012 20:03:14 +0000
Howard Page-Clark <hdpc at talktalk.net> wrote:
> 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
More information about the Lazarus
mailing list