Autor Beitrag
Jazzalex
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25

Fedora Core 3, Winx XP

BeitragVerfasst: Di 07.11.06 13:06 
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 :

ausblenden volle Höhe 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:
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:
  // erstes mal

  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;

  /////////////////////////////////////////////////////

  // zweites mal

  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);

  /////////////////////////////////////////////////////

  // drittes mal

  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);

/////////////////////////////////////

  // uns so weiter


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
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 07.11.06 13:24 

_________________
There are 10 types of people - those who understand binary and those who don´t.