SDI ¾îÇø®ÄÉÀ̼ǿ¡¼ ½±°Ô µ¥ÀÌÅÍ ¸ðÀ¸±â
Smart use of child forms lets you gather lots of data gracefully. Click to find out how.
Easily gathering data in an SDI application
Sometimes you need to create an SDI application that gathers a lot
of data. You could use tabs, but in some applications they aren't
appropriate-for instance, if you're asking multiple questions. Or,
using an Explorer metaphor, you could display different screens
depending on what the user selects in an outline/treeview.
The solution lies in using child forms that you can create as
separate windows at design time, but which are children of another
window at runtime. This technique is useful because the child
window loses its frame and title, and it appears as a control on
the parent form rather than as a separate window. In addition, you
avoid hiding and showing a large number of controls-you simply
show and hide the child form. And if speed is an issue, you can
pre-create the forms or create them as needed; you even can create
them in their own threads.
In the past, I overrode the form's CreateWindowHandle
method-however, I could nest the children only one level deep.
Borland confirmed this limitation, so I decided to override the
CreateParams method. I tested this technique at two levels, and
found that I can now nest for more than one level. You can find a
sample project in the file ChildForm.zip at
ftp://cobb.com/cpb/tipcode. (The comments in the MAK file
describe some pitfalls.)
|