Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi TListview und Columns[0].Width, ist bin ratlos ... (https://www.delphipraxis.net/37106-tlistview-und-columns%5B0%5D-width-ist-bin-ratlos.html)

jensw_2000 31. Dez 2004 01:44


TListview und Columns[0].Width, ist bin ratlos ...
 
Liste der Anhänge anzeigen (Anzahl: 1)
Ich fummel jetzt schon stundenlang an einem Listview herum und bin mit meinen Ideen am Ende ...

Ich erstelle zur Laufzeit ein paar Listitems, und obwohl Listview.columns[0].width = 400 ist, werden die längeren Items abgekürzt ...

Schaut Euch mal bitte erstmal flink das Bild im Attachment an ...

Die Items erstelle ich wir folgt ...

Code:
  lvGroupMembers.Items.BeginUpdate;
 
  Data.tbl_Users.first;

  While not Data.tbl_Users.eof do
  begin
   
    WITH lvGroupMembers.Items.Add DO
    BEGIN
      Caption:=Data.tbl_Users.fieldByName('Fullname').asstring +' ('+
               Data.tbl_Users.fieldByName('LoginName').asstring +')'
      checked:=true;
      ImageIndex:=3;
      Subitems.Add(Data.tbl_Users.fieldByName('ID').asstring);
    END;   // with
   
    Data.tbl_Users.Next;
     
  END;   // while

  Resultlistview.Items.EndUpdate;
Nach dem hinzufügen von BeginUpdate und EndUpdate dachte ich schon ich hätte das Problem gelöst,
aber Fehlanzeige.
Nachdem ich aus einem anderen (gleich strukturiertem) Listview ein paar Items in lvGroupMembers "kopiert" habe, hat TListview die neu hinzugrfügten (längeren) Items wieder abgekürzt ...

Das Kopieren mache ich so ...

Code:
function ShowCheckListPopup(DialogCaption: STRING;ID_AgentGroups:Variant; ResultListview:TListview): TModalresult;
var
  I: Integer;
begin
  Result := mrCancel;

  CheckListPopup := TCheckListPopup.Create(NIL);

  CheckListPopup.ID_AgentGroups:=ID_AgentGroups;
  CheckListPopup.CheckListPopup.Caption:=DialogCaption;
  if CheckListPopup.ShowModal = mrOk then
  begin
    Result := mrOk;
  end;

  Resultlistview.Items.BeginUpdate;

  FOR I := 0 TO CheckListPopup.lvNonMembers.Items.Count - 1 DO  
  BEGIN
    IF CheckListPopup.lvNonMembers.Items[i].Checked THEN
    WITH ResultListview.Items.Add DO
    BEGIN
      Caption:=CheckListPopup.lvNonMembers.Items[i].Caption;
      Subitems.Add(CheckListPopup.lvNonMembers.Items[i].Subitems[0]);
      checked:=true;
      ImageIndex:=3;
    END;   // with
  END;   // for

  Resultlistview.Items.EndUpdate;

  FreeAndNil(CheckListPopup);

end;
Der Funktionsaufruf..

Code:
CheckListPopupform.showCheckListPopup('Agents zur Gruppe "'+activeGroup_Name+'" hinzufügen',activeGroup_ID,lvGroupMembers);
Aus Verzweifelung habe ich mal testweise weise columns[0].width mit in die Item-Caption geschrieben ..

Code:
lvGroupMembers.items[n].capition:=inttostr(lvGroupMembers.columns[0].width)+' '+CheckListPopup.lvNonMembers.Items[i].Caption;
Die Caption wird so ausgegeben ... "400 Beate Warkentin ..." :wall:
Die gesamte Caption (400 Beate Warkentin (BW)" ) ist unabgekürtz rund 100 Pixel lang ... :wall:

Warum macht TListview so einen Quatsch und wie kann ich das verhindern ? :gruebel:
Soll ich letzten Endes das Teil auf eine Scrollbox setzen und die Column 5000 Pixel breit machen ? :roll:

Zur Vollständigkeit ...
lvGroupMembers.columns[1].width habe ich auf MaxWidth:=15 und Width:=1 gesetzt ...





Ich habe echt keine Idee mehr !
HILFEEE :!:


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:54 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz