나는 너무 피곤하다고 생각하며 왜 작은 콜백이 작동하지 않는지 이해할 수 없습니다. 동적으로 생성 된 두 개의 프레임이 있는데 첫 번째 프레임을 보여 주며 한 번 클릭하면 두 번째 프레임을 보여줍니다. 두 번째 작업을 마치면 첫 번째 프레임을 표시하고 두 번째 프레임을 비우고 싶습니다. 코드 울부 짖는 소리입니다 : 두 번째 프레임델파이 - 콜백 잘못된 코드
procedure CommingBackFromFrame(aFrame:TFrame);
procedure TfraMain.ComingBackFromFrame(aFrame:TFrame);
begin
if Assigned(aFrame) then
begin
try
aFrame.Hide;
FreeAndNil(aFrame);
except on e:Exception do
//make a log
end;
Self.Show;//first frame show
end;
//code which creates the second frame
wFrm := TFrameType.Create(Application);//create the second frame
with wFrm do
begin
GoBack:=ComingBackFromFrame(wFrm);//error here
parent:=Self;
Show;
end; //with
Application.ProcessMessages;
코드 : 첫 번째 프레임에 대한
코드
TCallBack = procedure(aFrame:TFrame) of object;//callback declaration
TFrameType = class(Tframe)
...
private
FGoBack:TCallBack;
public
property GoBack:TCallBack read FGoBack write FGoBack;//publish callback
....
//at a moment, return to frame 1
if Assigned(fgoback) then
GoBack(Self);
사람이 나에게이 간단한 일을 도와 드릴까요?
이벤트 메서드의 매개 변수를 확보하기 위해 현명한 일이 결코 없다; 기본 객체는 여전히 호출 스택의 어딘가에서 사용될 수 있습니다. 나는 프레임을위한 'release'가 있는지 확신하지 못한다. (폼과 비슷하다.) 그런 식으로해야한다. –