Autor Beitrag
Ironhead
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

Win XP,Kanotix 5

BeitragVerfasst: Di 18.07.06 16:15 
Hallo ihr Profis,

Brauch mal Eure Hilfe.

Ich habe eine Form mit einer Listbox, in der Namen stehen, wenn ich nun einen eintrag Doppelt
anklicke öffnet sich eine neue Form. Das Klappt ja auch gut, nur möchte ich das sich das Caption
dieser Form, die sich öffnet, jenachdem welcher Name angeklickt wurde ändert.

Ich möchte das ein fester Text wie "Unterhaltung mit" drinsteht, und wenn einer auf den Namen in der Listbox geklickt hat, möchte ich gerne das dahinter der Name erscheint.

Ich hoffe das war verständlich genug, wäre schön wenn mir einer Helfen kann.
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Di 18.07.06 16:20 
FormX.Caption := ListBox1.Items.Strings[ListBox1.ItemIndex]; im OnDblClick-Ereignis

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Di 18.07.06 16:20 
Also mit
ausblenden Delphi-Quelltext
1:
ListBox1.items.strings[ListBox1.ItemIndex]					

bekommst du den String des derzeit ausgewählten Eintrages zurück.
Das kannst du dann deiner Form.Caption zuweisen. Dein Quellcode, wenn du die Form erstellst müsste ja dann etwa so aussehen:
ausblenden Delphi-Quelltext
1:
2:
3:
//hier erstellst du deine Form, irgendwie sowas müsstest du ja haben
ApplicationCreateForm(TDeineForm, DeineForm); //Parameter könnten auch andersherum sein, hab grad kein Delphi offen, einfach mal testen
DeineForm.Caption := 'Gespräch mit ' + ListBox1.items.strings[ListBox1.ItemIndex];


Gruß alias5000

_________________
Programmers never die, they just GOSUB without RETURN
Ironhead Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

Win XP,Kanotix 5

BeitragVerfasst: Di 18.07.06 16:29 
Ja wunderbar, hat prima gefunzt, Danke dir alias5000
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Di 18.07.06 17:52 
büdde :D

_________________
Programmers never die, they just GOSUB without RETURN
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Di 18.07.06 18:40 
Listbox1.Items[Listbox1.ItemIndex] geht doch auch? x_X Wieso wurschtlt ihr da mit Strings rum, wenn Items eh vom typ TStrings ist? x_X

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Di 18.07.06 18:46 
user profile iconJayEff hat folgendes geschrieben:
Listbox1.Items[Listbox1.ItemIndex] geht doch auch? x_X Wieso wurschtlt ihr da mit Strings rum, wenn Items eh vom typ TStrings ist? x_X

Listbox1.Items[Listbox1.ItemIndex] ist ja auch nur ein kurzer Ausdruck für ListBox1.items.strings[ListBox1.ItemIndex].

_________________
Markus Kinzler.
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Di 18.07.06 18:50 
So kann mans auch sehen, in meinen Augen ist es umgekehrt: x.y.strings ist ein Umweg zu x.y ...

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.