GUI systems seem to use two different positioning systems: coordinate-based and nested. The coordinate approach seems to lend itself to better visual positioning (WYSIWYG), while nesting seems to be more conducive to re-sized screens. I think coordinate-based approaches better fit corporate culture because you can make it very close to how the customer or boss wants it. Plus, nesting often creates surprises when things don't wrap as anticipated. Examples of coordinate-based GUI: VisualStudio (VisualBasic, VisualCee), Delphi Examples of nested GUI: JavaAwt and JavaSwing using LayoutManager''''''s, MozillaXul, HTML tables with no height or width attribute, TclTk, GTK+, Qt. Meldings of the two: Apple's InterfaceBuilder, SpringsAndStruts, Java EclipseIde Visual Editor. CSS doesn't really fall into either category, does it? Most of its work is done without explicit coordinates... of course I refer only to pure HTML with CSS here; Javascript muddies things. ''CSS falls into the melding category IMO. (is that what you said?) normally it's nested, but specifying position:relative or position:fixed turns it into a coordinates based system for that element, with its descendents being nested.'' ---------- Be aware that this title seems to present a FalseDichotomy. Examples of non-coordinate-based non-nested GUIs include declarative relative-layout (with statements such as 'above', 'below', 'left of', 'right of', 'behind', 'in front of', 'within', conditional appearance, etc. These are, admittedly, less common than some other systems, but they are also relational (no 'hierarchy' of rules as per nested GUI) and delightfully composable (in the sense that the 'automatic' positioning rules may be combined for AutomaticVsManualPlacement). I don't know of any frameworks for this that I haven't written myself, though. * Perhaps the title should be "absolute versus relative positioning GUI". However, it's the sort of thing that if you think about long enough, you'd probably have to add gajillion caveats and disclaimers into the title. ** If you need to add caveats, that's a smell that you have the wrong title. So is a FalseDichotomy. Something like 'AutomaticGuiLayoutConventions' would be more accurate. ** ''I disagree. Brevity often trumps accuracy for titles. They do not need to carry the full weight of all possibilities. That's why they have content. (I've had this debate somewhere already.) Plus, the common 2 are the main attractions. We can't keep toggling the title every time a small side alternative is mentioned. That's not economical.'' ** Only very rarely does one '''need''' to sacrifice brevity for accuracy or correctness. You are too willing to make unnecessary sacrifices, and to claim that you did so for "brevity" is usually to lie to yourself and your audience. I think you're simply being lazy and short-sighted. Do you also dump your liquid waste on the floor of your home because it is slightly closer than the lavatory? ** ''You didn't address my points, but I don't want to argue about titles. The damned title is fine how it is.'' ** The title as it is is a FalseDichotomy, is not particularly 'brief', and your defense of it has been totally irrational. For example, you wouldn't need to "toggle the title every time" if you had applied your brain for the few brief seconds it would have taken to realize that "Nested" isn't really all that common and there would be many alternatives to mention. Over 50% of this page is dedicated to 'alternatives', so I consider your "the common 2 are the main attractions" to be a misrepresentation at best and a lie at worst. Why do you even bother with such total StrawMan arguments? Lazy. Short-sighted. That's why. You seem to get upset over page titles that you see as 'inflammatory' (such as BrainDamage). If you swear to never argue about those, then I'll not bother you with your illogical FalseDichotomy titles. Deal? ** ''Dude, you are being anal again. Go obsess on something else.'' ** Dude, you're oozing and seeping nasty irrational shit all over the place again. Learn to keep it shut. ** ''Why "automatic" in your suggestion?'' ** There are reasonable debates on AutomaticVsManualPlacement. If there was no such debate, or there was some implication in the opening that you wished to include discussion of manual layout issues (such as persistence, per-user views, etc.), then I would not have included the word "automatic". ** ''Fully automatic to me means that the designer gives no info whatsoever about placement. This excludes below, above, right, left, etc. "Automatic" is relative.'' ** Automatic, I'll agree, is relative (and staged/layered). AutomaticVsManualPlacement still makes it clear that in "manual" placement the '''user''' is responsible for placement, not the designer. Sometimes user is designer, so there is overlap, but the dichotomy ''in the roles'' is one that can commonly be cleanly applied in the real world. What framework actively supports users in moving buttons, text-boxes, other arbitrary display elements, etc. around? Would you like to discuss such frameworks here? ''There is also coordinate-relative, such as '5 pixels from the upper-left corner'. This isn't as composable in the sense that a composition cannot simply insert something 'between' two other display items without first explicitly moving the items around. A claim is made below that 'Nested GUIs' are often coordinate-relative in this sense.'' -------- '''Summary of Arguments''' '''Advantages of Nested Gui's''' * Generally adjust more automatically to screen size/resolution * Allows for modularity of groups of gui elements (e.g. reuse of sub-dialogs). ''Disputed by some'' * Easier to internationalize as GUI components can scale to text and reorganize for character order localization. '''Disadvantages''' * Visual design tools for nested GUI's are not as easy to create. * Can be difficult to fine-tune placement (disputed by some below). I personally think that each has its strengths and weaknesses and each is better for different situations. Thus, ideally a GUI kit should make '''both''' available. Some GUI kits have "layout managers" that include a coordinate-based placement as one of the layout techniques for the given "panel". Generally they include at least: * Relative placement with directions (up, down, left, right) * Grid-based where the grid elements are dynamic * Coordinate The panels can be nested so that one can mix-and-match. HTML does this to some extent by mixing tables (grid) with relative placement. Each "cell" in the table is like an independent panel where you can use the (default) relative placement or define yet another table within it. -- top ---- Limitations of absolute positioning are very apparent if we will try to see site like cnn.com on a screen with fine resolution and small size ( 1400x1050 on my 15 in. notebook screen ), everything looks small and makes it difficult to read and use. Sites like java.sun.com use relative positioning and fit nicely on my screen and very useful when I use Mozilla's CTRL(+) for zooming. ''Coordinate-based does not necessarily preclude zooming. It may just be bad design. A good design would perhaps make it so that only ads or menus go out of direct view when zooming, not specific articles.'' ---- One of the alleged drawbacks of the coordinate approach is that things are not "grouped". In practice, I think I would rather have set-based grouping anyhow rather than nested. For example, the group that may belong to a given entity may be different from or orthogonal to the group that you want to put a square around. Hierarchies are too limited in my opinion with regard to grouping options. See LimitsOfHierarchies. [What do you mean by this? Obviously, a logical grouping of controls doesn't necessarily (but probably should) have anything to do with how they're displayed on your screen. But when you're talking about 'layout', then of course controls have to be grouped with the box around them. Logical/programmatic grouping and layout grouping don't have to have anything to do with each other.] That is true, but generally tools tend to assume they are the same. But if they allow/implement orthogonal grouping for non-visual stuff, then why not also allow it for visual stuff? I suspect because it requires more training to work effectively with sets than trees. ---- IME, the coordinate approach has a great inertia against change. Want to add a new field? Shift everything over manually, the position of every control depends on the size and position of every other controls. With nested, you just add the field and you are done. ''True, but it is usually easier to find the add location to begin with with coordinates, and a good IDE usually makes it simple to select a group of widgets to move down as a group. Then again, it depends on the particular form arrangement.'' ''(I don't know if "tab order" comes into play. If tab order allows decimals, then inserting something in between is usually not a problem. It is the integer-based tab orders which are a headache IMO.)'' I assume you really mean it is easier to find the add location to begin with '''in the visual tool''' you are using, because I find that, in the source, "add(control, 123, 234)" is just as tough to find as "add(control)". If we are comparing visual tools, it is just as easy, if not easier, to find the location to add your control, at least in VAJ the last time I used it, (it list a tree view of all the controls starting from your main window, making the nesting of the controls very clear). ''For complex GUI's, trees often stink IMO - LimitsOfHierarchies. For example, I often want to group, filter, or move by rather orthogonal criteria. Trees don't handle orthogonality very well.'' [You're talking about your convenience at design-time vrs. functionality at run time again. Regardless, it's a functionality of a specific visual tool, not any sort of consequence of coordinate based layout] I am not sure what you mean. ---- Or StructuredGraphics versus StructuredDocuments. The former appeals to graphical artists, those with a visual orientation, the latter to textual artists, those with a language orientation. ---- I didn't understand the term "nested" until the examples were added. How about "flowed" instead? -- KrisJohnson ''I think we're actually talking about static vs dynamic... i.e., hardcoding the relationships numerically between componenents/sizes vs dynamically assigning them through constraints of some form.'' ''The fact that a dynamic layout is 'flowed' as opposed to 'nested' (widgets in containers in containers etc) isn't really the issue'' The "HTML tables with no height or width attribute" example is what led me to believe that "flowing" is the issue rather than "nesting", as does the "when things don't wrap as anticipated" phrase in the prologue. -- kj ''But if it does have height or width attributes in parts of it, is it something in-between? I am okay with "flow" if you want to change the title, but perhaps there is a non-hierarchical flow approach possible, although I cannot envision it right now.'' ''[delete when section when forces resolved]'' "Flowing" is a consequence of the second way, but not its defining characteristic. When you're discussing HTML, this tension is characterized as "visual vs. semantic." Not sure if it applies as well here. -- francis ''How about'' Flow-based: hierarchical nesting without absolute coordinates Coordinate-based: uses absolute coordinates Mixed: Uses some nesting and some absolute coordinates ---- It seems that there are several distinct "axes" being considered here: * Flat organization (all components are siblings) vs. hierarchical organization (containment) * Absolute positioning (components share a common reference point) vs. relative positioning (components use other components as reference points) * Numeric vs. non-numeric position specifications * Screen pixel-based coordinates vs. logical coordinate systems * Explicit layout by developer vs. automated constraint-based layout * Edit/compile-time layout vs. run-time layout * Visual vs. semantic (which I understand to mean "Based on what looks good vs. based on the logical structure of the data") Most real-world GUI systems provide some level of support for each extreme on each axis. A developer can usually make any system work any place along any of the axes, so this is not an "either-or" situation, but a "how easy is it to do what I want" situation. While certain combinations are more useful than others, I don't think "coordinate" vs "nested" makes it very clear exactly what we are talking about. Neither does "flow" or "layout". Maybe this page needs to be split up, or maybe somebody needs to clarify what the topic is. -- KrisJohnson Associative layouts (most widgets layouts are determined by a relationship to a different widget), as opposed to independent layouts (where most widgets layouts are determined by a relationship to a top-level container) ''I think that is the same as "absolute positioning vs. relative positioning" in the bullet list above.'' ---- ''What are examples of "non-numeric" and "logical coordinates"?'' "Non-numeric position specifications" would be something like "to the left of object X", or "between objects X and Y", or "at the top of the window" or "half the width of the screen" (you might claim that "half" is numeric). A "logical coordinate system" is one that is not directly tied to hardware pixels; you might use percentages of window size, for example. ---- What about auto-generation of GUIs, such as a rule based system that ''generates'' GUIs for corresponding models? Coordinate systems can't handle that. It would then be more of Esthetic vs Model Based. Esthetic will imply the layout was based on visual appearance (a VB application where coordinates are hardcoded) and Model Based would imply that the GUI is generated from a model and comes out of the model. If your application does not auto-generate GUIs, then Flow based layout does not offer much other than resizability. ''Auto-generation is usually used for preliminary arrangement in my experience. One then makes custom adjustments.'' I do not mean auto-generation of ''code''. I meant generation of GUI at run-time. -- AnonymousDonor ---- '''Users are Picky Down to the Pixel Level''' I am suggesting that auto-generated GUI's are fine for prototypes, but users or customers often want to tweak stuff in ways that flow-based cannot easily handle. There are certain esthetic "rules" that a flow engine just has no clue about; perhaps because it is a subjective thing. But TheCustomerIsAlwaysRight even if they want stupid things. In other words, coordinate-based allows you to do stupid or illogical things easier with the layout. For example, some things might tend to ''almost'' line up out of '''pure coincidence'''. The customer looks at it and says, "could you line these up better, please?" not knowing or caring that it is just coincidence that they are almost lined up. The flow engine has no idea that a bunch of things happen to coincide in length or position. With coordinate-based, you simply shuffle things around a bit in a WYSIWYG tool to make them line up all the way. No fuss, no hassle, no NBSP-like filler things. Suppose we have some input fields with labels right-justified against them: ...Sdf asdf sflksjdf: [____] ....Eosjslk blkjasdl: [____] ............Grog sdj: [____] ..........Asdsdf sdf: [____] ............Sld bsok: [____] ...Ybwslkj blso apon: [____] ...Ublkjs mogk robno: [____] The user might look at the middle three fields as a visual group and say, "Those are almost aligned on the left side. Can you make them fully aligned?" Our framework only knows left, middle, and right aligned. It is blind to this coincidental alignment of the left-most characters in this case. (I would personally disagree with such a layout, but TheCustomerIsAlwaysRight. They don't appreciate lectures on "proper" layouts, they just want it as they envision it without "flak".) In a coordinate-based system you simply shuffle the text around to make it fit how the customer wants it to be: ...Sdf asdf sflksjdf: [____] ....Eosjslk blkjasdl: [____] ..........Grog sdj..: [____] ..........Asdsdf sdf: [____] ..........Sld bsok..: [____] ...Ybwslkj blso apon: [____] ...Ublkjs mogk robno: [____] (Dots used to avoid TabMunging. Unfortunately, the dots make it hard to see the alignment issue.) I realize that we can make a split sub-container in a nested model to left-justify the middle three, but it is a lot more work and it is hard to tell from the code what it is going on until it is actually rendered. I would rather just click-and-drag than introduce more UI fiddle faddle into the software code. The less we have to go back and nit with the code for esthetic purposes, the better. Adding yet more nestedness to "solve" things like this reminds me of AddingEpicycles. -- top * A non-broken layout management system can do that without blinking. Furthermore, unlike the coordinate based approach, it will continue to lay things out as specified even with the labels are translated into another language, or when the user selects a font with different kerning, or when it's run under a theme engine where the controls on the right are a different size. Yes, it involves nesting. No, that doesn't necessarily involve munging around with your code. Besides, what do you think all your pixel-twiddling is? That's code too. * ''I am skeptical it can do it conveniently. The computer can't "know" it looks odd to humans, especially if it only "bothers" a specific customer. Besides, change in language may create new coincidental oddities that need to be tweaked in or tweaked out just the same. The words that were short may be long in other languages, so the middle block issue may become irrelevant or different altogether with a different language. If you can provide some pseudo-code to illustrate how it can be handled via nested blocks, I would like to see it. I can tweak such easier with mouse dragging than with adding new text block layers into the GUI code. It is simple: See, Grab, Drag, Save, Done.'' -t ''You can do that in a flow layout system if it supports grids (like HTML tables). Having seen that the things almost line up, nail them to a grid.'' Why have the middle-man? Just use coordinates. Besides, grids don't handle the "almost" problem described above unless each cell is pixel-sized, in which case you have a coordinate system anyhow. I suggest you try the above exercise using HTML tables and record your changes. Note that at least you are going to have to split one column into two and give "colspan=2" tags on all the non-participant cells. Then you have to worry about the middle-most row lining up properly on the right because it will be left justified if we want it to match its two neighbors on the new left edge. Our first try will probably look like this: ...Sdf asdf sflksjdf: [____] ....Eosjslk blkjasdl: [____] ........Grog sdj....: [____] ........Asdsdf sdf..: [____] ........Sld bsok....: [____] ...Ybwslkj blso apon: [____] ...Ublkjs mogk robno: [____] There is no simple HTML command to tell it to line up both on the right side and match its two neighbors as the same time. That is an abstraction that HTML, nor any other known tool, was built to natively handle in a strait-forward way. In HTML it would likely require fiddling around with absolute cell widths or NBSP's. Something that would be 1 minute drag-and-move exercise under coordinates is now a 45-minute exercise in type-text-and-re-render, or as I like to call it: "nudge-N-fudge". Plus, it still might not render the same on another browser even after all that. Further, MS-IE has known layout bugs that they don't seem to be a in a hurry to fix. Note that this issue applies to the nested approach also, not just auto-generated GUI's. ''No it doesn't. Relative coordinates can be specified at any precision required.'' Relative coordinates? That is kind of a hybrid between the choices considered. ''No it isn't. What you refer to as "nested GUIs" are just GUIs that use relative coordinates. Swing and HTML both support relative and absolute positioning of components, and those positions can be expressed in pixels.'' I think we have some serious definition issues to work out. ''OK, let's start with the top of the page:'' "Examples of coordinate-based GUI: VB, VC++" ''These use absolute positions for components.'' "Examples of nested GUI: Java AWT and Swing using L''''''ayoutManagers, HTML tables with no height or width attribute, Tk." ''These support relative positions for components. Swing and AWT have a "null" layout manager that allows absolute positioning. HTML's divs can be relative or absolute.'' ''What other issues are there?'' I would not call HTML and Tk style "relative". Relative is "5 pixels from the corner of containing table cell". Here is a working taxonomy: * Absolute coordinates * Relative coordinates * Flow-based positioning (BTW, Tk has an optional coordinate-based geometry manager.) ''I've never used Tk, but HTML/CSS definitely supports relative positioning. (How else would you describe "