Hallo allerseits,
ich habe diemal eine eher generelle Frage zum Parsing von Formularelementen : Im Codebeispiel wiederholt sich ein und dieselbe Textfeld- bzw. Imageabfrage ca. 20 mal - allerdings werden jeweils andere Textfelder und Imagedaten ausgelesen :
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: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107:
| assignFile(f0,'hs.lcd'); rewrite(f0); pos := 0;
for y := 0 to Image1.Height-1 do begin for x := 0 to Image1.Width-1 do begin Point := (Image1.canvas.pixels[x,y] and $FF) + ((Image1.canvas.pixels[x,y] and $FF00) shr 8) + ((Image1.canvas.pixels[x,y] and $FF0000) shr 16); if (Point < 382) then value := false else value := true;
seek(f0,pos); write(f0,value); inc(pos);
end; end;
exportInfo[0].name := 'hs.lcd'; exportInfo[0].name2 := ''; exportInfo[0].width := Image1.Width; exportInfo[0].height := Image1.Height; exportInfo[0].x := 0; exportInfo[0].y := 0; exportInfo[0].activated := true; exportInfo[0].anim := false; exportInfo[0].frequz := 0; exportInfo[0].key := 0;
assignFile(f1,'hs1.lcd'); rewrite(f1); pos := 0;
for y := 0 to Form1.Img30.Height-1 do begin for x := 0 to Form1.Img30.Width-1 do begin Point := (Form1.Img30.canvas.pixels[x,y] and $FF) + ((Form1.Img30.canvas.pixels[x,y] and $FF00) shr 8) + ((Form1.Img30.canvas.pixels[x,y] and $FF0000) shr 16); if (Point < 382) then value := false else value := true;
seek(f1,pos); write(f1,value); inc(pos); end; end;
exportInfo[1].name := 'hs1.lcd'; exportInfo[1].name2 := 'hs1b.lcd'; exportInfo[1].width := Form1.Img30.Width; exportInfo[1].height := Form1.Img30.Height; exportInfo[1].x := strtoint(Form1.xedit30.text); exportInfo[1].y := strtoint(Form1.yedit30.text); exportInfo[1].activated := true; exportInfo[1].anim := false; exportInfo[1].frequz := strtoint(Form1.break1.Caption); exportInfo[1].key := strtoint(Form1.num30.text);
assignFile(f2,'hs2.lcd'); rewrite(f2); pos := 0;
for y := 0 to Form1.Img31.Height-1 do begin for x := 0 to Form1.Img31.Width-1 do begin Point := (Form1.Img31.canvas.pixels[x,y] and $FF) + ((Form1.Img31.canvas.pixels[x,y] and $FF00) shr 8) + ((Form1.Img31.canvas.pixels[x,y] and $FF0000) shr 16); if (Point < 382) then value := false else value := true;
seek(f2,pos); write(f2,value); inc(pos); end; end;
exportInfo[2].name := 'hs2.lcd'; exportInfo[2].name2 := 'hs2b.lcd'; exportInfo[2].width := Form1.Img31.Width; exportInfo[2].height := Form1.Img31.Height; exportInfo[2].x := strtoint(Form1.xedit31.text); exportInfo[2].y := strtoint(Form1.yedit31.text); exportInfo[2].activated := true; exportInfo[2].anim := false; exportInfo[2].frequz := strtoint(Form1.break1.Caption); exportInfo[2].key := strtoint(Form1.num31.text);
|
Indizes kann ich natürlich mit for-Schleifen benutzen, aber wie kann ich z.B. Form1.Img31.canvas.pixels[x,y] mit Form1.Img32.canvas.pixels[x,y] austauschen ? Denn Form1.Img31 ist ja ein hardcodeter Begriff und somit nicht flexibel.
Ich hoffe, meine Idee ist klar geworden bzw. die damit verbundene Problematik. Z.Z. habe ich halt ellenlange Sources und würde diese gern handlicher machen.
Hat jemand eine Idee ?
Dank im voraus
-- A l e x