Autor Beitrag
beshig
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 110
Erhaltene Danke: 1

WIN 2000, WIN XP, WIN 2003, Debian Linux
Delphi 7 Personal, Delphi 2005 Personal
BeitragVerfasst: Sa 09.04.05 14:11 
Leider kam ich über die :lupe:Suchenfunktion:lupe: zu keinem gewünschten Ergebnis und hoffe, diese Frage wurde noch nicht so gestellt:

Ich habe in meinem Programm eine Listbox, welche mehrere " Anklickmöglichkeiten " besitzt. Ich wollte nun versuchen, den Eintrag als String zurückzubekommen, welcher der User auswählte. ( Als String den " angezeigten Wert " im fertigen Programm für den User )
Ich war noch nicht wirklich weit gekommen [...] Mein bisheriges " Ergebnis ":

ausblenden Delphi-Quelltext
1:
temporal := hersteller.Items;					


Mir ist klar, dass ich " Items " ansprechen muss, da dies ja die vordefinierten " Anklickmöglichkeiten " darstellt. Nur ist mir halt nicht klar, wie ich dann weitermachen soll. Die automatische Code - Vervollständigung hilft mir nicht wirklich.

Erklärung des Code - Beispiels:
:arrow: temporal ist eine String - Variable, welche ich nutzen möchte, um das ausgewählte Feld zu speichern.
:arrow: hersteller nennt sich meine TListbox - Kombonente
Danke im Vorraus

_________________
Was ist ein Moderatorenteam in einem recht bekannten Programmierer-Forum ? Viele Meinungen, eine zählt - Mehr ist ja auch nicht notwendig...


Zuletzt bearbeitet von beshig am Sa 09.04.05 14:18, insgesamt 2-mal bearbeitet
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Sa 09.04.05 14:15 
hersteller.ItemIndex; ;)
beshig Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 110
Erhaltene Danke: 1

WIN 2000, WIN XP, WIN 2003, Debian Linux
Delphi 7 Personal, Delphi 2005 Personal
BeitragVerfasst: Sa 09.04.05 14:20 
Ja gut, aber so bekomme ich ja nur, welche Antwort es war (die wie vielte in der Liste).
Wie kann ich jetzt von dieser Zahl auf den String einfach schließen, ohne mit If-Anweisungen jetzt alle Fälle abzuprüfen ?

_________________
Was ist ein Moderatorenteam in einem recht bekannten Programmierer-Forum ? Viele Meinungen, eine zählt - Mehr ist ja auch nicht notwendig...
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 09.04.05 14:35 
ausblenden Delphi-Quelltext
1:
Hersteller.Items[Hersteller.ItemIndex]					

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Sa 09.04.05 14:38 
user profile iconbeshig hat folgendes geschrieben:
Ja gut, aber so bekomme ich ja nur, welche Antwort es war (die wie vielte in der Liste).
Wie kann ich jetzt von dieser Zahl auf den String einfach schließen, ohne mit If-Anweisungen jetzt alle Fälle abzuprüfen ?

So:
ausblenden Delphi-Quelltext
1:
hersteller.Items[hersteller.ItemIndex];					

;)
beshig Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 110
Erhaltene Danke: 1

WIN 2000, WIN XP, WIN 2003, Debian Linux
Delphi 7 Personal, Delphi 2005 Personal
BeitragVerfasst: Sa 09.04.05 14:41 
Danke für eure Hilfe, jetzt gehts endlich :-D

Aber gleich mal noch eine Frage: Ich habe jetzt zum Beispiel folgende Auswahlmöglichkeiten:

"002 Hersteller" und "003 Hersteller".

Wie könnte ich jetzt dies machen, damit bei Übergabe an den String "temporal" nur die Zahl (002 oder 003) übergeben wird ?

_________________
Was ist ein Moderatorenteam in einem recht bekannten Programmierer-Forum ? Viele Meinungen, eine zählt - Mehr ist ja auch nicht notwendig...
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Sa 09.04.05 14:48 
Wenn am Anfang immer drei Zeichen stehen dann nimm doch einfach
ausblenden Delphi-Quelltext
1:
hersteller.Items[hersteller.ItemIndex][1]+hersteller.Items[hersteller.ItemIndex][2]+hersteller.Items[hersteller.ItemIndex][3]					

statt
ausblenden Delphi-Quelltext
1:
hersteller.Items[hersteller.ItemIndex]					
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 09.04.05 14:50 
ausblenden Delphi-Quelltext
1:
Copy(Hersteller.Items[Hersteller.ItemIndex], 1,3);					

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
beshig Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 110
Erhaltene Danke: 1

WIN 2000, WIN XP, WIN 2003, Debian Linux
Delphi 7 Personal, Delphi 2005 Personal
BeitragVerfasst: Sa 09.04.05 14:55 
Danke @Benny und @WeBsPaCe

Dies hat mir geholfen und mir ist jetzt klar, wie ich dies lösen kann.

Danke an euch beide.

_________________
Was ist ein Moderatorenteam in einem recht bekannten Programmierer-Forum ? Viele Meinungen, eine zählt - Mehr ist ja auch nicht notwendig...