【发布时间】:2020-01-02 10:30:13
【问题描述】:
我的主窗体中有一个 TPageControl,其中包含 N 个 TTabSheets,我用它来嵌入多个 TFrame 后代。 对于我创建了一个“TBaseFrame”的框架,我从中派生出我想在 TabSheets 中显示的各个框架,或多或少看起来像这样......
TBaseFrame = 类(TFrame)
- TBaseFrameDescendant1 = 类(TBaseFrame)
- TBaseFrameDescendant2 = 类(TBaseFrame)
- TBaseFrameDescendantN = 类(TBaseFrame)
我遇到的问题是:我想创建一个过程,将我的任何 TBaseFrameDescendants 作为参数,创建给定的框架并将其显示在新的选项卡表中。我从这样的事情开始......
procedure CreateNewTabSheetAndFrame( What do I put here to accept any of my TBaseFrameDescendants? )
var
TabSheet: TTabSheet;
begin
TabSheet := TTabSheet.Create(MainPageControl);
TabSheet.Caption := 'abc';
TabSheet.PageControl := MainPageControl;
// Here I want to create the given TBaseFrameDescendant, set the Parent to the above TabSheet and so on
end;
猜我这里的主要问题是如何设置我的程序,以便我可以传递从我的 TBaseFrame 派生的任何帧,以便我可以在程序中使用它,还是我在这里走错了方向?
【问题讨论】:
标签: function oop delphi inheritance procedure