1

I got own hierarchy of forms: TFORM->TKCustomForm->TKObjectForm->TFSObjectForm. TForm – standard Delphi class. TKCustomForm – implement basic logic of my application forms (debugging, logging, resizing, etc.). No DFM changing. DFM Code:

object KCustomForm: TKCustomForm
  Caption = 'KCustomForm'
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  ...
end

TKObjectForm - implement basic logic of dialog forms of application. Add custom published properties and events. Also add visual components (bottom panel with buttons ok, cancel, apply). DFM code looks like:

inherited KObjectForm: TKObjectForm
  Caption = 'KObjectForm'
  ...
  object pnlBottom: TKMovePanel    
    ...
    object pnlButtons: TKMovePanel
       object btnOK: TKButton
       ..
       end
      object btnCancel: TKButton
      ..
      end
      object btnApply: TKButton
      ..
      end
    end
  end
  object DataSource: TDataSource
    Left = 184
    Top = 152
  end
end 

TFSObjectForm – implement support of FastScript Engine. No dfm changes. DFM looks like this:

inherited FSObjectForm: TFSObjectForm
  PixelsPerInch = 96
  TextHeight = 13
end

All these files are in package. All works as expected, except I cannot see additional properties and events. I must every time set it manually in sources.

I find out that this problem can be fixed by using RegisterCustomModule method. It’s works fine if it used for showing published properties of one formtype or frametype, but for whole hierarchy it’s works in very strange way.

In Register method of package I add registration of all types by RegisterNoIcon([TKCustomForm, TKObjectForm, TFSObjectForm, TKIndepForm, TFSIndepForm]);

When I use RegisterCustomModule(TKCustomForm, TCustomModule); - it’s change DFM code in KObjectForm from inherited KObjectForm to object KObjectForm and nothing happens.

When I use RegisterCustomModule(TKObjectForm, TCustomModule); - it’s change DFM code in FSObjectForm from inherited FSObjectForm to object FSObjectForm, shows me additional properties in designer, but remove additional panel from form.

When I use RegisterCustomModule(TFSObjectForm, TCustomModule); - nothing happens. DFM code same in whole hierarchy, bottom panel with buttons appears, but additional properties still missing in TFSObjectForm and all accessors. I even try to republish properties from TKObjectForm in TFSObjectForm but it’s does not work.

How can I add components in dfm and make published properties visible in same parent class?

0 Answers0