Code: Alles auswählen
function TmyList.AddObj(toolindex:String;var inserindex:Integer;objlist:TObjectList = nil):TPaint2Object;
var
paint2obj:TPaint2Object;
index:Integer;
AClass:TPaint2Object;
AControl:TControl;
begin
fvt.Clear;
if (oldItemindex > -1) and (AktivDocument.objlist.count > 0 ) and (oldItemindex <=AktivDocument.objlist.Count-1) then begin
TPaint2BasesObj(AktivDocument.objlist[oldItemindex]).isfocus:=false;
end;
fBuffer.Canvas.Brush.color:=clBlue; paint2obj:=nil;
paint2obj:=nil;
paint2obj:=TPaint2Object(FindClass(toolindex));
if paint2obj <> nil then Writeln('= NIL -- !!');
writeln(paint2obj.ClassName);
if AClass <> nil then paint2obj:=AClass.Create(fBuffer);
if toolindex <> 'tImageListB' then begin
if paint2obj <> NIL then begin
if objlist = nil then begin
writeln(AControl.ClassName);
AktivDocument.objlist.Add(TPaint2Object( paint2obj));
index:=Documentlist[documentindex].objlist.Count-1;
result:=TPaint2Object(AktivDocument.objlist[index]);
end
else begin
if inserindex = -1 then begin
objlist.Add(TPaint2Object( paint2obj));
index:=objlist.Count-1;
end
else begin
if inserindex < objlist.count-1 then begin
objlist.Items[inserindex]:=TPaint2Object( paint2obj);
index:=inserindex+1;
end
else begin
objlist.Add(TPaint2Object( paint2obj));
index:=objlist.Count-1;
end;
end;
inserindex:=index;
result:=TPaint2Object(objlist.items[index]);
end;
end
else
result:=nil;
end
else begin
usrListBox.Items.AddObject(paint2obj.Name,tImageListB(TPaint2Object(AControl)));
result:=TPaint2Object(usrListBox.Items.Objects[usrListBox.items.Count-1]);
end;
if Documentindex > -1 then
AktivDocument.isMod:=true;
end; // AddOb
ich habe schon im Internet gesucht und auch was gefunden z.b. das ich den haupt Constructor als virtual defnieren muss das habe ich getan und alle abgeleiteten constructoren habe ich mit override gekennzeichnet