Forum > IDE/CodeTools
Reload a Frame instance while preserving custom properties
Nel_Fie:
Unless there's already a way to do it that I haven't found yet, I think it would be very useful to have a way to reload/refresh an instance of a custom TFrame, ideally while preserving custom properties, event bindings, etc...
As it currently is, the only way I know to achieve this requires deleting the Frame instance and creating a new one, then reapplying all the custom properties by hand, which can get a bit tedious. So it would be a really nice time-saver to have this whole process automated as an action in the right-click menu of Frame instances, for example.
MarkMLl:
Do all your configuration of the content of a frame when the frame is being edited by the IDE. Instantiating a frame onto a form and then editing some of its properties is a recipe for disaster, to the extent that you might need to fix it by editing the form's .lfm as a text file.
Please take that as a statement of fact: I'm not attempting to defend the situation, or attempting to defend the fact that an instantiated frame is not read-only (at least by default).
MarkMLl
mas steindorff:
as a TFrame, you can customize it's code and add your own "reset" or return to default function. since a TFrame can be made up of different components, which ones are you trying to return to "default"?
Nel_Fie:
--- Quote from: MarkMLl on August 31, 2024, 03:23:52 pm ---Do all your configuration of the content of a frame when the frame is being edited by the IDE. Instantiating a frame onto a form and then editing some of its properties is a recipe for disaster, to the extent that you might need to fix it by editing the form's .lfm as a text file.
Please take that as a statement of fact: I'm not attempting to defend the situation, or attempting to defend the fact that an instantiated frame is not read-only (at least by default).
MarkMLl
--- End quote ---
Huh. And here I thought being able to modify an instantiated frame was very much intended, as a way to adapt it to the specific context of the instance.
--- Quote from: mas steindorff on September 01, 2024, 01:25:50 am ---as a TFrame, you can customize it's code and add your own "reset" or return to default function. since a TFrame can be made up of different components, which ones are you trying to return to "default"?
--- End quote ---
I think we're talking about different things, or else I'm not sure I understand what you mean. I'm not talking about resetting the instance of a Frame to a "default" at runtime, but about re-loading/re-inserting it in the IDE, from the original unit/files that describe that TFrame, in such a way that I would also implement any modifications made to the original since it was first instantiated.
The current situation is a bit simpler than I originally thought, however: an instance (or at least parts of it, such as an added or removed component) can be reloaded by closing the Form or Frame containing the instance and everything related to it, then opening it again. A bit of a hassle, but better than having to recreate the instance entirely.
EDIT: Scratch that. I just tried it again, and now I'm getting an "The LFM file contains invalid properties" error for the Form containing the instance. All the "invalid" properties are related to the instantiated frame. So, not an entirely safe method.
cdbc:
Hi
1) create you frame and design it visually, DO NOT PUT IT ON THE FORM!
2) when satisfied with your frame, create it in code on form startup,
ONLY IN CODE I.E.: DYNAMICALLY!
3) It's ok to design and redesign your frame(only) in oi but don't instantiate it
on the form.
This is a proven way to handle your predicament.
Regards Benny
Navigation
[0] Message Index
[#] Next page