Autor Beitrag
rockzOr
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44



BeitragVerfasst: Sa 13.08.05 10:55 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
procedure TForm5.Button1Click(Sender: TObject);
var
c,i : integer;
code : string;
   cFileName : string;
   iHandle : integer;
begin
  for c := 1 to 5 do
  begin
  if form2.edit67.text[i] = '1' then code := code + 'l';
  if form2.edit67.text[i] = '2' then code := code + 'a';
  if form2.edit67.text[i] = '3' then code := code + 'l';
  if form2.edit67.text[i] = '4' then code := code + 'e';
  if form2.edit67.text[i] = '5' then code := code + 'l';
  if form2.edit67.text[i] = '6' then code := code + 'u';
  if form2.edit67.text[i] = '7' then code := code + 'd';
  if form2.edit67.text[i] = '8' then code := code + 'u';
  if form2.edit67.text[i] = '9' then code := code + 'm';
  if form2.edit67.text[i] = '0' then code := code + 'd';
  end;
  cFileName := 'www.url.de/hs.php&name=' + edit1.Text + '&points=' + form2.Edit67.text + '&rnd=' + code ;
  iHandle := ShellExecute(handle, 'open', PChar(cFileName), nil, nil, SW_SHOW);
close;
  form2.enabled := true;
end;


funzt logischerweise net. mein ziel ist es, die mehrstellige zahl eines edit fensters aufzuplitten und jede einzelne zahl abzuprüfen um die in einen code umzuwandeln.
jemand ne idee?

greetZ rockzOr


Moderiert von user profile iconraziel: Topic aus Algorithmen, Optimierung und Assembler verschoben am Sa 13.08.2005 um 12:54
CK_CK
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 140

Win 2000, Win XP Prof
Delphi 2006 Enterprise
BeitragVerfasst: Sa 13.08.05 10:58 
Hi!
Das ist ganz einfach:
Packe form2.edit67.text in einen string und prüfe den mit [i] durch...
ausblenden Delphi-Quelltext
1:
2:
tmpstr := form2.edit67.text;
if tmpstr[i] = 'A' then blabla...


CK_CK

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
rockzOr Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44



BeitragVerfasst: Sa 13.08.05 11:07 
klappt aber leider net weil -> wenn ich das edit in die variable peile überprüft er trotz [i] nur die gesamte zahl, nicht jede ziffer einzelnd.
rockzOr Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44



BeitragVerfasst: Sa 13.08.05 11:10 
sry mein fehler ;)
CK_CK
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 140

Win 2000, Win XP Prof
Delphi 2006 Enterprise
BeitragVerfasst: Sa 13.08.05 11:12 
Also hat's geklappt?

CK_CK
rockzOr Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44



BeitragVerfasst: Sa 13.08.05 11:23 
jap vielen dank, hätt ich auch selbst drauf kommen können, zu viel auf einmal halt ;)
aber danke sehr hast echt geholfen
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Sa 13.08.05 11:54 
Man kann aber auch direkt per Index auf die einzelnen Zeichen der Text Eigenschaft des Edit zugreifen: Form2.Edit67.Text[i]. So spart man sich das kopieren in eine temporäre Variable...

//Edit: Was du ja oben bereits getan hast :gruebel: Was funktioniert an dem Code denn nicht? Evtl. solltest du vorher die Variable code initialisieren?

_________________
JSXGraph
CK_CK
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 140

Win 2000, Win XP Prof
Delphi 2006 Enterprise
BeitragVerfasst: Sa 13.08.05 13:03 
@raziel: Tipp' das mal in Delphi ein, es wird nicht funkionieren...
(Bei mir zumindest nicht...)

Man benötigt auf jeden Fall die temporäre Variable...

CK_CK
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Sa 13.08.05 13:23 
.   ShowMessage(Edit1.Text[1]); Tuts einwandfrei bei meiner Delphi 7 Personal. Und warum? Ein Blick in die Delphi-Hilfe verräts uns: type TCaption = type string; :arrow: TCaption ist also nichts weiter als ein String und deshalb sollte es auch bei deinem Delphi gehen. Evtl hast du die Indizierung bei 0 begonnen, bei Strings gehts jedoch bei 1 erst los ;)

_________________
JSXGraph
CK_CK
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 140

Win 2000, Win XP Prof
Delphi 2006 Enterprise
BeitragVerfasst: Sa 13.08.05 13:57 
Aber bei Edit1.Text[1] := 'A'; versagt Delphi bei mir...

CK_CK

Moderiert von user profile iconTino: Delphi-Tags hinzugefügt.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 13.08.05 14:05 
user profile iconCK_CK hat folgendes geschrieben:
Aber bei Edit1.Text[1] := 'A'; versagt Delphi bei mir...

Das ist ja auch kein Vergleich, sondern eine Zuweisung.

_________________
Ciao, Sprint.
rockzOr Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44



BeitragVerfasst: Mo 15.08.05 09:38 
davon abgesehen dass A doch ein integer wert ist, eine edit komponente aber doch aus strings besteht? ignorieren wenn ich mich irre, bin eben ers aufgestanden ^^
also das mit dem [i] am ende geht nicht, deine erklärung trifft aber vermutlich zu, denn code muss vorher 1 zugeordnet werden, er kann ja nich bei 0 beginngen :roll:
würde denke ich auch funktionieren, hab daran inch gedacht, es geht jetzt aber also lass ichs lieber so *g