Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Combobox Problem (https://www.delphipraxis.net/165745-combobox-problem.html)

klaus9 13. Jan 2012 20:36

Combobox Problem
 
Hallo,

habe derzeit folgendes kleines Problem..

ComboBox1.Items.AddObject('test', Action1);

Das funktioniert wunderbar er zeigt mir in der Combobox die Auswahl "test" an und startet bei klick Action1

Jetzt möchte ich aber den text test aus einem edit.text Feld einlesen.

Habe jetzt folgendes probiert:

ComboBox6.Items.AddObject(Edit1.text, Action1);

oder auch mit

ComboBox6.Items.AddObject(LabeledEdit1.text, Action1);

hierbei zeigt er mir in der Combobox aber nur den Text des Edit Feldes an was im delphi vorgegeben ist..

sprich steht Edit1 im Edit1.Feld wird dieses auch nur angezeigt nicht der eigentliche text im Edit1.Feld wenn dort z.B. bla blub steht, zeigt er mir im Combobox liste nur Edit1

Wie bekomme ich das Problem hin ?

Gruß
Klaus

haentschman 13. Jan 2012 20:46

AW: Combobox Problem
 
Hallo...

da mußt du schon etwas mehr Quelltext zeigen. Zu welchem Zeitpunkt setzt du die Combobox ?
Normalerweise sollte das funktionieren. Deshalb tippe ich auf einen verkehrten Zuweisungszeitpunkt.

:hi:

himitsu 13. Jan 2012 22:10

AW: Combobox Problem
 
Sicher daß dein Formular nur einmal instantiert wird?
Schau mal in deine DPR (Projekt > Quelltext anzeigen).

Vor einer Weile hatte schonmal jemand soein Problem.
Dieser griff über die böse globale Variable (z.B. "Form1") auf das Formular zu, aber da die Hauptform (Form1) mehrmals erstellt wurde, wobei nur die erste Instanz sichtbar ist, aber die Letzte in der Variable drin stand, griff er immer auf das falsche Formular zu.


Globale Variablen sind böse. :stupid:


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:14 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz