Autor Beitrag
FSS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: Do 15.06.06 17:24 
Hallo,

kurze Frage:
Ich habe eine FileListBox un einen Button. Wenn man auf den Button drückt soll die Bezeichnung des in der FileList gerade markierten Eintrags in einer Variablen gespeichert werden.
Ungefähr so:

ausblenden Delphi-Quelltext
1:
Variable := {markierter Eintrag};					


Wie kann ich dem Programm jetzt sagen, dass es die Bezeichnung des gerade angewählten Eintrages speichern sol?

FSS
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Do 15.06.06 17:28 
Habe noch nicht damit gearbeitet, aber schaue dir mal die Eigenschaft 'ItemIndex' der FileListBox an. Diese gibt den Index des ausgewählten Eintrags zurück.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Christian R.
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 15.06.06 18:00 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click
          (Sender :TObject);
begin
  if Self.FileListBox1.ItemIndex >-1 then
    Variable :=Self.FileListBox1.Items.Strings[Self.FileListBox1.ItemIndex];
  { Ist ItemIndex =-1, bedeutet es das nichts ausgewählt ist.
    Der erste Eintrag hat den Index 0.
    Würdest du das nicht berücksichtigen, löst Du in diesem
    Fall eine Exeption (Fehlermeldung) aus, da nichts ausge-
    wähltes auch keine Bezeichnung hat. }

end;


Viel Spaß noch.
FSS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: Do 15.06.06 18:07 
Ok, das von Neurologic Scientist funktioniert wunderbar!

Vielen Dank!
Christian R.
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 15.06.06 18:14 
Sehr gern wieder.