Autor Beitrag
Robert
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: So 18.08.02 23:34 
Hi! Wie fügt man denn zu Items in einer Treeview Icons hinzu?
Wenn ich eine ImageList erstelle und dort Bilder hinein tu, dann nimmt die Treeview beim Erstellen eines Items immer das erste Icon.
Was kann ich tun?

_________________
MfG
Robert
Deykin11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 19.08.02 01:02 
ausblenden Quelltext
1:
2:
3:
myTreeNode := Treeview.Items.Add(nil,'Knotenname');
myTreeNode.Imageindex := 0; //Icon des Knotens im Normalzustand
myTreeNode.selectedindex := 1; //Icon des Knotens im selektierten Zustand


Wenn sich der Knoten beim anlkicken nicht verändern soll, musst Du bei selectedindex eben den gleichen index eingeben wie bei Imageindex.
Robert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Mo 19.08.02 14:06 
Titel: Danke
Danke! Funst einwandfrei!

_________________
MfG
Robert
Robert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Mo 19.08.02 15:49 
Titel: noch ne Frage:
Hi! Eine Frage ergibt sich noch für mich.
Ist es möglich bei bei manchen Nodes Bildchen anzuzeigen, und bei manchen keine Bildchen anzuzeigen?
Wenn ich schreibe
ausblenden Quelltext
1:
myTreeNode.Imageindex := -1;					

wird ein weißes Icon angezeigt.

_________________
MfG
Robert
Deykin11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 19.08.02 18:24 
GUte Frage?

Aber wenn er ein weißes Icon anzeigt und derHintergrund im TreeView auch weiß ist sieht es ja so aus als wär kein Icon da...
Robert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Mo 19.08.02 20:58 
Titel: Nee, leider net
Nein, eben nicht. die Schrift ist dann um 16 Pixel nach rechts eingerückt.

_________________
MfG
Robert
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 19.08.02 22:59 
Titel: Re: Nee, leider net
Robert hat folgendes geschrieben:
Nein, eben nicht. die Schrift ist dann um 16 Pixel nach rechts eingerückt.
Anders würde es doch auch optische nicht gut aussehen, oder?
Robert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 20.08.02 00:14 
Titel: neja
Hi! Probier's doch mal so aus, wie ich es geschrieben hab. Dann bist du bestimmt gleicher Meinung.
Das sieht blöd aus. :evil:

_________________
MfG
Robert
Deykin11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Di 20.08.02 00:18 
Aber warum willst Du überhaupt, dass kein Symbol angezeigt wird?

Such oder erstell Dir doch ein Icon das zu zu Deinem Eintrag passt...
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Di 20.08.02 01:04 
Titel: Re: neja
Robert hat folgendes geschrieben:
Hi! Probier's doch mal so aus, wie ich es geschrieben hab
Habe ich... sonst hätte ich nicht geantwortet.
Robert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 20.08.02 09:10 
Titel: gibts keins
Hi! Also gut: Was für ein Icon kann man für Ausgaben von Zeitschriften verwenden? 16 * 16 Pixel !
Für alles andere habe ich ja ein Icon. Aber dafür fällt mir nichts ein.

_________________
MfG
Robert
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Di 20.08.02 09:20 
Hab Dir gerade ein kleines Bitmap zugeschickt!

Gruß
TINO
Robert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 20.08.02 09:32 
Titel: danke!
Hi! Das Icon ist super! :D
Es sagt zwar überhaupt nichts aus, ist aber ein super Platzfüller!
Danke!

_________________
MfG
Robert
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Di 20.08.02 09:58 
Titel: Re: danke!
Robert hat folgendes geschrieben:
Es sagt zwar überhaupt nichts aus
Ähä?!?! Das ist ein Buch. Sollte man doch erkennen können, oder? Aber egal!

Gruß
TINO
Robert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Di 20.08.02 10:03 
Titel: ja, ja
Dass das ein Buch ist erkennt ein Blinder :wink: !
Ich meinte, dass man daran nicht erkennt, dass das für eine Ausgabe steht.
Für den Punkt Zeitschrift habe ich die Zeitschrifticons die immer auf der CD von denen sind; für CD habe ich ein Icon mit einer CD; für Programm habe ich das übliche Installieren-Icon (mit Softwarepaket und PC).
Nur beim Buch erkennt man halt nicht was es bedeuten soll.

Aber ich denke das hast du richtig erkannt mit:
Zitat:
Aber egal!

_________________
MfG
Robert
Robert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: So 25.08.02 23:40 
Titel: speichern?
Hi!
Ich hab noch mal eine Frage: Wie speichert man die Icons denn ab? Wenn ich die Treeview erneut lade, dann haben alle Nodes das Icon 0 der ImageList.

_________________
MfG
Robert
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 26.08.02 09:21 
Robert hat folgendes geschrieben:
Wie speichert man die Icons denn ab? Wenn ich die Treeview erneut lade, dann haben alle Nodes das Icon 0 der ImageList.

Hast Du die Icons in einer ImageList gepackt reicht es beim speichern der TreeView neben der Captions der Items auch noch die Image Nummer (Selectiert, nicht selektiert) mit zu speichern und beim laden halt mit einlesen und den Items den gelesenen Wert zuweisen.

Gruß
TINO
Robert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Mo 26.08.02 12:39 
Hi! Ja, die Bilder sind in einer ImageList. Könntest du mir das bitte noch mal irgendwie erklären? Versteh ich nicht, was du meinst.

_________________
MfG
Robert
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 26.08.02 13:10 
HI Robert,

Du hast ja geschrieben
Robert hat folgendes geschrieben:
Wenn ich die Treeview erneut lade

das heißt ja das Du schon eine Lade-Routine geschrieben hast. Daneben wirst Du auch wohl eine Speichern-Routine geschrieben haben. Diese Routinen müsstest Du so erweitern das diese neben dem Caption Wert der Items auch noch den ImgeIndex Wert laden/speichern.

Gruß
TINO
Robert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Mo 26.08.02 13:14 
Hi! Also:


Laden: TreeView1.LoadFromFile(Dateiname);

Speichern:TreeView1.SaveToFile(Dateiname);

_________________
MfG
Robert