Re: Creating objects on a form at runtime
Posted by DelphiLand Team on February 24, 2005
In Reply to: Creating objects on a form at runtime posted
by Al p12406 on February 23, 2005
Of course, you can create a number of Edits dynamically. But there are disadvantages to this:
1. If you create a lot of TEdit components, this can become to heavy on the resources of Windows. And eventually, you will reach the system's limits. The limits depend on the number of "windowed controls" that are created by your program as well as all other running programs. This includes not only "windows" (forms) but also components like Edit, ListBox, and so on.
2. Creating lots of components at runtime takes time, which can be annoying on older PC's.
3. Last but not least, it's quite complicated to keep track of the newly created components. Because you don't know how much there will be, you have to create a list and add pointers to this list as you create the Edits. Later on, it's also not so easy to access the contents of the Edits.
But it's a lot easier to use a TStringGrid component. You can:
- dynamically change its number of columns and rows:
Which one do you prefer: do you insist on Edits, or do you want the StringGrid solution? Just let us know, and we'll cook up some well-tested code for you :))
Related Articles and Replies