AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein GUI-Design mit VCL / FireMonkey / Common Controls Delphi Combobox Strings umbenennen ohne Index zu verändern?
Thema durchsuchen
Ansicht
Themen-Optionen

Combobox Strings umbenennen ohne Index zu verändern?

Ein Thema von Hallo_Thomas · begonnen am 28. Okt 2006 · letzter Beitrag vom 28. Okt 2006
Antwort Antwort
Seite 1 von 2  1 2      
Hallo_Thomas

Registriert seit: 18. Apr 2005
Ort: Dresden
405 Beiträge
 
Delphi 2005 Professional
 
#1

Combobox Strings umbenennen ohne Index zu verändern?

  Alt 28. Okt 2006, 13:52
Hallo, ich benenne in einer Combobox die Strings um ohne dass sic der Index verändert?
Im Moment schaff ich es nur so;


Delphi-Quellcode:
x:=Combobox1.ItemIndex
Combobox1.Items[x]:='Hallo Welt';
Combobox1.ItemIndex:=x;

Schaff ich dies, auch mit 1er Zeile?
  Mit Zitat antworten Zitat
Balu der Bär
(Gast)

n/a Beiträge
 
#2

Re: Combobox Strings umbenennen ohne Index zu verändern?

  Alt 28. Okt 2006, 13:54
ComboBox1.Items[ComboBox1.ItemIndex] := 'Hallo Welt'; ?
  Mit Zitat antworten Zitat
Hallo_Thomas

Registriert seit: 18. Apr 2005
Ort: Dresden
405 Beiträge
 
Delphi 2005 Professional
 
#3

Re: Combobox Strings umbenennen ohne Index zu verändern?

  Alt 28. Okt 2006, 14:15
Achso, ich glaube das klappt nich, eins hatte ich vergessen, ich benenne alle begriffe in der Combox um per for Schleife.
  Mit Zitat antworten Zitat
Balu der Bär
(Gast)

n/a Beiträge
 
#4

Re: Combobox Strings umbenennen ohne Index zu verändern?

  Alt 28. Okt 2006, 14:19
Zeig mal bitte den gesamten Code.
  Mit Zitat antworten Zitat
Hallo_Thomas

Registriert seit: 18. Apr 2005
Ort: Dresden
405 Beiträge
 
Delphi 2005 Professional
 
#5

Re: Combobox Strings umbenennen ohne Index zu verändern?

  Alt 28. Okt 2006, 14:37
Delphi-Quellcode:
for y:=0 to5 do
x:=Combobox1.ItemIndex
Combobox1.Items[y]:=IntToStr(y);
Combobox1.ItemIndex:=x;
  Mit Zitat antworten Zitat
Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#6

Re: Combobox Strings umbenennen ohne Index zu verändern?

  Alt 28. Okt 2006, 14:38
Delphi-Quellcode:
for y:=0 to 5 do
BEGIN //!
x:=Combobox1.ItemIndex
Combobox1.Items[y]:=IntToStr(y);
Combobox1.ItemIndex:=x;
END; //!
Wenn du willst das alle Zeilen wiederholt werden musst du den Block mit begin/end; einschließen!

Gruß
Neutral General
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat
Balu der Bär
(Gast)

n/a Beiträge
 
#7

Re: Combobox Strings umbenennen ohne Index zu verändern?

  Alt 28. Okt 2006, 14:39
Delphi-Quellcode:
for y := 0 to 5 do
  Combobox1.Items[y]:=IntToStr(y);
Sollte doch gehen, oder?
  Mit Zitat antworten Zitat
Hallo_Thomas

Registriert seit: 18. Apr 2005
Ort: Dresden
405 Beiträge
 
Delphi 2005 Professional
 
#8

Re: Combobox Strings umbenennen ohne Index zu verändern?

  Alt 28. Okt 2006, 20:58
Naja, da wird der ItemIndex immer auf -1 zurückgesetzt.
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#9

Re: Combobox Strings umbenennen ohne Index zu verändern?

  Alt 28. Okt 2006, 21:00
Zitat von Hallo_Thomas:
Naja, da wird der ItemIndex immer auf -1 zurückgesetzt.
Dann speichere dir doch den ItemIndex ab und setzte ihn am Schluß wieder.
Markus Kinzler
  Mit Zitat antworten Zitat
Balu der Bär
(Gast)

n/a Beiträge
 
#10

Re: Combobox Strings umbenennen ohne Index zu verändern?

  Alt 28. Okt 2006, 21:02
@mkinzler: Ich denke genau das wollte er verhindern.
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 2  1 2      


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 13:34 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