Sebastion
asked on
Delphi - Frames - Dymanically removing and adding
Hello,
Just using a basic scenario, lets assume that we have a single form with 2 buttons. One button says 'display frame one' while the other says 'display frame two'. In our project, we also have 2 frames (FrameOne and FrameTwo).
How do I display FrameOne when the first button is clicked, and then remove it and display FrameTwo when the second button is clicked. I think I have the 'remove old frame' right, so I basically just need the 'create new frame' method. In both cases, the frames are the same size and should be displayed on the same location on the form.
Just using a basic scenario, lets assume that we have a single form with 2 buttons. One button says 'display frame one' while the other says 'display frame two'. In our project, we also have 2 frames (FrameOne and FrameTwo).
How do I display FrameOne when the first button is clicked, and then remove it and display FrameTwo when the second button is clicked. I think I have the 'remove old frame' right, so I basically just need the 'create new frame' method. In both cases, the frames are the same size and should be displayed on the same location on the form.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I guess what I mean is whether .free is enough when closing a frame, before opening another.
Yes I am using 2 different frames, but I just assumed that would be what you are doing.
If your using the same frame twice, you would just need to referesh visual details, but then it wouldnt be worth using frames at all.
Yes you can just Free and Nil the frame to clear the variables, depends how often you are switching as to whether you want to keep recreating the form rather than updating on form components.
If your using the same frame twice, you would just need to referesh visual details, but then it wouldnt be worth using frames at all.
Yes you can just Free and Nil the frame to clear the variables, depends how often you are switching as to whether you want to keep recreating the form rather than updating on form components.
ASKER
From what I gather, you're using two different variables (frame1 and frame2). Is it possible to use just a single variable declared as a TFrame?
Also, with this method, are you just overwriting frame1 with frame2 (and vis versa), or are you freeing up the frame before writing in the new one?