EDIT: I believe I found the resolution (in comments). Funny how when you're force in an email to list specific issues, you'll often find you own answer with the increased clarity. I think this happened, leaving the post here for later searching from someone.

EDIT: I believe I found the resolution (in comments). Funny how when you're force in an email to list specific issues, you'll often find you own answer with the increased clarity. I think this happened, leaving the post here for later searching from someone.

Q: Visual Form Inheritance in XE2 VCL: Changes to base form's design-time components don't propagate to inherited forms.

1) BaseForm contains mostly run-time code
2) BaseFormWithButtonBar contains visual components of a panel and 3 buttons
3) BaseFormWithButtonBarAndImage contains an image

I have 3 forms, they are created as inherited forms from each other. #1 setups up a form with my foundation code, #2 builds on this by adding a common set of buttons, #3 adds an image to the form.

Problem #1: When I change the Width/Height of #1, the inherited forms don't get the new width/height

Problem #2: When I make changes to the button's top/left, the inherited forms don't get the change

In regards to Problem #1 Specifically:
- When I convert.exe it from DFM to a TXT, it specifies the correct Width:640 Height:480, but when I convert to DFM and then look at it in the IDE, it's changed to Width:451 Height:304. I'm confused, maybe it's the Align==alClient? It's weird.

object FBPSFrameBaseClass: TFBPSFrameBaseClass
  Left = 0
  Top = 0
  Width = 641
  Height = 480
  Align = alClient
  TabOrder = 0
end

Similar things happen to the #2 form, that defines buttons, the Top/Left just get mangled for inherited forms based on it.

Comments

  1. When inheriting Forms (TForm), I was always taught to modify the DFM. Using your example above, it would change to:

    inherited FBPSFrameBaseClass: TFBPSFrameBaseClass
      Left = 0
      Top = 0
      Width = 641
      Height = 480
      Align = alClient
      TabOrder = 0
    end

    Frames, no idea - I have only just started to use them.

    ReplyDelete
  2. Yup! Gotta make that change to the DFM declaration on the new type. Turning off alClient is the key too.

    ReplyDelete
  3. You can enforce a larger size by setting size constraints.

    ReplyDelete

Post a Comment