View Issue Details

IDProjectCategoryView StatusLast Update
0011102FPCRTLpublic2008-05-12 21:44
ReporterMartin Schreiber Assigned ToMichael Van Canneyt  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version2.3.1 
Summary0011102: Childpos streaming not implemented
DescriptionStreaming childpos adjustment does not work.
fixes_2_2:
"
inherited comp2: tcomp2
  inherited comp1b: tcomp1[0]
  end
  inherited comp1a: tcomp1[1]
  end
end
0: comp1b
1: comp1a
"
trunk:
"
inherited comp2: tcomp2
  inherited comp1b: tcomp1
  end
  inherited comp1a: tcomp1
  end
end
0: comp1a
1: comp1b
"
TagsNo tags attached.
Fixed in Revision10637
FPCOldBugId
FPCTarget
Attached Files

Activities

2008-04-04 12:24

 

childpos.pas (2,038 bytes)   
program childpos;
{$ifdef FPC}{$mode objfpc}{$h+}{$endif}
{$ifdef mswindows}{$apptype console}{$endif}
uses
 {$ifdef FPC}{$ifdef linux}cthreads,{$endif}{$endif}
 sysutils,classes;
type

 tcomp2 = class(tcomponent)
  protected
   procedure setchildorder(child: tcomponent; order: integer); override;
   procedure getchildren(proc: tgetchildproc; root: tcomponent); override;
 end;

 tcomp1 = class(tcomp2)
  private
   fprop1: integer;
  published
   property prop1: integer read fprop1 write fprop1;
 end;

 tcomponent1 = class(tcomponent); 
 
{ tcomp2 }

procedure tcomp2.setchildorder(child: tcomponent; order: integer);
begin
 child.componentindex:= order;
end;

procedure tcomp2.getchildren(proc: tgetchildproc; root: tcomponent);
var
 int1: integer;
begin
 for int1:= 0 to componentcount - 1 do begin
  proc(components[int1]);
 end;
end;

var
 stream1,stream2: tmemorystream;
 str1: ansistring;
 writer1: twriter;
 reader1: treader;
 comp1: tcomp1;
 comp2,comp3,comp4: tcomp2;
 
 
begin
 stream1:= tmemorystream.create;
 stream2:= tmemorystream.create;
 comp2:= tcomp2.create(nil);
 comp2.name:= 'comp2';
 comp1:= tcomp1.create(comp2);
 comp1.name:= 'comp1a';
 comp1:= tcomp1.create(comp2);
 comp1.name:= 'comp1b';
 comp3:= tcomp2.create(nil);
 comp3.name:= 'comp2';
 comp1:= tcomp1.create(comp3);
 tcomponent1(comp1).setancestor(true);
 comp1.name:= 'comp1b';
 comp1:= tcomp1.create(comp3);
 tcomponent1(comp1).setancestor(true);
 comp1.name:= 'comp1a';
 tcomponent1(comp3).setancestor(true);

 writer1:= twriter.create(stream1,2048);
 writer1.writedescendent(comp3,comp2);
 writer1.free;
 stream1.position:= 0;
 objectbinarytotext(stream1,stream2);
 stream2.position:= 0;
 setlength(str1,stream2.size);
 stream2.read(str1[1],length(str1));
 write(str1);
 stream1.position:= 0;
 reader1:= treader.create(stream1,2048);
 reader1.readrootcomponent(comp2);
 reader1.free;
 writeln('0: '+comp2.components[0].name);
 writeln('1: '+comp2.components[1].name);
 
 stream2.free;
 stream1.free; 
 comp2.free;
 comp3.free;
 comp4.free;
end.


childpos.pas (2,038 bytes)   

Issue History

Date Modified Username Field Change
2008-04-04 12:24 Martin Schreiber New Issue
2008-04-04 12:24 Martin Schreiber File Added: childpos.pas
2008-04-12 20:43 Michael Van Canneyt Status new => assigned
2008-04-12 20:43 Michael Van Canneyt Assigned To => Michael Van Canneyt
2008-04-12 20:43 Michael Van Canneyt Fixed in Revision => 10637
2008-04-12 20:43 Michael Van Canneyt Status assigned => resolved
2008-04-12 20:43 Michael Van Canneyt Resolution open => fixed
2008-05-12 21:44 Martin Schreiber Status resolved => closed