Einzelnen Beitrag anzeigen

Wishmaster

Registriert seit: 14. Sep 2002
Ort: Steinbach, MB, Canada
301 Beiträge
 
Delphi XE2 Architect
 
#5

AW: brauche hilfe mit der VirtualTreeView.

  Alt 15. Aug 2013, 04:49
hi
nochmal danke fur deine hilfe.

ich habe mich entschieden alles von hand zu machen. dazu benutze ich eine open source komponente von David J Butler
cStreams die ist nicht kompatibel mit der VirtualTreeView und TMemoryStream/TStream aber die komponente hat einige nette properties wie
Delphi-Quellcode:
    procedure WriteBuffer(const Buffer; const Size: Integer);
    procedure WriteStrA(const Buffer: AnsiString); virtual;
    procedure WriteStrW(const Buffer: WideString); virtual;

    procedure WriteByte(const V: Byte); virtual;
    procedure WriteWord(const V: Word); virtual;
    procedure WriteLongWord(const V: LongWord);
    procedure WriteLongInt(const V: LongInt);
    procedure WriteInt64(const V: Int64);
    procedure WriteSingle(const V: Single);
    procedure WriteDouble(const V: Double);
    procedure WriteExtended(const V: Extended);
    procedure WritePackedAnsiString(const V: AnsiString);
    procedure WritePackedWideString(const V: WideString);
    procedure WritePackedString(const V: String); {$IFDEF UseInline}inline;{$ENDIF}
    procedure WritePackedAnsiStringArray(const V: Array of AnsiString);
    procedure WritePackedWideStringArray(const V: Array of WideString)

Delphi-Quellcode:
procedure TMain_Form.Project_Save_ActionExecute(Sender: TObject);
var
 fWriter : TFileWriter;
 FFilename : String;
 Len :Int64;
 I : Integer;

 Node : PVirtualNode;
 Data : PNodeData;

begin
  FFilename := 'C:\..\Language Suite\test.dat';
  fWriter := TFileWriter.Create(FFilename);
 try

   (* Write Columns Count *)
   fWriter.WriteInt64(LanguageTree.Header.Columns.Count);

  for I := 0 to LanguageTree.Header.Columns.Count -1 do
   begin
    (* Write Column Width *)
    fWriter.WriteInt64(LanguageTree.Header.Columns[i].Width);
    (* Write Column Position *)
    fWriter.WriteLongWord(LanguageTree.Header.Columns[i].Position);
    (* Write Column Text *)
    Len:= Length(LanguageTree.Header.Columns[i].CaptionText);
    fWriter.WriteInt64(Len);
    fWriter.WriteStrW(LanguageTree.Header.Columns[i].CaptionText);
   end;

   // Save Nodes Test

   (* Write LanguageTree TotalCount *)
   fWriter.WriteLongWord(LanguageTree.TotalCount);

  If LanguageTree.GetFirst = nil then
   Exit;

   Node:= nil;

  repeat
   if Node = nil then
    Node:= LanguageTree.GetFirst
   else
    Node:= LanguageTree.GetNext(Node);
    Data:= LanguageTree.GetNodeData(Node);

   (* Write LanguageTree NodeLevel *)
    fWriter.WriteInt64(Data^.Level);

    (* Write Identifirer *)
    fWriter.WriteInt64(Length(Data^.Identifirer));
    fWriter.WriteStrW(Data^.Identifirer);

   (* Write Language *)
    fWriter.WriteInt64(Length(Data^.Language));
   for I := 0 to Length(Data^.Language) -1 do
    begin
     fWriter.WriteInt64(Length(Data^.Language[i].Text));
     FWriter.WriteStrW(Data^.Language[i].Text);
     fWriter.WriteInt64(Length(Data^.Language[i].Name));
     FWriter.WriteStrW(Data^.Language[i].Name);
     fWriter.WriteInt64(Length(Data^.Language[i].Ext));
     FWriter.WriteStrW(Data^.Language[i].Ext);
    end;

  until
    Node = LanguageTree.GetLast();


   //test end


 finally
  fWriter.Free;
 end;

 //Sava_Project();
end;
  Mit Zitat antworten Zitat