Hi,
i would like to put more than one info into one cell of a TAdvListView so i added +#10+#13 to the strings and set this as a caption. It doen't really work. Is there any way to get that done?
Item.caption := string1 + #10 + #13 + string2;
Regards,
Andy
Hi,
This works as expected here
it := AdvListView1.Items.Add;
it.Caption := 'Line 1' +#13+#10 +'Line 2';
Please provide more information or a sample that is able to reproduce this.
Hmpf .... well ... anything else to do to make it work like this ?
Please send us your complete sample code so we can investigate this here
Hi,
here it is .... it reads data from the db and tries to put it into the LV ... it works but the data remains in one line ....
AnalysisDataModule.ResultDBQuery.First;
while not AnalysisDataModule.ResultDBQuery.Eof do
begin
TempItem := AV2ListView.Items.Add;
TempItem.Caption := AnalysisDataModule.ResultDBQuery.FieldByName('URL').AsString + #10 + #13 + AnalysisDataModule.ResultDBQuery.FieldByName('TITLETAG').AsString;
TempItem.ImageIndex := GetIconIndexFromMIMEType(LowerCase(AnalysisDataModule.ResultDBQuery.FieldByName('MIMETYPE').AsString));
TempItem.ImageIndex := -1;
AnalysisDataModule.ResultDBQuery.Next;
end;
AnalysisDataModule.ResultDBQuery.Close;
That is not giving any information about property settings / event handlers that can affect the TAdvListView behavior.
As stated by Pieter, with a default TAdvListView on the form and the code
it := AdvListView1.Items.Add;
it.Caption := 'Line 1' +#13+#10 +'Line 2';
it does work.
So, please, again, isolate this and provide some sample source code project with which the problem can be reproduced.
Additionally we have tested this here with a default TAdvListView on the form and the following code in the constructor:
var
tbl: TClientDataSet;
ti: TListItem;
begin
//DataSet
tbl := TClientDataSet.Create(Self);
tbl.FieldDefs.Add('Field1', ftString, 255, False);
tbl.FieldDefs.Add('Field2', ftString, 255, False);
tbl.CreateDataSet;
tbl.Open;
tbl.Append;
tbl.FieldByName('Field1').AsString := 'Hello';
tbl.FieldByName('Field2').AsString := 'World !';
tbl.Post;
tbl.First;
while not tbl.Eof do
begin
ti := AdvListView1.Items.Add;
ti.Caption := tbl.FieldByName('Field1').AsString + #10 + #13 + tbl.FieldByName('Field2').AsString;
tbl.Next;
end;
tbl.Close;
tbl.Free;
which outputs the following result:
Seems to be something in the properties or settings i made ... with a fresh sample project everything works great .... so ... a big sorry from here and i will figure out what i did :-)