Autor Beitrag
florida
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 137

Windows 7 Home Premium, Windows XP Professional, Windows 2000
Delphi 2010 Architect
BeitragVerfasst: So 27.06.10 07:35 
Nochmal: :wink:

Ich wollte ja vor kurzer Zeit einen sehr einfachen Scanner auf meine eigene Art und Weise programmieren.
Hier nochmal der Quelltext:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
 ParserLbl.Caption := '0';
 for I := 0 to Editor.Lines.Count - 1 do
 begin
  if Editor.Lines[I] = 'text' then
  begin
    Editor.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
    ParserLbl.Caption := '1';
  end;
  ParserLbl.Caption := '0';
  if Editor.Lines[I] = 'caption' then
  begin
    Editor.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
    ParserLbl.Caption := '1';
  end;
  if parserlbl.Caption = '1' then
  begin
   line := sendmessage(handle, EM_LINEFROMCHAR, charpos, 0);
   ausgabememo.Lines.Add(IntToStr(line));
  end;


Hier soll die erste Zeile gelesen werden. Falls dort "text" steht, soll beim ParserLbl 1 angezeigt werden, damit das Programm weiß, dass die Syntax korrekt ist. Falls dort 1 steht, muss eine Zeile runtergescrollt werden, wobei dort ebenfalls überprüft wird, ob die Syntax von bspw. caption richtig ist. Sollte es erneut korrekt sein, wird wieder die Zahl 1 angezeigt und runtergescrollt. Und falls erneut beim ParserLbl die 1 steht, muss der Text von der entsprechenden Zeile in ein anderes Memo übertragen werden.

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

Kurze Anmerkung:
ParserLbl muss nach jedem Befehl auch immer auf 0 umschalten, da es ja möglich wäre, dass das nächste Befehl falsch ist.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 27.06.10 08:17 
user profile iconflorida hat folgendes geschrieben Zum zitierten Posting springen:
Falls dort "text" steht, soll beim ParserLbl 1 angezeigt werden, damit das Programm weiß, dass die Syntax korrekt ist.
Das Programm?!?
Ein Label ist zur Anzeige für den Benutzer.

Wenn es nur um die Verarbeitung durch das Programm geht: Wie wäre es mit einer simplen Variable...

user profile iconflorida hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
  if Editor.Lines[I] = 'text' then
  begin
    Editor.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
    ParserLbl.Caption := '1'// wozu, du setzt die Caption doch direkt nach dem Befehl ohnehin wieder auf 0...
  end;
  ParserLbl.Caption := '0';
florida Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 137

Windows 7 Home Premium, Windows XP Professional, Windows 2000
Delphi 2010 Architect
BeitragVerfasst: So 27.06.10 14:01 
Zitat:
// wozu, du setzt die Caption doch direkt nach dem Befehl ohnehin wieder auf 0...


Wie schon beschrieben, könnte es ja möglich sein, dass das "caption" hinterher falsch geschrieben worden ist und sonst bleibt ja die 1 trotz falscher Syntax stehen.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 27.06.10 14:19 
Dann lass die Zeile doch weg. :nixweiss:
ausblenden Delphi-Quelltext
1:
2:
3:
  if Editor.Lines[I] = 'text' then
    Editor.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
  ParserLbl.Caption := '0';
ALF
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1085
Erhaltene Danke: 53

WinXP, Win7, Win10
Delphi 7 Enterprise, XE
BeitragVerfasst: Mo 28.06.10 10:41 
Hi, user profile iconflorida
Du machst ein neuen Thread auf um zu erklären wie Dein Projekt funktionieren soll/möchte!
Dabei gibst Du nur den selben Code an wie schon im letzten Thread :gruebel:
Schon Diskutiert man wieder über Sinn und Unsinn mit Deinem Labels!
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
ParserLbl.Caption := '0';
for I := 0 to Editor.Lines.Count - 1 do
begin
  if Editor.Lines[I] = 'text' then
  begin
    Editor.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
    ParserLbl.Caption := '1';
  end;
  ParserLbl.Caption := '0'//<--hier kommt entweder else rein oder du nimmst die Zeile weg!!!!!dann funct es!!
  if Editor.Lines[I] = 'caption' then
  begin
    Editor.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
    ParserLbl.Caption := '1';
  end;
  if parserlbl.Caption = '1' then
  begin
   line := sendmessage(handle, EM_LINEFROMCHAR, charpos, 0);
   ausgabememo.Lines.Add(IntToStr(line));
   end;

Du gehst jetzt nur von 2 Suchbegriffen aus! Wie willst Du es bei <2^x machen? Mal darüber nachgedacht!!!!
Du solltest diese Antworten -hier-, erstmal richtig durchlesen und dann darauf, oder jetzt hier, Antworten!

Du hast dich in eine Sache verbissen, die man Effektiver lösen kann, steht auch schon im alten Thread drin!

Schade :?!?:

Gruss Alf

_________________
Wenn jeder alles kann oder wüsste und keiner hätt' ne Frage mehr, omg, währe dieses Forum leer!