AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Problem mit ComboBox

Offene Frage von "rollstuhlfahrer"
Ein Thema von FelixR · begonnen am 23. Feb 2011 · letzter Beitrag vom 4. Mai 2011
 
gb0

Registriert seit: 27. Aug 2005
20 Beiträge
 
#5

AW: Problem mit ComboBox

  Alt 23. Feb 2011, 16:40
Stimme Stahli voll zu - das müsste Dein Problem lösen, auch wenn ich es jetzt nicht unter D2006 getestet habe.

Ganz schnell hingetippt: Hier hast Du drei Möglichkeiten, von denen doch mindestens eine verwendbar sein müsste (die obige ist auch dabei). Drei ComboBoxen - ein Eintrag gewählt - löscht den betreffenden Eintrag aus allen drei Listen...

Delphi-Quellcode:
procedure TForm1.ComboBox1Click(Sender: TObject);
var
  choice: byte;
  ctext: string;
begin
  choice := ComboBox1.ItemIndex;
  ctext := ComboBox1.Text;
  ComboBox1.Items.Delete(choice);
  choice := ComboBox2.Items.IndexOf(ctext);
  ComboBox2.Items.Delete(choice);
  choice := ComboBox3.Items.IndexOf(ctext);
  ComboBox3.Items.Delete(choice);
end;

procedure TForm1.ComboBox2Click(Sender: TObject);
var
  ctext: string;
  choice: byte;
begin
  choice := ComboBox2.ItemIndex;
  cText := ComboBox2.Items[choice];
  ComboBox1.Items.Delete(ComboBox1.Items.IndexOf(ctext));
  ComboBox3.Items.Delete(ComboBox3.Items.IndexOf(ctext));
  ComboBox2.Items.Delete(choice);
end;

procedure TForm1.ComboBox3Click(Sender: TObject);
begin
  ComboBox1.Items.Delete(ComboBox1.Items.IndexOf(ComboBox3.Text));
  ComboBox2.Items.Delete(ComboBox2.Items.IndexOf(ComboBox3.Text));
  ComboBox3.Items.Delete(ComboBox3.Items.IndexOf(ComboBox3.Text));
end;
Es ist immer vernünftig, wann immer möglich bei ListBox und ComboBox auf die Original-Einträge zurückzugreifen. Dadurch haben kleinere oder größere Unstimmigkeiten keine Chance, Unfug zu erzeugen, selbst 'En glisch' nicht! Könnte es sein, dass in der String-Liste für eine Deiner ComboBoxen 'Englisch ' steht?

LG, Günther

Geändert von gb0 (23. Feb 2011 um 17:24 Uhr)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:52 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz