How do I use or resolve issues with visual form inheritance in Delphi?

前端 未结 2 924
时光说笑
时光说笑 2021-02-03 10:09

I\'ve been working on a project in Delphi 7 where I wanted to have forms inherit components from other forms. I was able to get this working, but came across the following issue

2条回答
  •  Happy的楠姐
    2021-02-03 10:44

    The DPR seems a little bit trickier than that. In my case, I created an ancestor derived from TFrame. I then derived multiple frames from TAncestorFrame. My DPR's uses clause then looked like:

    uses
      Forms,
      ancestorFrame in 'ancestorFrame.pas' {AncestorFrame : TFrame},
      frame1Unit in 'frame1Unit.pas' {frame1:TFrame},
      frame2Unit in 'frame2Unit .pas' {frame2:TFrame},
    

    The DPROJ file should look like:

    
      
    frame1
    TFrame

    Derived Frames should look like:

    TFrame1 = class(TAncestorFrame)
    

    And Derived Frames .DFM files should say:

    inherited Frame1:TFrame1
    

提交回复
热议问题