eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'MultiColumnPanelView':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: MultiColumnPanelView


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--PanelView
               |
               +--MultiColumnPanelView

Package:
stx:libwidg
Category:
Views-Layout
Version:
rev: 1.4 date: 2013/04/25 13:10:34
user: stefan
file: MultiColumnPanelView.st directory: libwidg
module: stx stc-classLibrary: libwidg
Author:
Claus Gittinger

Description:


a View which arranges its child-views in a vertical column.
All real work is done in PanelView - except the layout computation is
redefined here.

The layout is controlled by the instance variables: 
    horizontalLayout and verticalLayout
in addition to 
    horizontalSpace and verticalSpace.

The vertical layout can be any of:

    #top            arrange elements at the top
    #topSpace       arrange elements at the top, start with spacing
    #bottom         arrange elements at the bottom
    #bottomSpace    arrange elements at the bottom, start with spacing
    #center         arrange elements in the center; ignore verticalSpace
    #spread         spread elements evenly; ignore verticalSpace
    #spreadSpace    spread elements evenly with spacing at ends; ignore verticalSpace
    #fit            like #spread, but resize elements for tight packing; ignore verticalSpace
    #fitSpace       like #fit, with spacing; ignore verticalSpace
    #topFit         like #top, but resize the last element to fit
    #topSpaceFit    like #topSpace, but resize the last element to fit
    #bottomFit      like #bottom, but resize the first element to fit
    #bottomSpaceFit like #bottomSpace, but resize the first element to fit

the horizontal layout can be:

    #left           place element at the left
    #leftSpace      place element at the left, offset by horizontalSpace
    #center         place elements horizontally centered; ignore horizontalSpace
    #right          place it at the right
    #rightSpace     place it at the right, offset by horizontalSpace
    #fit            resize elements horizontally to fit this panel; ignore horizontalSpace
    #fitSpace       like #fit, but add spacing; ignore horizontalSpace

    #leftMax        like #left, but resize elements to max of them
    #leftSpaceMax   like #leftSpace, but resize elements
    #centerMax      like #center, but resize elements
    #rightMax       like #right, but resize elements to max of them
    #rightSpaceMax  like #rightSpace, but resize elements

The defaults is #center for both directions.

The layout is changed by the messages #verticalLayout: and #horizontalLayout:.
For backward compatibility (to times, where only vLayout existed), the simple
#layout: does the same as #verticalLayout:. Do not use this old method.

The panel assumes, that the elements do not resize themselfes, after it
became visible. This is not true for all widgets (buttons or labels may
like to change). If you have changing elements, tell this to the panel
with 'aPanel elementsChangeSize:true'. In that case, the panel will react
to size changes, and reorganize things.

If none of these layout/space combinations is exactly what you need in
your application, create a subclass, and redefine the setChildPositions method.

CAVEAT: this class started with #top and no horizontal alignments;
as time went by, more layouts were added and the setup should be changed
to use different selectors for space, max-resize and alignment
(i.e. having more and more layout symbols makes things a bit confusing ...)


Related information:

    HorizontalPanelView
    VariableVerticalPanel
    VariableHorizontalPanel
    Label

Instance protocol:

accessing
o  columnWidths: something

o  horizontalLayout
return the horizontal layout as symbol.
the returned value is one of
#left place element at the left
#leftSpace place element at the left, offset by horizontalSpace
#center place elements horizontally centered; ignore horizontalSpace
#right place it at the right
#rightSpace place it at the right, offset by horizontalSpace
#fit resize elements horizontally to fit this panel; ignore horizontalSpace
#fitSpace like #fit, but add spacing; ignore horizontalSpace

#leftMax like #left, but resize elements to max of them
#leftSpaceMax like #leftSpace, but resize elements
#centerMax like #center, but resize elements
#rightMax like #right, but resize elements to max of them
#rightSpaceMax like #rightSpace, but resize elements
the default is #centered

o  horizontalLayout: aSymbol
change the horizontal layout as symbol.
The argument, aSymbol must be one of:
#left place element at the left
#leftSpace place element at the left, offset by horizontalSpace
#center place elements horizontally centered; ignore horizontalSpace
#right place it at the right
#rightSpace place it at the right, offset by horizontalSpace
#fit resize elements horizontally to fit this panel; ignore horizontalSpace
#fitSpace like #fit, but add spacing; ignore horizontalSpace

#leftMax like #left, but resize elements to max of them
#leftSpaceMax like #leftSpace, but resize elements
#centerMax like #center, but resize elements
#rightMax like #right, but resize elements to max of them
#rightSpaceMax like #rightSpace, but resize elements
the default (if never changed) is #centered

o  layout: something
OBSOLETE compatibility interface. Will vanish.
leftover for historic reasons - do not use any more.
In the meantime, try to figure out what is meant ... a kludge

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  verticalLayout
return the vertical layout as a symbol.
the returned value is one of
#top arrange elements at the top
#topSpace arrange elements at the top, start with spacing
#bottom arrange elements at the bottom
#bottomSpace arrange elements at the bottom, start with spacing
#center arrange elements in the center; ignore verticalSpace
#spread spread elements evenly; ignore verticalSpace
#spreadSpace spread elements evenly with spacing at ends; ignore verticalSpace
#fit like #spread, but resize elements for tight packing; ignore verticalSpace
#fitSpace like #fit, with spacing; ignore verticalSpace
#topFit like #top, but resize the last element to fit
#topSpaceFit like #topSpace, but resize the last element to fit
#bottomFit like #bottom, but resize the first element to fit
#bottomSpaceFit like #bottomSpace, but extend the first element to fit
the default is #centered

o  verticalLayout: aSymbol
change the vertical layout as a symbol.
The argument, aSymbol must be one of:
#top arrange elements at the top
#topSpace arrange elements at the top, start with spacing
#bottom arrange elements at the bottom
#bottomSpace arrange elements at the bottom, start with spacing
#center arrange elements in the center; ignore verticalSpace
#spread spread elements evenly; ignore verticalSpace
#spreadSpace spread elements evenly with spacing at ends; ignore verticalSpace
#fit like #spread, but resize elements for tight packing; ignore verticalSpace
#fitSpace like #fit, with spacing; ignore verticalSpace
#topFit like #top, but resize the last element to fit
#topSpaceFit like #topSpace, but resize the last element to fit
#bottomFit like #bottom, but resize the first element to fit
#bottomSpaceFit like #bottomSpace, but extend the first element to fit
the default (if never changed) is #centered

initialization
o  initialize

layout
o  setChildPositions
(re)compute position of every child

queries
o  preferredExtent
return a good extent, one that makes subviews fit
usage example(s):
If I have an explicit preferredExtent..
usage example(s):
If I have a cached preferredExtent value..


Examples:


These examples demonstrate the effect of different layout settings. You should try more examples, combining spacing and different verticalLayout:/horizontalLayout: combinations. example: default layout (centered)
    |v p b1 b2 b3 l1 l2 l3|

    v := StandardSystemView new.
    v label:'center (default)'.
    p := MultiColumnPanelView in:v.
    p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
    p columnWidths:#(0.3 0.7).
    l1 := Label label:'label1' in:p.
    b1 := Button label:'button1' in:p.
    l2 := Label label:'l2' in:p.
    b2 := Button label:'b2' in:p.
    l3 := Label label:'lab3' in:p.
    b3 := Button label:'butt3' in:p.
    v extent:100 @ 300.
    v open


ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sat, 17 Nov 2018 21:17:23 GMT