Autor Beitrag
AndreM
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

Win2k, WinXP, Suse 10
D7 Ent
BeitragVerfasst: So 01.02.04 11:15 
Hallo Community,

ich habe ein kleines Darstellungsproblem bei einer DBLookupComboBox. Und zwar lese ich die Werte aus einem Datenbankfeld aus und geben diesem dann im der DBLookupCombobox aus. Das ganze funktioniert auch wie auf den Abbildungen zu sehen ist ganz wunderbar. Nur leider sehen die Items nach dem Programmstart zunächst so aus wie auf Abbildung 1. Erst nachdem ich einmal alle Auswahlmöglichkeiten durchgescrollt habe sieht die Combobox aus wie auf Abbildung2. Was muß ich machen damit nach dem Programmstart sofort alle Möglichkeiten so wie auf Abbildung 2 aufgelistet werden?

Abbildung 1:
user defined image

Abbildung 2:
user defined image


-->Edit: Und wie kann ich eine DBLookUpComboBox einen Startwert zuweisen. Ich möchte z.B. das beim Programmstart die Auswahlmöglichkeit der ComboBox nicht Leer, sondern z.B. auf Administrator steht. Wenn ich das über .Text := versuche kommt die Fehlermeldung das man einer ReadOnly - Kompontente keinen Wert zuweisen kann.
tomtom62
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: So 01.02.04 11:47 
Zwei Ideen:

1. DBLookupCombo.Refresh könnte Dein Darstellungsproblem lösen.

2. DBLookupComboBox.Itemindex:=0 könnte dafür sorgen, dass der erste Eintrag gezeigt wird.

Ist "aus dem Bauch raus" :wink:
AndreM Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

Win2k, WinXP, Suse 10
D7 Ent
BeitragVerfasst: So 01.02.04 12:14 
Hm, da hat dein Bauchgefühl wohl kein Recht behalten.

Also das Refresh bringt keinerlei Ergebnis und das IdemIndex gibt es nicht. Bei LookupComboBoxen gibt es nur ListFieldIndex und das hatte ich vorher schon probiert. Das interesiert ihn überhabt nicht wenn ich im da 0, 1 , 2 oder sonst was reinsetze! :(
tomtom62
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: So 01.02.04 12:35 
Dann probier doch mal die Tastencodes für z.B. Pfeil runter an die Box zu senden. Das wäre dann das Gleiche, was Du von Hand machst..

Wie das gehen kann steht hier..

www.delphi-forum.de/...mp;highlight=sendkey

Also um den ersten Eintrag zu sehen müsstest Du eigentlich nur den Tastencode für "Pfeil runter" an die TDBLookupCombobox senden...
AndreM Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

Win2k, WinXP, Suse 10
D7 Ent
BeitragVerfasst: So 01.02.04 13:00 
So, also zumindest das Problem mit der Wertezuweisung hab ich jetzt gelöhst!

Und Zauberwort heißt KeyValue.

Also mit

ausblenden Delphi-Quelltext
1:
DBLookupComboBox.KeyValue := 'Gast';					


Weißt du der Box per Programmcode den aktuellen Index zu.

Zum Darstellungsproblem werd ich mich mal mit obigen Link auseinander setzen. Sieht jedoch auf den 1. Blick ein wenig kompelizierter aus! :D[/delphi]
AndreM Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

Win2k, WinXP, Suse 10
D7 Ent
BeitragVerfasst: So 01.02.04 15:38 
Ok, das ganze hat sich erledigt.

Man muß einfach nachdem man die Werte hat einlesen lassen das KeyValue auf '' setzen.

Also über

ausblenden Delphi-Quelltext
1:
DBLookupCombobox.KeyValue := ''					


kann man obiges Darstellungsproblem beheben.[/delphi]