Gin Beginner 0 Posted 11 hours ago TlistView (and TJvlistView) - Subitems line in 255 characters. Is there a way to get around this restriction? Dynamically I fill in the SubItems of 670 characters, but the line turns out only 255 characters :(. unit Unit1; interface uses //Winapi.Windows, //Winapi.Messages, System.SysUtils, // IntToStr, FreeAndNil Vcl.Controls, // alClient Vcl.Forms, CommCtrl, // for LVSCW_AUTOSIZE ComCtrls; // for TListView type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; ListView1: TListView; ListItem1: TListItem; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin form1.Height := 115; form1.Width := 350; form1.Position := poScreenCenter; form1.Caption := 'Subitems[2] in 255 characters'; ListView1 := TListView.Create(Self); with ListView1 do begin Parent := Self; Align := alClient; ViewStyle := vsReport; BorderWidth := 2; GridLines := true; end; with ListView1.Columns do begin Add.Caption := 'Line № '; Add.Caption := 'Error '; Add.Caption := 'String '; end; try ListView1.Items.BeginUpdate; ListItem1 := ListView1.Items.Add; ListItem1.Caption := '22421 '; ListItem1.SubItems.Add('All Columns ' + IntToStr(ListView1.Columns.Count)); ListItem1.SubItems.Add('<RHINOSTRING English="Exploding this mesh will create %d individual meshes. This may be more than your system can safely manage using the available memory. You can use Weld to make the mesh explode into fewer pieces, or see Help for more information.\n\nClick OK to proceed with Explode, or Cancel to leave the mesh as is.[[24836]]" Localized="Exploding this mesh will create %d individual meshes. This may be more than your system can safely manage using the available memory. You can use Weld to make the mesh explode into fewer pieces, or see Help for more information.\n\nClick OK to proceed with Explode, or Cancel to leave the mesh as is.[[24836]]" />'); //uses CommCtrl; ListView1.Columns[0].Width := {LVSCW_AUTOSIZE or} LVSCW_AUTOSIZE_USEHEADER; ListView1.Columns[1].Width := {LVSCW_AUTOSIZE or} LVSCW_AUTOSIZE_USEHEADER; ListView1.Columns[2].Width := LVSCW_AUTOSIZE {or LVSCW_AUTOSIZE_USEHEADER}; finally ListView1.Items.EndUpdate; end; end; procedure TForm1.FormDestroy(Sender: TObject); begin FreeAndNil(ListView1); end; end. Share this post Link to post
aehimself 404 Posted 5 hours ago The caption isn't truncated, only the display is clipped: procedure TForm1.FormCreate(Sender: TObject); Const MYTEXT = '<RHINOSTRING English="Exploding this mesh will create %d individual meshes. This may be more than your system can safely manage using the available memory. You can use Weld to make the mesh explode into fewer pieces, or see Help for more information.\n\nClick OK to proceed with Explode, or Cancel to leave the mesh as is.[[24836]]" Localized="Exploding this mesh will create %d individual meshes. This may be more than your system can safely manage using the available memory. You can use Weld to make the mesh explode into fewer pieces, or see Help for more information.\n\nClick OK to proceed with Explode, or Cancel to leave the mesh as is.[[24836]]" />'; begin ListView1.Items.Add.Caption := MYTEXT; ShowMessage(MYTEXT.Length.ToString + sLineBreak + ListView1.Items[0].Caption.Length.ToString); end; Shows 661 and 661 respectively. The reason seems to be a WinApi limitation: https://stackoverflow.com/questions/19881409/tlistview-add-600-characters-on-item-caption Share this post Link to post