Autor Beitrag
Lux
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 104

Win XP Home
D2005 Pers.
BeitragVerfasst: Di 21.12.04 15:49 
Hallo.
Da bin ich mal wieder.
Mal eine doofe Frage:

Wenn ich nachdem ich mit
ausblenden Delphi-Quelltext
1:
2:
if OpenDialog1.Execute then
  pfadderliste := OpenDialog1.FileName;

den Pfad der Datei in die Variable "pfadderliste" speicher und ich danach dann gleich die procedure ListeInStringGrid(StringGrid1, pfadderliste) ausführen möchte. Scheint er das nicht mehr zu machen.

Wer kann mir dabei helfen?

Habs auch schon mit

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
if OpenDialog1.Execute then
  begin
  pfadderliste := OpenDialog1.FileName;
  ListeInStringGrid(StringGrid1, pfadderliste)
  end;

versucht. Klappte auch nicht...

_________________
There are 10 different people.
Those who understand binary code and those who don't understand.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Di 21.12.04 15:51 
:gruebel: Was macht ListeInStringGrid ?

AXMD
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Di 21.12.04 15:53 
Titel: hmm,
läuft er überhaupt da rein, schonmal Breakpoints gesetzt und durchgetraced ?

_________________
mfg. Joel
Lux Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 104

Win XP Home
D2005 Pers.
BeitragVerfasst: Di 21.12.04 16:35 
Also ListeinStringGrid soll eine Textdatei in eine StringGrid laden. Was normalerweise auch funktioniert.

Ich hab nun mal nachgeschaut, was er mir angibt wenn ich Haltemarken setze:

ListeInStringGrid: Not enough actual parameters

Könnt ihr mir sagen was das genau heißt?
Dass eines der beiden parameter, die ich ja angeben muss bei meiner procedure, nicht vorhanden ist oder wie?

Also pfadderliste ist vorhanden da hab ich nachgeschaut.

_________________
There are 10 different people.
Those who understand binary code and those who don't understand.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Di 21.12.04 16:38 
Der Quellcode dieser merkwürdigen Routine wäre vielleicht von Vorteil...

AXMD
Lux Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 104

Win XP Home
D2005 Pers.
BeitragVerfasst: Di 21.12.04 16:41 
Achtung ich kann noch nicht so gut formatieren ;)

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:
procedure ListeInStringGrid(FN: TFileName; SG: TStringGrid);
var
  i: Integer;
  S: string;
  Spalten, Zeilen, CountCols, CountLines, TabPos, StartPos, InitialCol: integer;
  Liste_String: TStringList;
begin
  Liste_String:= TStringList.Create;
  try
    //Datei laden
    Liste_String.LoadFromFile(FN);

    //Anzahl der Zeilen ermitteln
    CountLines := Liste_String.Count + SG.FixedRows - 10;

    //Anzahl der Spalten ermitteln
    CountCols := 6 + SG.FixedCols;

    //Anpassung der Grid-Größe
    if CountLines > SG.RowCount then SG.RowCount := CountLines;
    if CountCols > SG.ColCount then SG.ColCount := CountCols;

    //Initialisierung
    InitialCol := SG.FixedCols - 1;
    Zeilen := SG.FixedRows - 1;

    //Schleife durch allen Zeilen der Tabelle
    for i := 10 to Liste_String.Count - 1 do
    begin
      Spalten := InitialCol;
      Inc(Zeilen);
      StartPos := 1;
      S := Liste_String[i];

      TabPos := 16;
      Inc(Spalten);
      SG.Cells[Spalten, Zeilen] := Copy(S, StartPos, Tabpos);
      S := Copy(S, TabPos + 1, 999);

      TabPos := 14;
      Inc(Spalten);
      SG.Cells[Spalten, Zeilen] := Copy(S, StartPos, Tabpos);
      S := Copy(S, TabPos + 1, 999);

      TabPos := 25;
      Inc(Spalten);
      SG.Cells[Spalten, Zeilen] := Copy(S, StartPos, Tabpos);
      S := Copy(S, TabPos + 6, 999);

      TabPos := 11;
      Inc(Spalten);
      SG.Cells[Spalten, Zeilen] := Copy(S, StartPos, Tabpos);
      S := Copy(S, TabPos + 1, 999);

      TabPos := 10;
      Inc(Spalten);
      SG.Cells[Spalten, Zeilen] := Copy(S, StartPos, Tabpos);
      S := Copy(S, TabPos + 1, 999);

      TabPos := 9;
      Inc(Spalten);
      SG.Cells[Spalten, Zeilen] := Copy(S, StartPos, Tabpos);
      S := Copy(S, TabPos + 1, 999);
    end;
  finally
    Liste_String.Free;
  end;
end;


Hier der quellcode.

_________________
There are 10 different people.
Those who understand binary code and those who don't understand.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Di 21.12.04 16:46 
LOL; und der Compiler nimmt das an??? :rofl: Du solltest vielleicht versuchen, die Parameter in der richtigen Reihenfolge zu übergeben - ist vielleicht von Vorteil ;)

AXMD
Lux Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 104

Win XP Home
D2005 Pers.
BeitragVerfasst: Di 21.12.04 16:59 
huch. Das war falsch.

Zitat:
Habs auch schon mit

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
if OpenDialog1.Execute then  
  begin  
  pfadderliste := OpenDialog1.FileName;  
  ListeInStringGrid(StringGrid1, pfadderliste)  
  end;


versucht. Klappte auch nicht...


ListeInStringGrid(StringGrid1, pfadderliste) hab ich falsch wiedergegeben.
Ich habs im Quellcode auch als ListeInStringGrid(pfadderliste, StringGrid1) stehen... Sorry :roll:

_________________
There are 10 different people.
Those who understand binary code and those who don't understand.
Lux Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 104

Win XP Home
D2005 Pers.
BeitragVerfasst: Mi 22.12.04 10:41 
Hat sich erledigt.
Man sollte sich schonmal seinen Quellcode genauer anschauen.
Ich hab den Code andauern bei der Procedure Oeffnen.Click reingehauen.
Müste sie allerdings beim From.Create reinhauen... Ich bin auch ein Depp! Könnte mich selber hauen!
Sorry für die Mühen!

_________________
There are 10 different people.
Those who understand binary code and those who don't understand.