Autor Beitrag
Power
Hält's aus hier
Beiträge: 1



BeitragVerfasst: So 02.12.07 16:55 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.FormCreate(Sender: TObject);
begin
        Form1.cb_1.Items.Add('test');
end;


Funzt leider nicht, es wird kein wert hinzugefügt. Kann mir jemand sagen wieso nicht? (cb_1 ist natürlich die combobox, anders benannt...)


Moderiert von user profile iconChristian S.: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am So 02.12.2007 um 16:57
gispos
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 94

WIN 7
XE10, D2007
BeitragVerfasst: So 02.12.07 18:03 
Versuch mal Compobox.AddItem('Neues Item', nil);
Als Style darf nicht csSymple eingestellt sein!

Gruß gispos
oldmax
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 380


D3 Prof, D4 Prof
BeitragVerfasst: Mo 03.12.07 06:38 
Hi
Nun, eigentlich müsste es gehen. Vielleicht solltest du den Item mal in das Textfeld laden, damit du ihn siehst,

ausblenden Delphi-Quelltext
1:
Form1.Cb_1.Text:=Form1.Cb_1.Items[0];					


wenn du es noch nicht gemacht hast.
Ansonsten bin ich zur Zeit auch ratlos....
Gruß oldmax

_________________
Zier dich nich so, ich krieg dich schon....
chriscolm
Hält's aus hier
Beiträge: 5



BeitragVerfasst: Mo 03.12.07 20:41 
user profile iconPower hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.FormCreate(Sender: TObject);
begin
        Form1.cb_1.Items.Add('test');
end;


Funzt leider nicht, es wird kein wert hinzugefügt. Kann mir jemand sagen wieso nicht? (cb_1 ist natürlich die combobox, anders benannt...)

Moin,

der Code ist eigentlich richtig. Wenn Du ihn auf ein "nacktes" Formular packst, wird er funktionieren. Also dürfte der Fehler woanders liegen.

Ach so, die Combobox braucht hier nicht durch Form1 qualifiziert zu werden.

Grüße

Christian

Moderiert von user profile iconChristian S.: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am So 02.12.2007 um 16:57
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 03.12.07 21:22 
Nimm mal das Form1 davor weg.
Nostromo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 33
Erhaltene Danke: 1

Win 7 Pro 64bit, Win XP SP3
Delphi 7 Ent
BeitragVerfasst: Di 04.12.07 13:02 
Ob mit oder ohne Form1 spielt bei mir hier keine Rolle.
Klappt alles einwandfrei.

Der Fehler muss also wirklich woanders liegen.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Di 04.12.07 13:21 
verschieb mal deinen Code von FormCreate ins FormShow oder hau ein Application.ProcessMessages davor.

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Di 04.12.07 13:28 
Ist der Eintrag text in der CB vorhanden, aber wird nicht als standard angezeigt, oder ist er einfach garnicht da? Versuch mal, cb_1.ItemIndex := 0; einzufügen, damit der angezeigte Wert auf den ersten Wert der CB gesetzt wird.

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