05-08-2018, 05:06 PM
(This post was last modified: 05-08-2018, 05:07 PM by ScottWGast.)
(05-04-2018, 04:51 PM)EitanArbel Wrote: i found that working dynamically with Frames in iw is the same as in a vcl app, but it's not so simple and it's not like using a regular component.
i think you would need to register the Frame as a Class.
in EVERY Frame that need it, just before your Frame's type, add this :
type TFrameClass = Class of TIWAppForm;
then as usual :
type
TFrameMyRegisteredFrame = class(TFrame)
...
private
...
public
end;
and before the "end." add :
initialization
RegisterClass(TFrameMyRegisteredFrame);
another way is to work with Interfaces, but i never tried it myself so maybe you can dig into that and see if it's better for you.
don't forget to set the Frame's Parent when you create it in runtime, and also assign different names if you have more then one of the same frame.
currently, my app have about 300 Forms and Frames, so i looked for a more efficient way.
after many tries, i got to the conclusion that it doesn't worth the pain, so i converted many of my frames to be Forms...
Thank you for the advise
I've had a high degree of success using frames for pretty much everything; assigning the frames to a single form.
After some thought, I figured out what my question actually is:
Since I have multiple frames, all of differing types, does my array need to be of pointers where I would assign the frame to the array element by reference? The system "knows" the individual array element's Type (TframeBase, TframeEditBase, TframeGridBase, etc...) so I can cast the array element using the appropriate frame type.
(05-04-2018, 04:51 PM)EitanArbel Wrote: i found that working dynamically with Frames in iw is the same as in a vcl app, but it's not so simple and it's not like using a regular component.
i think you would need to register the Frame as a Class.
in EVERY Frame that need it, just before your Frame's type, add this :
type TFrameClass = Class of TIWAppForm;
then as usual :
type
TFrameMyRegisteredFrame = class(TFrame)
...
private
...
public
end;
and before the "end." add :
initialization
RegisterClass(TFrameMyRegisteredFrame);
another way is to work with Interfaces, but i never tried it myself so maybe you can dig into that and see if it's better for you.
don't forget to set the Frame's Parent when you create it in runtime, and also assign different names if you have more then one of the same frame.
currently, my app have about 300 Forms and Frames, so i looked for a more efficient way.
after many tries, i got to the conclusion that it doesn't worth the pain, so i converted many of my frames to be Forms...
Thank you for the advise
I've had a high degree of success using frames for pretty much everything; assigning the frames to a single form.
After some thought, I figured out what my question actually is:
Since I have multiple frames, all of differing types, does my array need to be of pointers where I would assign the frame to the array element by reference? The system "knows" the individual array element's Type (TframeBase, TframeEditBase, TframeGridBase, etc...) so I can cast the array element using the appropriate frame type.