Composing UI layout question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Composing UI layout question

Torsten Bergmann
Hi Igor,

I like the fraction/offset model from SmalltalkMT. I once ported
it to Squeak. This gives you full control on absolute and relative
positioning within the bounds of the parent and controls resizing
behavior. Only 4 parameters for anything you need ...

Example:

self
  addMorph: startButton
  to: pane
  offset: #(0 0 101 20)
  fractions: #(0 0 0 0).

means the button starts top left at x1=0, y1=0 with the bottom
right corner at x2=101 and y2=20. There is no fraction given -
so we have absolute positioning.

If you give a fraction you tell the system that for instance
a subpane should always start at 30% from the side of a parents box.
-> relative positions with resizing.

If you additionally give an offset you can define that there is
an additional absolute margin after the 30%. With a negative offset you
can absolute position the control/submorph on the other side of the 30%
virtual line.

With fractions: #(0 0 1 1 ) which means 100% the control will fill
the parent and will fully resize with it.

Smalltalk MT used 1000 for 100% of the parents area, but thats
only a definition.

Have a look at the project "Sandcastle" on Squeaksource, especially
Sandcastle-tbn.9.mcz.

SCApplicationWindow (a subclass of SystemWindow here) provides a few
methods to support this dynamic layout and its subclass SCWelcomeWindow
shows how you can use it.

Hope this helps

Bye
T.


--
Aufgepasst: Sind Ihre Daten beim Online-Banking auch optimal geschützt?
Jetzt absichern: https://homebanking.gmx.net/?mc=mail@...

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project