Autor Beitrag
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Mi 01.09.04 19:20 
:shock:

irgendwo in dem Code (wird bei onChange ausgeführt) muss der Fehler wohl drin sein, ohne gehts nämlich:

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:
var ss, ll, len: integer;
begin
 with (Sender as TRichEdit) do
   begin
        SetFocus;
        ll:= Lines.Count-1;
        len:= Length(Lines[ll]);
        while Pos(']' + #9, Lines[ll])=0 do
          begin

               len:= len + Length(Lines[ll]);
               dec(ll);
          end;

        ss:= Length(Text) - len - 2;

        SelStart:= ss;
        SelLength:= Pos(']', Lines[ll]);
        SelAttributes.Color:= clBlue;
        SelAttributes.Size:= 7;
        SelLength:= 0;

        if (Pos('<', Lines[ll])<>0) and (Pos('> ', Lines[ll])<>0) then
           begin
                ss:= ss + Pos('<', Lines[ll])-1;
                SelStart:= ss;
                SelLength:= Pos('> ', Lines[ll]) - ss;
                SelAttributes.Style:= SelAttributes.Style + [fsBold];
                SelLength:=0;
           end;
       SelStart:= Length(Text)-1;
       SetFocus;
   end;
end;


das komische ist, es ging voher.. und ich kann mich nicht mehr erinneren, was ich geändert habe :autsch:

ich hab den COde auch schon neu geschrieben, hilft niks :(

Stefan

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)


Zuletzt bearbeitet von StefanH am Do 02.09.04 10:36, insgesamt 1-mal bearbeitet
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Mi 01.09.04 23:41 
hallo stefan! ;)

Zitat:
irgendwo in dem Code muss der Fehler wohl drin sein

naja, wenn du es sagst, dann wirds schon stimmen :lol:
und wie äussert sich der fehler? gibts eine fehlermeldung oder funktioniert die routine nicht so, wie sie soll?

mfg, stefan
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Mi 01.09.04 23:49 
Hallo StefanH,

hättest du einen BreakPoint (und dann mit F7 weiter) gesetzt, dann hättest du selber schnell feststellen können, das dein Code bei while Pos hängt.

_________________
Ciao, Sprint.
StefanH Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Do 02.09.04 10:35 
grayfox hat folgendes geschrieben:
und wie äussert sich der fehler? gibts eine fehlermeldung oder funktioniert die routine nicht so, wie sie soll?


ich bekomme eine EXception "EOutOfRessources", mit der Meldung 'Fehler beim einfügen bei RichEdit Zeile', die Zeile fügt er hinzu :!?!:

Sprint hat folgendes geschrieben:
hättest du einen BreakPoint (und dann mit F7 weiter) gesetzt, dann hättest du selber schnell feststellen können, das dein Code bei while Pos hängt.



wenn ich die WHILE-Anweisung auskommentier, gehts auch net... :(

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Do 02.09.04 13:56 
Wenn ich ein neues Projekt erstell, ein RichEdit draufpacke, deinen Code im OnChange Ereignis einfüge und das Programm starte...

Im RichEdit befinden sich zwei Zeilen.
1. RichEdit1
2. Leerzeile

RichEdit hat den Focus. Der Cursor steht in der leeren Zeile. Jetzt drücke ich die Delete Taste. RichEdit hat nur noch eine Zeile
und das OnChange Ereignis wird ausgeführt.
ausblenden Delphi-Quelltext
1:
ll:= Lines.Count-1;					

ll ist jetzt 0.
ausblenden Delphi-Quelltext
1:
while Pos(']' + #9, Lines[ll])=0 do					

Wann würde die while Schleife beendet werden? Genau, wenn das Ergebnis False ist.
ausblenden Delphi-Quelltext
1:
dec(ll);					

Jetzt ist ll schon bei -1 und die while Schleife ist immer noch im ersten Durchlauf. Hier musst du aus der Schleife ausbrechen, wenn alle
Zeilen durchlaufen sind.

_________________
Ciao, Sprint.
StefanH Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Do 02.09.04 19:32 
sry... ich hab vergessen zu sagen, das ]#9 immer drin steht :oops:

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
adler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: Do 02.09.04 21:13 
Schonmal versucht jeden Befehl nacheinander auszu kommentieren?
Dann weißte eher wo der fehler kommt.

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.
StefanH Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Fr 03.09.04 09:59 
adler hat folgendes geschrieben:
Schonmal versucht jeden Befehl nacheinander auszu kommentieren?
Dann weißte eher wo der fehler kommt.


immmer wenn ich SelStart etwas zuweise...

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
adler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: Fr 03.09.04 14:34 
Schonmal geschaut obs klatt geht, oder ob vllt. in ss nen zu großer Wert drinne steht, weil er dieses komische ]#9 net findet?

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.
StefanH Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Sa 04.09.04 14:43 
ich hab etz mal nen Breckpoint gesetzt, und hab mal geguggt, beim "Length(Text)" kam dann:
Zitat:
Auf die Variable "self" kann wegen optimierung nicht zugegriffen


:o :?!?:

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Sa 04.09.04 14:58 
hallo stefan!

du sprichst von folgender zeile:  ss:= Length(Text) - len - 2; richtig?
woher stammt dein 'Text' eigentlich?

mfg, stefan
StefanH Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Sa 04.09.04 15:01 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
 with (Sender as TRichEdit) do
...
 ss:= Length(Text) - len - 2;
...


daher...

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Sa 04.09.04 15:11 
das war mir schon klar - schliesslich bezieht sich das with auf richedit :mrgreen:
vor beantwortung deiner frage hab ich mir das richedit angesehen, konnte aber kein property 'text' entdecken. ok, ich mach auch nie was mit richedit - denn ich schreibe ja keine romane *gg*

gruss, stefan
StefanH Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Sa 04.09.04 19:40 
doch, doch, das gibts schon :roll:

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
StefanH Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: So 05.09.04 18:53 
na toll... :(

nicht mal
ausblenden Delphi-Quelltext
1:
text := 'bla';					


geht :-?

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
adler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: So 05.09.04 19:55 
dann klappts vllt. ohne das with bla do
Oder es gibts Text doch net ^^ (hab net geschaut)

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.
StefanH Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: So 05.09.04 20:08 
nein, geht auch nicht...
und Text gibts ihr Ungläubigen!!! ;)

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
ernstl
Hält's aus hier
Beiträge: 11

Win 98
D5 Prof
BeitragVerfasst: Mo 04.10.04 23:39 
Hallo!
wenns überhaut noch intressiert, aber dein Fehler liegt in Zeile 15  ss:= Length(Text) - len - 2;hier müßte stehen  ss:= Length(Lines.Text) - len - 2;da sich TRichEdit.Text auf Caption bezieht. In Zeile 31 ist der Fehler nochmal.
Gruß ernstl
StefanH Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Di 05.10.04 13:49 
ernstl hat folgendes geschrieben:
Hallo!
wenns überhaut noch intressiert, aber dein Fehler liegt in Zeile 15  ss:= Length(Text) - len - 2;hier müßte stehen  ss:= Length(Lines.Text) - len - 2;da sich TRichEdit.Text auf Caption bezieht. In Zeile 31 ist der Fehler nochmal.
Gruß ernstl


:nein: das ist es nicht :(

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
Böser Borstel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 154



BeitragVerfasst: Di 05.10.04 14:20 
vielleicht ist deine while - schleife eine endlosschleife geworden.
versuche dochmal nur bis und einschließlich 0 zeile zu prüfen.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
    while (Pos(']', Lines[ll])=0) and
      (ll >= 0) do
    begin
      len:= len + Length(Lines[ll]);
      dec(ll);
    end;


Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.