Reputation: 1
I've been working with a few RAD gui builders lately. I absolutely despise CSS ( camel is a horse designed by committee etc.) What algorithms are used by packing managers(java/tk). Most GUI toolkits I've used have some alternative to absolute positioning, sorry for the ambiguity but how do you start thinking about implementing a packing manger in language X.
Thanks for the replies, to clarify - I want to create a generic text file that defines a 'form' this form file can then be used to generated a native(ish) GUI form (eg tk) and also an HTML form.
What I'm looking for is some pointers on how a grid based packing manager is implemented so I can formulate my generic text file based on some form of established logic.
If this doesn't make sense to you then you understand me:). Some notes
1. XML lives in the same stable as the zebra and the camel but not the horse.
2. Think lightweight markup languages (Markdown/ReStructuredText) but for simple forms.
3. This has probably already been implemented, do you know where?
4. Yes, I have Googled it (many,many times),answer was not between G1 and o2
Thks
Upvotes: 0
Views: 313
Reputation: 385970
Tk has three methods. One is absolute positioning, the other two are called "grid" and "pack".
grid is just what it sounds like: you lay out your widgets in a grid. There are options for spanning rows and columns, expanding (or not) to fill a cell, designating rows or columns which can grow, etc. You can accomplish probably 90% of all layout issues with the grid geometry manager.
The other manager is "pack" and it works by requesting that widgets be placed on one side or another (top, bottom, left, right). It is remarkably powerful, and with the use of nested containers (called frames in tk) you can accomplish pretty much any layout as well. Pack is particularly handy when you have things stacked in a single direction, such as horizontally for a toolbar, vertically for a main app (toolbar, main area, statusbar).
Both grid and pack are remarkably powerful and simple to use, and between them can solve any layout problem you have. It makes me wonder why Java and wxPython have so many and such complicated geometry managers when its possible to get by with no more than three.
Upvotes: 3