Re: Programming Delphi all in text

[ Delphi Forum ] [ Delphi Tutorials -- by DelphiLand ]

Posted by webmaster Guido on May 16, 2003

In Reply to: Re: Programming Delphi all in text posted by julianbury on May 16, 2003

: I wish to design the forms without resorting to the visual design facility.
: It produces those "one-at-a-time" objects that defeat my design concept.

It's not desirable to design forms without the visual design, this makes it *very* complex, and it's only done by experts if there really is no other way to accomplish your goals.

In Delphi, you can design a basic form and change it as needed in runtime: add components, move them, change their properties and behavior, hide them, and so on... So you combine the best of visual design with "customization" in code, that is executed during runtime.

A few ideas:
Put a StringGrid component on the form and give it a default number of columns and rows, say 3 columns and 10 rows. You fill the StringGrid with data at runtime. Say that you named the component Grid1:

Grid1.Cells[0,1] := 'A';
Grid1.Cells[0,2] := 'B';
and so on... (of course, instead of 'A', 'B'... you use values that you extracted from your database).

If at a certain point there are not enough rows in the StringGrid, you just add rows as needed, also at runtime; this is very easy:

Grid1.RowCount := SomeNumber;

Note that in this way, you can even delete rows from the grid that are not needed.

Be aware though that this won't be an easy project, you'll need a lot of experimenting with Delphi...

Related Articles and Replies:

[ Post Followup ] [ Delphi Forum ]
[ DelphiLand: free Delphi source code, tips, tutorials ]