Forum > LCL

Clear a form?

<< < (2/2)


--- Quote from: captain jaster on October 27, 2010, 12:01:08 am ---
--- Quote from: Martin_fr on October 26, 2010, 07:40:57 pm ---Either use TPage without headers,
or design individual frames, and then show (Visible) one frame at a time.

--- End quote ---
This sounds about right...
But I need to be able to dynamically add TEdits to the form. Sort of like an Array of them. Though I can just use a stringrid :\ ... 

--- End quote ---

Ok, what stops you?

The TFrame can be used to swap between different "displays"

Then let's say "Frame3" is visible, and you need edits on it

--- Code: ---with TEdit.Create(Frame3)
  Parent := Frame3OrSomePanelInFrame3;
  Left := 0;
  Top := 50;
  // or use align, or anchors....

--- End code ---

If you need to remove them , you can keep them in an array:
  TEditArray = Array of TEdit;
but be aware, if you destroy (not hide, but really destroy) the frame, then the edits are destroyed too, and the refs in the array are pointing to random mem

or use TFrame.ComponentCount / TFrame.Components  to find the edits, by going over all the components displayed on that frame.
"Components goes by Owner, not by parent. So even if the edits are on a panel, they are owned by the Frame.
Use ControlCount / Controls for parent relationship


[0] Message Index

[*] Previous page

Go to full version