...scusa ho detto una cappellata...infatti la prova mi smentisce......
ti posto codice frame base e frame figlia...per quanto riguarda caricamento ho seguito il tuo esempio:
FRAME PADRE
unit FrameVis;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TVisualFrame = class(TFrame)
private
{ Private declarations }
protected
procedure visualizzaPannello(n:integer);virtual;
public
{ Public declarations }
end;
TVisualFrameClass = class of TVisualFrame;
implementation
{$R *.dfm}
procedure TVisualFrame.visualizzaPannello(n:integer);
begin
showmessage('peocedura modello frame');
end;
FRAME FIGLIA
unit FrameImm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, FrameVis,
ExtCtrls,variants;
type
TFraImmagini = class(TVisualFrame)
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Image1: TImage;
Image2: TImage;
Image3: TImage;
procedure VisualizzaPannello(n : Integer); override;
private
{ Private declarations }
//procedure VisualizzaPannello(const n : Integer);
public
{ Public declarations }
//property WhichPanel write VisualizzaPannello;
end;
implementation
{$R *.dfm}
procedure TFraImmagini.VisualizzaPannello(n : Integer);
begin
if n = 0 then
begin
panel1.Visible := True;
panel2.Visible := False;
panel3.Visible := False;
end;
if n = 1 then
begin
panel1.Visible := False;
panel2.Visible := True;
panel3.Visible := False;
end;
if n = 2 then
begin
panel1.Visible := False;
panel2.Visible := False;
panel3.Visible := True;
end;
end;
end.
ti posto anche parte della funzione loadPage, la quale viene eseguita senza problemi fino all'ultima linea che ti posto
procedure TMainForm.LoadFrame(FrameRef : TVisualFrameClass; n : Integer);
begin
// esce se non è richiesto nulla
if FrameRef = nil then exit;
// esce se ciò che è richiesto è già presente
if ActualFrame <> nil then
if ActualFrame.ClassType = FrameRef then exit;
// se devo cambiare la frame distruggo quella presente
if ActualFrame <> nil then
FreeAndNil(ActualFrame);
// ... e creo quella che mi serve
ActualFrame := FrameRef.Create(self);
Dopo esecuzione ultima riga genera l'errore...

Rispondi quotando