2

If I have a form that contains a frame, and I edit the frame's layout in frame.pas/dfm file, it appears that sometimes (always?) the frame in the form does not get updated with new layout of the frame.

Up until now, I've been deleting the frame from the form and then re-importing it.

But I recall that there was a more efficient way to do this.

How?

RobertFrank
  • 7,332
  • 11
  • 53
  • 99
  • 1
    possible duplicate of [Delphi: frame properties do not update when I expect them to (they get stuck)](http://stackoverflow.com/questions/6946943/delphi-frame-properties-do-not-update-when-i-expect-them-to-they-get-stuck) – NGLN Oct 22 '11 at 08:06

2 Answers2

3

To cancel changes made to an inserted frame:

For controls on the frame: use Revert to Inherited in the context menu of those controls.

For the frame itself: use View as Text in the context menu of the form and delete the frame's size from the DFM.

To update an inserted frame to its declaration:

I suspect a quick toggle with View as Text and View as Form to force creation of a new instance of the form will do the trick.

NGLN
  • 43,011
  • 8
  • 105
  • 200
1

Once you edit the frame in form1 you will not be able to automatically get the changes in original frame1.pas /dfm.

until you edit any items in the frame in the form1 ,there is only a few information is in the form1.dfm so all the properties in the frame.dfm are used , but after editing in form1 the form1.dfm will have some information about the changes you did, so they will override the original frame1 properties So now you cant expect an automatic update.

If there is no any need to modify the frame in the form1(You said you need to modify the original one and if you modify both(original and the one in form1) it will definitely confuse you.

So do the changes in original one only, After finalizing that you can do changes in the forms you are using the frame.(because you may need to use specialized frame in different situations)

Or you can call the frame in run-time if all the instances of your frames are going to be the same

var
myframe  :TFrame ;
begin
  myframe := TFrame2.Create(self)    ;
  //better using a panel as a place holder
  myframe.Parent := Panel1 ;
  myframe.Show ;
 myframe.Left := 0 ;
 myframe.Top := 0 ;

end;
Vibeeshan Mahadeva
  • 7,147
  • 8
  • 52
  • 102
  • Thanks for the idea to create form at run time. – Jim Mack May 27 '17 at 14:58
  • I finally figured out that I was causing some of the problems by setting align after I placed frame down on the master form. Now I set the align on the frame itself -- obvious in retrospect! – Jim Mack May 27 '17 at 15:02