Autor Beitrag
Allesquarks
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 510

Win XP Prof
Delphi 7 E
BeitragVerfasst: Mo 08.10.07 16:57 
Hm leider muss ich jetzt doch mal Komponenten benutzen und schon fängt der Wahnsinn an. Hab bei einer Combobox bei onchange code geschrieben, der die eingabe überprüft und das Ding ggf rot färbt, leider scheint da offenbar der itemindex noch nicht aktualisiert wodurch eine Überprüfung da total ins Leere läuft. Hab ich nur das falsche Event genommen oder kann man den über eine Methode aktualisieren.

Danke schoneinmal.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 08.10.07 17:05 
Hab das grade mal ausprobiert, und bei mir klappt das - der Itemindex ist auch richtig :nixweiss:

Wie sieht denn deine Überprüfung aus?

_________________
We are, we were and will not be.
Allesquarks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 510

Win XP Prof
Delphi 7 E
BeitragVerfasst: Mo 08.10.07 17:23 
In der Combobox sind 2 items. Ok Präzisierung: Wenn ich ein item auswähle dann ist itemindex aktuell aber wenn ich dann schrott eingebe dann ist der immer noch auf Null oder eins.

Edit: nach dem zweiten Schrotteingeben ist dann wieder alles ok. Das heißt der erste Buchstabe ist noch weiß und erst beim zweiten wirds rot

Gut nur um Fehlern vorzubeugen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm5.ComboBox3Change(Sender: TObject);
begin
  if combobox3.ItemIndex=1 then
  begin
    combobox3.Color:=clwindow;
    combobox4.Enabled:=true;
  end else if combobox3.ItemIndex=0 then
  begin
    combobox3.Color:=clwindow;
    combobox4.Enabled:=false;
  end else begin
    combobox3.Color:=clred;
    combobox4.Enabled:=false;
  end;
end;
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 08.10.07 17:28 
Das eingeben von Schrott kann man abblocken, wenn man den Style auf DropDownList setzt - gehts dann?

_________________
We are, we were and will not be.
Allesquarks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 510

Win XP Prof
Delphi 7 E
BeitragVerfasst: Mo 08.10.07 17:34 
Das ist ja cool da zeigt sich wieder, dass ich von den eingebauten Kompos Null Plan habe das hab ich vor nen paar Tagen gebraucht aber nicht gekannt und wollte das so umarbeiten.

Danke schön