Recent

Author Topic: Reload a Frame instance while preserving custom properties  (Read 1197 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 7511
Re: Reload a Frame instance while preserving custom properties
« Reply #15 on: September 04, 2024, 12:28:26 pm »
I have just recently worked with frames, and (after fixing the streaming issues) I was able to just edit a frame (ok, I only do certain edits) and I don't even need to touch the forms (or frames that nest the edited frame), and yet the compiled exe has all the changes.

So there are large parts that (nearly) work. I would not want to make them less reachable by hiding them behind some RO that then needs to be turned off to get the full experience.

That sounds great, and probably fixes most of the problems that people have had in the past :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10250
  • Debugger - SynEdit - and more
    • wiki
Re: Reload a Frame instance while preserving custom properties
« Reply #16 on: September 04, 2024, 12:37:26 pm »
I have just recently worked with frames, and (after fixing the streaming issues) I was able to just edit a frame (ok, I only do certain edits) and I don't even need to touch the forms (or frames that nest the edited frame), and yet the compiled exe has all the changes.

So there are large parts that (nearly) work. I would not want to make them less reachable by hiding them behind some RO that then needs to be turned off to get the full experience.

That sounds great, and probably fixes most of the problems that people have had in the past :-)

To clarify: "fixing the streaming issues" => I did not fix any of the code causing them. I fixed my local lfm files after they were generated, and was then able to work with them.

The code still needs fixing, unfortunately.

Nel_Fie

  • New Member
  • *
  • Posts: 26
Re: Reload a Frame instance while preserving custom properties
« Reply #17 on: September 05, 2024, 02:17:32 pm »
It was meant a reply to you first post.
Though it depends on what you meant by "refresh"

I assume that you changed the frame, but those changes aren't visible in the form on which the frame has already been added.

Then it depends what changes you made to the frame.

- Added a new component (and saved the frame)
=> just close and re-open the form

- Removed a component from the frame
=> This may work by reopening the form. BUt it may give an error then you need to remove the "inherited" entry for the deleted component from the forms lfm (which contains the frame lfm too)

=> Moved a component / change some other property (color, caption, ...)
Movement may not follow, because the frame saved the old coordinates to the frame lfm, and sticks to them. So you need to edit away the old coordinates.
Other properties may or may not need editing.

By Editing, you can however keep other changes. Such as caption for frame elements, that you intentionally modified in the form. And you keep settings of the frame itself, eg how it is anchored inside the form.



So when I have any such issue, I usually open the lfm, and remove any component within the frame, unless I have reason to keep it.  This is usually one or two blocks of lfm code to delete.
Then reopening the form and the frame will have its correct new state. And it will still be correctly place in form1 and have its events. (events on the frame, if there were events on components inside the frame, then those components had to be kept in the "delete" step, and maybe only had it's left/top removed).

Right, thank you very much for the clarification. This approach might come in handy at some point, although for now I'll probably stick to instantiating my frames in code.

 

TinyPortal © 2005-2018