AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi TStringList bringt mich zum VerZweiFeln
Thema durchsuchen
Ansicht
Themen-Optionen

TStringList bringt mich zum VerZweiFeln

Ein Thema von Spiderpig_GER_15 · begonnen am 15. Sep 2008 · letzter Beitrag vom 16. Sep 2008
Antwort Antwort
Seite 3 von 4     123 4      
Hawkeye219

Registriert seit: 18. Feb 2006
Ort: Stolberg
2.227 Beiträge
 
Delphi 2010 Professional
 
#21

Re: TStringList bringt mich zum VerZweiFeln

  Alt 15. Sep 2008, 20:42
Zitat von Spiderpig_GER_15:
aber da ist doch garkein indexOf, zumindest nicht direkt, welches meinst du denn?
Wenn sich mein Editor nicht verzählt hat, sind es 50 IndexOf-Aufrufe. Verdächtig sind alle, die du unkontrolliert für einen Zugriff auf eine Stringliste verwendest.

Gruß Hawkeye
  Mit Zitat antworten Zitat
Benutzerbild von Spiderpig_GER_15
Spiderpig_GER_15

Registriert seit: 17. Mär 2008
298 Beiträge
 
Delphi 7 Personal
 
#22

Re: TStringList bringt mich zum VerZweiFeln

  Alt 15. Sep 2008, 20:47
huch? wie schaut man sowas?

EDIT: jetzt sag nicht mit der "Suche"
---Zufall ist das Inkognito Gottes---
  Mit Zitat antworten Zitat
Benutzerbild von Matze
Matze
(Co-Admin)

Registriert seit: 7. Jul 2003
Ort: Schwabenländle
14.929 Beiträge
 
Turbo Delphi für Win32
 
#23

Re: TStringList bringt mich zum VerZweiFeln

  Alt 15. Sep 2008, 20:52


Geht's nun oder nicht? Bleib doch mal beim Thema.

Edit: zu deinem OT s. Anhang.
Miniaturansicht angehängter Grafiken
search_212.png  
  Mit Zitat antworten Zitat
Benutzerbild von Spiderpig_GER_15
Spiderpig_GER_15

Registriert seit: 17. Mär 2008
298 Beiträge
 
Delphi 7 Personal
 
#24

Re: TStringList bringt mich zum VerZweiFeln

  Alt 15. Sep 2008, 20:56
zum Thema: Ich hab grad alles so gemacht wie ihr es gesagt habt, sprich alle begins die stören könnten weg.

Momentan wird die Stelle garnicht mehr ausgeführt, weil die Bedingungen nicht mehr erfüllt werden, bin grade beim Fehler suchen.
Ich meld mich dann gleich nochmal
---Zufall ist das Inkognito Gottes---
  Mit Zitat antworten Zitat
Benutzerbild von Spiderpig_GER_15
Spiderpig_GER_15

Registriert seit: 17. Mär 2008
298 Beiträge
 
Delphi 7 Personal
 
#25

Re: TStringList bringt mich zum VerZweiFeln

  Alt 15. Sep 2008, 21:14
Hier jetzt verbessert:
Delphi-Quellcode:
unit MainCalcPart;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

  procedure VokCalc;

implementation

uses Frame;

procedure VokCalc;
var StrList: TStringList;
    iI, kI, lI, jI: Integer;
begin
  StrList:= TStringList.Create;
  Frame_1.SVoksToDo.Clear;
  StrList.Clear;

  randomize;

  //3 Neue Vokabeln
  for iI := 1 to 3 do
  begin
    If (Frame_1.LastVokIndex+1) <= Frame_1.OverAllVok then
    begin
      inc(Frame_1.LastVokIndex);
      Frame_1.SVoksToDo.Add(Frame_1.savestring[Frame_1.savestring.IndexOf('NR' + inttostr(Frame_1.LastVokIndex))+7]);
    end;
  end;

  //5 aus Aktueller Lektion
  for iI := 1 to Frame_1.OverAllVok do
  begin
    If (strtoint(Frame_1.savestring[(Frame_1.savestring.IndexOf('NR'+ inttostr(iI)) + 5)]) = Frame_1.acuteLekt) then
    begin
      If Frame_1.SVoksToDo.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]) = (-1) then
      begin
        if StrList.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]) = (-1) then
        begin
          StrList.Add(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]);
        end;
      end;
    end;
  end;
  if StrList.Count >= 5 then
  begin
    Frame_1.SVoksToDo.Add(StrList[random((StrList.Count-1) div 5)]);
    Frame_1.SVoksToDo.Add(StrList[random((StrList.Count-1) div 5)+ (1*((StrList.Count) div 5))]);
    Frame_1.SVoksToDo.Add(StrList[random((StrList.Count-1) div 5)+ (2*((StrList.Count) div 5))]);
    Frame_1.SVoksToDo.Add(StrList[random((StrList.Count-1) div 5)+ (3*((StrList.Count) div 5))]);
    Frame_1.SVoksToDo.Add(StrList[random(((StrList.Count-1) div 5) + ((StrList.Count) mod 5)) + (4*((StrList.Count) div 5))]);
    StrList.Clear;
  end;

  //2 Problemfälle aus akt. Lektion
  for Ii := 1 to Frame_1.OverallVok do
  begin
    If (strtoint(Frame_1.savestring[(Frame_1.savestring.IndexOf('NR'+ inttostr(iI)) + 5)]) = Frame_1.acuteLekt) then
    begin
      If Frame_1.SVoksToDo.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]) = (-1) then
      begin
        if Frame_1.savestring[Frame_1.savestring.IndexOf('Nr' + inttostr(iI)) + 1] = '1then
        begin
          if StrList.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]) = (-1) then
          begin
            if ((strtofloat(Frame_1.savestring[Frame_1.savestring.IndexOf('NR' + inttostr(iI)) + 2])) /
                 (strtofloat(Frame_1.savestring[Frame_1.savestring.IndexOf('NR' + inttostr(iI)) + 3]))) <
                   Frame_1.FailRatio then
            begin
              StrList.Add(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]);
            end;
          end;
        end;
      end;
    end;
  end;
  if StrList.Count >= 2 then
  begin
    iI:=random(StrList.Count);
    Frame_1.SVoksToDo.Add(StrList[iI]);
    repeat
      kI:=random(StrList.Count);
    until kI <> iI;
    Frame_1.SVoksToDo.Add(StrList[kI]);
  end;
  StrList.Clear;


  //3 Problemfälle aus letzten beiden Lektionen
  for iI := 1 to Frame_1.OverAllVok do
  begin
    If ((strtoint(Frame_1.savestring[(Frame_1.savestring.IndexOf('NR'+ inttostr(iI)) + 5)])) >= Frame_1.acuteLekt -2) and
            ((strtoint(Frame_1.savestring[(Frame_1.savestring.IndexOf('NR'+ inttostr(iI)) + 5)])) < Frame_1.acuteLekt) then
    begin
      If Frame_1.SVoksToDo.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]) = (-1) then
      begin
        if Frame_1.savestring[Frame_1.savestring.IndexOf('Nr' + inttostr(iI)) + 1] = '1then
        begin
          if StrList.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]) = (-1) then
          begin
            if ((strtofloat(Frame_1.savestring[Frame_1.savestring.IndexOf('NR' + inttostr(iI)) + 2])) /
                 (strtofloat(Frame_1.savestring[Frame_1.savestring.IndexOf('NR' + inttostr(iI)) + 3]))) <
                   (Frame_1.FailRatio - 0.2) then
            begin
              StrList.Add(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]);
            end;
          end;
        end;
      end;
    end;
  end;
  if StrList.Count >= 3 then
  begin
    iI:=random(StrList.Count);
    Frame_1.SVoksToDo.Add(StrList[iI]);
    repeat
      kI:=random(StrList.Count);
    until kI <> iI;
    Frame_1.SVoksToDo.Add(StrList[kI]);
    repeat
      lI:=random(StrList.Count);
    until (lI <> iI) and (lI <> kI);
    Frame_1.SVoksToDo.Add(StrList[lI]);
  end;
  StrList.Clear;

  //2 Zufall

  for iI := 1 to Frame_1.OverAllVok do
  begin
    If ((strtoint(Frame_1.savestring[(Frame_1.savestring.IndexOf('NR'+ inttostr(iI)) + 5)])) < Frame_1.acuteLekt) then
    begin
      If Frame_1.SVoksToDo.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]) = (-1) then
      begin
        if Frame_1.savestring[Frame_1.savestring.IndexOf('Nr' + inttostr(iI)) + 1] = '1then
        begin
          if StrList.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]) = (-1) then
          begin
            StrList.Add(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]);
          end;
        end;
      end;
    end;
  end;
  if StrList.Count >= 2 then
  begin
    iI:=random(StrList.Count);
    Frame_1.SVoksToDo.Add(StrList[iI]);
    repeat
      kI:=random(StrList.Count);
    until kI <> iI;
    Frame_1.SVoksToDo.Add(StrList[kI]);
  end;
  StrList.Clear;

  // Auffüllen etwaiger Lücken
  if Frame_1.SVoksToDo.Count < 15 then
  begin
    // 2 Zufall
    for iI := 1 to Frame_1.OverAllVok do
    begin
      If ((strtoint(Frame_1.savestring[(Frame_1.savestring.IndexOf('NR'+ inttostr(iI)) + 5)])) < Frame_1.acuteLekt) then
      begin
        If Frame_1.SVoksToDo.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]) = (-1) then
        begin
          if Frame_1.savestring[Frame_1.savestring.IndexOf('Nr' + inttostr(iI)) + 1] = '1then
          begin
            if StrList.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]) = (-1) then
            begin
              StrList.Add(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]);
            end;
          end;
        end;
      end;
    end;
    if StrList.Count > 0 then
    begin
      if Frame_1.SVoksToDO.Count = 1 then
      begin
        Frame_1.SVoksToDo.Add(StrList[random(StrList.Count)]);
      end
      else
      begin
        iI:=random(StrList.Count);
        Frame_1.SVoksToDo.Add(StrList[iI-1]);
        repeat
          kI:=random(StrList.Count);
        until kI <> iI;
        Frame_1.SVoksToDo.Add(StrList[kI-1]);
      end;
    end;
    iI:=15-Frame_1.SVoksToDo.Count;
    if (iI >= 1) and (Frame_1.LastVokIndex <= Frame_1.OverAllVok) then
    begin
    showmessage('wird ausgeführt');
      for jI := 1 to iI do
      begin
        If not (Frame_1.LastVokIndex > Frame_1.OverAllVok) then
        begin
          inc(Frame_1.LastVokIndex);
          If Frame_1.SVoksToDo.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(Frame_1.LastVokIndex))+7]) = (-1) then
          begin
            Frame_1.SVoksToDo.Add(Frame_1.savestring[Frame_1.savestring.IndexOf('NR' + inttostr(Frame_1.LastVokIndex))+7]);
          end;
        end
        else
        begin
          break;
        end;
      end;
    end;

    if (iI >= 1) and (Frame_1.LastVokIndex > Frame_1.OverAllVok) then
    begin
      for iI := 1 to Frame_1.OverAllVok do
      begin
        If Frame_1.SVoksToDo.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]) = (-1) then
        begin
          if Frame_1.savestring[Frame_1.savestring.IndexOf('Nr' + inttostr(iI)) + 1] = '1then
          begin
            if StrList.IndexOf(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]) = (-1) then
            begin
              StrList.Add(Frame_1.savestring[Frame_1.savestring.indexOf('NR' + inttostr(iI))+7]);
            end;
          end;
        end;
      end;
      for kI:=1 to (15 - Frame_1.SVoksToDo.count) do
      begin
        // lI:= random(StrList.Count)+1;
        Showmessage('gehhht');
        //=========>
        Frame_1.SVoksToDo.Add('geh doch, mannooo'); //mache ich es weg geht's, andernfalls der Error!
        //<=========
        //StrList.Delete(lI - 1);
      end;
      StrList.Clear;
    end
    else
    showmessage('ERROR');
  end;
  StrList.Clear;
end;
end.
Ist die makierte Zeile weg geht es, andernfalls nicht...
immer noch nicht
---Zufall ist das Inkognito Gottes---
  Mit Zitat antworten Zitat
hamburcher
(Gast)

n/a Beiträge
 
#26

Re: TStringList bringt mich zum VerZweiFeln

  Alt 15. Sep 2008, 21:22
@mkinzler: Über neunzehntausend Posts in der DP, ist das nicht toll, Aldäh...

Kommst Du ins Guiness-Buch der Weltrekorde, Aldäh...

Weshalb bist Du noch kein Moderator in der DP geworden, Aldäh...

Too hard to handle?
  Mit Zitat antworten Zitat
Benutzerbild von Spiderpig_GER_15
Spiderpig_GER_15

Registriert seit: 17. Mär 2008
298 Beiträge
 
Delphi 7 Personal
 
#27

Re: TStringList bringt mich zum VerZweiFeln

  Alt 15. Sep 2008, 21:25
wow, stimmt,

hat aber noch jemand btw ne Idee für mein Problem???
---Zufall ist das Inkognito Gottes---
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#28

Re: TStringList bringt mich zum VerZweiFeln

  Alt 15. Sep 2008, 21:37
Für den Code mal in Einzelschritten aus.
Markus Kinzler
  Mit Zitat antworten Zitat
Benutzerbild von Spiderpig_GER_15
Spiderpig_GER_15

Registriert seit: 17. Mär 2008
298 Beiträge
 
Delphi 7 Personal
 
#29

Re: TStringList bringt mich zum VerZweiFeln

  Alt 15. Sep 2008, 21:58
wie geht das
---Zufall ist das Inkognito Gottes---
  Mit Zitat antworten Zitat
Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#30

Re: TStringList bringt mich zum VerZweiFeln

  Alt 15. Sep 2008, 22:08
Zitat von Spiderpig_GER_15:
wie geht das
Tipp: Klick mal aufs Menü "Ausführen"
Thomas
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 3 von 4     123 4      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:21 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz