* * *

Author Topic: TFrame - Revert to inherited  (Read 607 times)

PaulANormanNZ

  • Jr. Member
  • **
  • Posts: 81
TFrame - Revert to inherited
« on: June 26, 2018, 08:37:47 am »
Hi,

I have made a separate master TFrame with a TStrHolder from Rx\rx_laz\strholder on it.

Unfortunately I opened its descendant TStrHolder stored stringlist in my Project's actual Main Form, where I am using the descendant TFrame

Now of course when I update the original TFrame's  TStrHolder stringlist, my descendant one in my Project's MainForm does not reflect the changes in its prototype - even after reopening my project.

Changes made to the Master TFrame will be reflected in my Project's copy upon reopening - but only if I have not changed them in my Project's copy of TFrame.

Deleting and reinserting a TFrame would cost the loss of any actual wanted changes, made to it in the Project.

I found a discussion for the parallel problem in a Delphi posting, where a Delphi based solution exists...

https://stackoverflow.com/questions/6946943/delphi-frame-properties-do-not-update-when-i-expect-them-to-they-get-stuck

Quote
You don't need to delete the frame, just right click and select the controls you want to have their properties come from their master (original frame) properties, and click Revert to inherited.

I have been looking for our Lazarus' equivalent, and was wondering how we would achieve that please?

TIA,
Paul

wp

  • Hero Member
  • *****
  • Posts: 4911
Re: TFrame - Revert to inherited
« Reply #1 on: June 26, 2018, 10:15:41 am »
Edit the lfm file. Be careful, make a backup copy first.

This is how a frame, inserted without any other changes in its properties, is written to the lfm file:
Code: [Select]
  inline Frame1_1: TFrame1
    Left = 35
    Top = 16
  end 
I tested this with a frame containing just a button. When I change the width of the button in the inserted frame the form's lfm file changes the frame's section to
Code: [Select]
  inline Frame1_1: TFrame1
    Left = 35
    Top = 16
    inherited Button1: TButton
      Width = 160
    end
  end 
When I delete the Button1 block from the lfm file the button restores its old width defined in the frame.

This means that all properties of the inserted frame written to the lfm file override those defined in the frame's lfm file. So, if you want to get rid of the frame's TStrHolder stringlist, just delete the stringlist from the form's lfm file.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

PaulANormanNZ

  • Jr. Member
  • **
  • Posts: 81
Re: TFrame - Revert to inherited
« Reply #2 on: June 26, 2018, 02:52:57 pm »
Thnaks WP,

I'll have a go at that - so I take it there is nothing directly like "Revert to inherited".

Is that a feature request worth putting in somewhere?

Paul

wp

  • Hero Member
  • *****
  • Posts: 4911
Re: TFrame - Revert to inherited
« Reply #3 on: June 26, 2018, 03:14:04 pm »
Post a feature request on BugTracker. Users should not be forced to edit the lfm file.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus