Autor Beitrag
schitho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 288

XP Home SP2
D2005 Prof
BeitragVerfasst: Do 10.03.05 01:08 
Hi,

verwende ein Listview und wollte nun auch in der 2. Spalte ein Icon in jeder Zeile anzeigen lassen.

Hab es so probiert:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
// Ergänze eine Zeile in Listview
procedure ItemAddToLV (s1,s2 : string);
var
  ListItem: TListItem;
begin
  ListItem := Form1.ListView1.Items.Add;
  ListItem.Caption := s1;
  ListItem.SubItems.Add(s2);
  ListItem.ImageIndex:=-1;
  ListItem.SubItemImages[0]:=1;
end;


In ListView1 hab ich unter SmallImages meine ImageList eingetragen.

Trotzdem erscheint meine Icon nicht.

Woran liegt das?

Gruß
Thomas

PS: In der ersten Spalte wird auch noch eine Checkbox angezeigt.

_________________
(Sorry! Leider ewiger Delphi-Neuling)
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Do 10.03.05 07:57 
Warum setzt du ItemIndex auf -1?
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 10.03.05 10:08 
Es kann nur in der ersten Zeile ein Icon angezeigt werden.
schitho Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 288

XP Home SP2
D2005 Prof
BeitragVerfasst: Do 10.03.05 22:00 
user profile iconwdbee hat folgendes geschrieben:
Warum setzt du ItemIndex auf -1?

ItemIndex? Ich setze ImageIndex auf -1, damit in der ersten Spalte kein Icon angezeigt wird.

user profile iconTino hat folgendes geschrieben:
Es kann nur in der ersten Zeile ein Icon angezeigt werden.

Zeile?

Oder meinst Du Spalte?

Wenn Du Spalte meinst, dann versteh ich nicht warum es SubItemImages gibt.

Gruß
Thomas

_________________
(Sorry! Leider ewiger Delphi-Neuling)
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Do 10.03.05 22:31 
Hallo,

das geht bei mir:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
var
  ListItem: TListItem;
begin
  ListITem := ListView1.Items.Add;
  ListItem.Caption := 'test';
  ListItem.SubItems.Add('spalte2');
  ListITem.SubItemImages[0] := 1;
//  ListItem.ImageIndex := 0;  //Ist auch egal, gerade getestet...
Nur noch die Liste den SmallImages zuweisen und ViewStyle auf vsReport stellen.
Ansonsten machst du ja auch nix anderes :?.

GRuß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
schitho Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 288

XP Home SP2
D2005 Prof
BeitragVerfasst: Do 10.03.05 23:26 
In der Kombination mit Checkboxes=true funktionieren die Icons nur mehr in Spalte 1.

In Spalte 2 werden keine Icons mehr angezeigt.

Ein Bug???? :shock:

Gibt es dafür eine Lösung?

Gruß
Thomas

_________________
(Sorry! Leider ewiger Delphi-Neuling)
Nico80
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39

WIN XP
DELPHI 2006
BeitragVerfasst: Mi 26.07.06 15:48 
Möchte das Thema nochmal aufgreifen, da ich das gleiche Problem habe.
Oder gibt es einen Alternative, außer in der 1. Spalte statt Checkboxen ein Bild aus der Imageliste zu nehmen