How to free up dynamically created frames?
In Delphi 2010... I have a form. On the left side of the form is a
Treeview. It shows a multi-level hierarchy. Assume 5 different types of
data, Type A, B, C, D and E. On the right side of the form, I have a panel
in which I will create a TFrame. If I click in my Treeview on a data
element of type 'A', I create a TFrame on the right side of the form which
shows tFrame 'A'. Basically I am showing details of the various
hierarchies of my TreeView. Each of the 5 types of data uses a different
type of TFrame. While I can dynamically create the TFrames, I am having
difficulty in knowing WHERE and HOW to delete/free the TFrames?
Do I create a variable which shows the TYPE of the previous TFrame? What
is the PROPER way to delete a TFrame? Is it with TFrame.Free? Keep in mind
I may need something like Create Frame A, Free Frame A, Create Frame B,
Free Frame B, Create Frame A (again), etc...
I have tried something along the lines of...
if Assigned (TFrameA), then TFrameA.free;
While this appears to work, this causes weird behavior (it caused a button
to disappear). It also means that I need to define all 5 types of TFrames
as Global Variables.
Any and all thoughts appreciated.
Thanks,
GS
No comments:
Post a Comment