Witam,
być może problem jest banalny ale nie wiem jak sobie z nim poradzić.
Mam zadeklarowaną klasę
TNodes = class (TPersistent)
private
FCountItems : Integer;
public
Node : array [0..1000] of TNode;
function NodeAdd (ParentID : Integer): Integer;
published
property CountItems : Integer read FCountItems write FCountItems;
end;
TTop = class (TPanel)
private
FHeader : THeaderControl;
FStringGrid : TStringGrid;
procedure MyOnDrawCell (Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
public
Nodes : TNodes;
Constructor Create (AOwner : TComponent); override;
Destructor Destroy; override;
function NextPaintedID (ID : Integer; Direction : Boolean) : Integer;
published
property Header : THeaderControl read FHeader write FHeader;
property StringGrid : TStringGrid read FStringGrid write FStringGrid;
end;
I teraz pojawia się mój problem.
W jaki sposób w metodzie NodeAdd klasy TNodes odwołać się do zmiennej klasy rodzica czyli do TTop;
Robie to tak, ale nie działa.
Poniższy przykład ma na celu zwiększenie ilości linii w stringgridzie podczas zwiększenia linii w klasie TNodes.
Na innym forum dotyczącym języka C przeczytałem, że w klasie TNodes trzeba zrobić wskaźnik do TTop, ale nie potrafię tego.
function TNodes.NodeAdd (ParentID : Integer): Integer;
begin
Top.FStringGrid.RowCount := FCountItems;
end;