Now I'm developing some standalone application with GUI. But I haven't enough experience. So, what is good style to create module, flexible UI:
- 开发者_运维技巧
- Build all components tree in one place. or
- Parent know only about its children. Not deeper than one level in hierarchy.
Thanks.
you don't mention your language.
In Java look at the Swing library. It has object oriented structures defined with well documented message passing from object to object whenever events such as clicks occur.
There is no single way that is best. For small applications it is convenient to create all widgets in one place. As the project scales up in size the more it will benefit from a more modular approach. If the GUI is highly complex its better to break the UI into chunks, but even then its not necessarary to strictly follow the "parent only knows about its children" rule.
GUI componants are not much different than other software componants, so general good practices apply.
精彩评论