|
Class: VariablePanel
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--VariablePanel
|
+--FileBrowserV2PanelView
|
+--VariableHorizontalPanel
|
+--VariableVerticalPanel
- Package:
- stx:libwidg
- Category:
- Views-Layout
- Version:
- rev:
1.143
date: 2023/10/05 08:18:49
- user: stefan
- file: VariablePanel.st directory: libwidg
- module: stx stc-classLibrary: libwidg
a View to separate its subviews vertically by a movable bar;
the size-ratios of the subviews can be changed by moving this bar.
In order to correctly setup this kind of view, the subviews must
be created with a relative origin & relative corner.
The panel does not verify the relative subview bounds;
therefore, it is your responsibility to set those relative sizes to fit
according the orientation (see bad example below).
The bar-handle is either an exposed knob (style == #motif)
or the form defined in Scroller (style ~~ #motif)
or nothing.
Typically creation is done as:
p := VariablePanel in:superView.
p orientation:#vertical.
v1 := <someViewClass> origin:0.0 @ 0.0
corner:1.0 @ 0.5
in:p.
v2 := <someViewClass> origin:0.0 @ 0.5
corner:1.0 @ 0.8
in:p.
v3 := <someViewClass> origin:0.0 @ 0.8
corner:1.0 @ 1.0
in:p.
The two subclasses VariableHorizontalPanel and VariableVerticalPanel
preset the orientation. They are a kept for backward compatibility
(in previous versions, there used to be no common VariablePanel (super-) class).
Notice: if it is required to insert a fixed-size view in the panel,
use an extra view & insets, and place the subview into that extra view.
See examples.
[instance Variables:]
barHeight <Integer> the height of the bar (for verticalPanels)
barWidth <Integer> the width of the bar (for horizontalPanels)
separatingLine <Boolean> show a separating line (as in motif style)
shadowForm <Image/Form> form (shadow part) drawn as handle - if nonNil
lightForm <Image/Form> form (light part) drawn as handle - if nonNil
showHandle <Boolean> if false, no handle is drawn
handlePosition <Symbol> where is the handle - one of #left, #center, #right
handleColor <Color> inside color of handle - defaults to viewBackground
handleStyle <Symbol> type of handle; one of #next, #motif or nil
handleLevel <Integer> 3D level of handle (only valid if no form is given)
trackLine <Boolean> if true, an inverted line is drawn for tracking;
otherwise, the whole bar is inverted.
redrawLocked internal - locks redraws while tracking
orientation <Symbol> one of #horizontal / #vertical
[styleSheet values:]
variablePanel.showHandle true/false - should a handle be shown (default:true)
variablePanel.showHandleWhenEntered
true/false - if true (AND showHandle is false),
then handles are ONLY shown when the mouse pointer is
above a handle area (default:false)
variablePanel.showHandleWhenSubviewHidden
true/false - if true (AND showHandle is false AND showHandleWhenEntered is true),
then handles are ALSO shown when the subview on either side of a handle
has been size very small (default:true)
variablePanel.handleStyle #next / #motif / #iris / #full / nil (special handles)
variablePanel.handlePosition #left / #center / #right (default:#right)
variablePanel.handleLevel 3D level of heandle (default:2)
variablePanel.trackingLine when moved, track an inverted line (as in motif)
as opposed to tracking the whole bar (default:false)
(obsoleted by trackingStyle)
variablePanel.trackingStyle #solidRectangle / #solidLine / #dashedLine
detailed control over how to draw tracking
(obsoletes trackingLine above)
variablePanel.separatingLine draw a separating line in the bar as in motif (default:false)
variablePanel.handleColor color of the handle. (default:Black)
variablePanel.handleEnteredColor
color of the handle when the pointer is in the bar (default:nil)
copyrightCOPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
defaults
-
cursorForOrientation: orientation
-
return an appropriate cursor
-
cursorForOrientation: orientation onDevice: device
-
return an appropriate cursor
-
lightFormOn: aDisplay
-
use same handle as Scroller
-
shadowFormOn: aDisplay
-
use same handle as Scroller
-
snapIcons
-
return a dictionary of snapIcons
Usage example(s):
DefaultSnapIcons := nil.
self snapIcons
|
-
updateStyleCache
-
extract values from the styleSheet and cache them in class variables
Usage example(s):
VariablePanel updateStyleCache
|
image specs
-
horizontalResizeCursor
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self horizontalResizeCursor inspect
ImageEditor openOnClass:self andSelector:#horizontalResizeCursor
Icon flushCachedIcons
|
-
snapIconDown
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self snapIconDown inspect
ImageEditor openOnClass:self andSelector:#snapIconDown
|
-
snapIconDown_dark
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self snapIconDown_dark inspect
ImageEditor openOnClass:self andSelector:#snapIconDown_dark
Icon flushCachedIcons
|
-
snapIconLeft
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self snapIconLeft inspect
ImageEditor openOnClass:self andSelector:#snapIconLeft
|
-
snapIconLeftRight
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self snapIconLeftRight inspect
ImageEditor openOnClass:self andSelector:#snapIconLeftRight
Icon flushCachedIcons
|
-
snapIconLeftRight_dark
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self snapIconLeftRight_dark inspect
ImageEditor openOnClass:self andSelector:#snapIconLeftRight_dark
Icon flushCachedIcons
|
-
snapIconLeft_dark
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self snapIconLeft_dark inspect
ImageEditor openOnClass:self andSelector:#snapIconLeft_dark
Icon flushCachedIcons
|
-
snapIconRight
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self snapIconRight inspect
ImageEditor openOnClass:self andSelector:#snapIconRight
|
-
snapIconRight_dark
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self snapIconRight_dark inspect
ImageEditor openOnClass:self andSelector:#snapIconRight_dark
Icon flushCachedIcons
|
-
snapIconUp
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self snapIconUp inspect
ImageEditor openOnClass:self andSelector:#snapIconUp
|
-
snapIconUpDown
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self snapIconUpDown inspect
ImageEditor openOnClass:self andSelector:#snapIconUpDown
Icon flushCachedIcons
|
-
snapIconUpDown_dark
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self snapIconUpDown_dark inspect
ImageEditor openOnClass:self andSelector:#snapIconUpDown_dark
Icon flushCachedIcons
|
-
snapIconUp_dark
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self snapIconUp_dark inspect
ImageEditor openOnClass:self andSelector:#snapIconUp_dark
Icon flushCachedIcons
|
-
verticalResizeCursor
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
Usage example(s):
self verticalResizeCursor inspect
ImageEditor openOnClass:self andSelector:#verticalResizeCursor
Icon flushCachedIcons
|
accessing-look
-
barHeight
-
return the height of the separating bar
-
barHeight: nPixel
-
set the height of the separating bar
-
barLevel: level
-
set the 3D level of the separating bar
-
forcedOpaqueResizing: aBoolean
-
-
handleImage: aBitmapOrImage
-
define the handles image
-
handleLabels: aCollectionOfLabels
-
define special handle labels - typically a collection of
bitmap images. Notice, that the first handle is not
drawn, that is, the first element if the argument is useless.
Usage example(s):
|top panel v1 v2|
top := StandardSystemView new.
panel := VariableVerticalPanel origin:0.0@0.0 corner:1.0@1.0 in:top.
panel add:(EditTextView origin:0.0@0.0 corner:1.0@0.5).
panel add:(EditTextView origin:0.0@0.5 corner:1.0@1.0).
panel handleStyle:nil.
panel handleLabels:#('foo' 'bar').
top open
|
-
handleLevel: aNumber
-
define the 3D level of the handle (only with some styles).
Normally, this is defined via styleSheet files, but this entry allows
individual views to be manipulated.
-
handlePosition
-
return the position of the handle
-
handlePosition: aSymbol
-
define the position of the handle; the argument aSymbol
may be one of #left, #right or #center.
If never set by the program, the position is controlled by the styleSheet.
-
handleShadowImage: shadowImage lightImage: lightImage
-
define the handles image; both shadow and light parts
-
handleStyle: styleSymbol
-
define the style of the handle;
styleSymbol may be #motif to draw a little knob or
anything else to draw scrollBars handleForm.
Normally, this is defined via styleSheet files, but this entry allows
individual views to be manipulated.
-
orientation
-
return my orientation; either #horizontal or #vertical
-
orientation: aSymbol
-
change my orientation; aSymbol must be one of #horizontal or #vertical.
Changing implies a resize of my subViews.
-
relativeCorners
-
the returned collection gives the corner-fractional value for each component;
i.e. for a 20-40-40 look, it would be #(0.2 0.6 1.0)
-
relativeCorners: aCollectionOfRelativeCornerPositions
-
the argument gives the corner-fractional value for each component;
i.e. for a 20-40-40 look, it would be #(0.2 0.6 1.0)
-
relativeHandlePositions: aCollectionOfHandlePositions
-
set the relative positions (0..1) of all handles;
invisible views are ignored
-
setBarHeight: nPixel
-
check whether snap matches to extent of bar otherwise disable snap
-
showHandle
-
is handle-drawing enabled/disabled?
returns a Boolean.
The default is setup from the view's stylesheet
or overwritten in a UI-spec
-
showHandle: aBoolean
-
enabled/disable the handle-drawing.
The default is setup from the view's stylesheet
or overwritten in a UI-spec
-
showHandleWhenEntered
-
is handle-draw if pointer has entered the view enabled/disabled?
returns a Boolean.
The default is setup from the view's stylesheet
or overwritten in a UI-spec
-
showHandleWhenEntered: aBoolean
-
enabled/disable the handle-drawing on entry.
The default is setup from the view's stylesheet
or overwritten in a UI-spec
-
showHandleWhenSubViewHidden
-
an additional flag to force drawing of handles even if handles are hidden,
iff the subview on either side of the handle is super-minimal (invisible).
This is a UI hint to the user that there is some view hidden underneath.
-
showHandleWhenSubViewHidden: aBoolean
-
an additional flag to force drawing of handles even if handles are hidden,
iff the subview on either side of the handle is super-minimal (invisible).
This is a UI hint to the user that there is some view hidden underneath.
-
snapHandlePosition
-
return the position of the snap-handle
Usage example(s):
-
snapHandlePosition: aSymbol
-
define the position of the snap-handle; the argument aSymbol
may be one of #left, #right or #center.
If never set by the program, the position is controlled by the styleSheet.
-
snapMode
-
allowed modes are:
nil no snap
#max on press the view is increased to bottom(vertical) or right(horizontal)
#min on press the view is decreased to top (vertical) or left (horizontal)
#maxMin on press the view is increased or decreased dependent on its current extent
#minMax on press the view is increased or decreased dependent on its current extent
-
snapMode: aMode
-
allowed modes are:
nil no snap
#max on press the view is increased to bottom(vertical) or right(horizontal)
#min on press the view is decreased to top (vertical) or left (horizontal)
#maxMin on press the view is increased or decreased dependent on its current extent
#minMax on press the view is increased or decreased dependent on its current extent
-
style: styleSymbol
-
define the style of the handle;
styleSymbol may be #motif to draw a little knob or
anything else to draw scrollBars handleForm.
Normally, this is defined via styleSheet files, but this entry allows
individual views to be manipulated.
adding & removing components
-
addSubView: aView
-
a view is added; adjust other subviews sizes
-
removeSubView: aView
-
a view is removed; adjust other subviews sizes
drawing
-
clearAndInvalidate
-
-
drawHandle: hIndex atX: hx y: hy
-
draw a single handle at hx/hy
-
drawHandleFormAtX: hx y: hy
-
draw a handle's bitmap at hx/hy
-
drawSnapAt: anIndex
-
draw the snap for a handle at an index
-
invertHandleBarAtX: hx y: hy
-
-
lockRedraw
-
-
redraw
-
redraw all of the handles
-
redrawHandlesFrom: start to: stop
-
redraw some handles and snaps
-
unlockRedraw
-
enumerating subviews
-
changeSequenceOrderFor: aSubView to: anIndex
-
change a subview's position in the subviews collection.
event handling
-
pointerEnter: buttonState x: x y: y
-
not called - see controller
-
pointerLeave: buttonState
-
not called - see controller
-
sizeChanged: how from: oldExtentOrNil
-
my view has changed the size;
resize my subviews
focus handling
-
wantsFocusWithButtonPress
-
no, do not catch the keyboard focus on button click
initialization & release
-
computeBarHeight
-
compute the height if the separating bar from either the
form or an explicit height given in the styleSheet
-
defaultControllerClass
-
-
initCursor
-
set the cursor - a double arrow
-
initStyle
-
setup viewStyle specifics
-
initialize
-
(comment from inherited method)
initialize all state of the view - usually redefined in subclasses,
but always doing a 'super initialize'. Each class should setup its
locals - and not forget the others.
View setup is separated into two parts, the general setup done here
and the style specific setup in initStyle. Each view should be prepared
for a stylechange by being sent another initStyle with a new style value.
(in this case, it should set all of its style-dependent things, but
leave the state and contents as-is)
private
-
anyNonRelativeSubviews
-
return true, if any of my subviews has no relative origin/extent
-
expandSubView: expandedView
-
expand one of my subviews to full size
-
handleLabelAt: hIndex
-
-
handleOriginsWithIndexDo: aBlock
-
evaluate the argument block for every handle-origin
-
handleOriginsWithIndexFrom: start to: stop do: aBlock
-
evaluate the argument block for some handle-origins
-
redrawIfShown
-
-
resizeSubViewsTo: relativeSizeList
-
change subviews sizes as defined in the argument list
(a collection of relative sizes)
-
resizeSubviews
-
readjust size of all subviews
-
resizeSubviews: viewsToResize from: startArg to: stopArg
-
readjust size of (possibly some of) my subviews
-
resizeSubviewsFrom: start to: stop
-
readjust size of some subviews
-
resizeVisibleSubviews
-
readjust size of all visible subviews
-
restoreSubViewRatios
-
restore my subviews sizes to the state before the full-expand
-
setupSubviewOrigins
-
setup subviews origins
if we only have relative extents
(Variable Panels need relative origins and corners!) (SV 16.1.95)
-
setupSubviews
-
setup subviews sizes (in case of non-relative sizes)
-
viewOnEitherSideOfHandleIsHidden: hIndex
-
hIndex is actually the index of the next subview;
i.e. I am called with hIndex = 2 if the view to the left is subview1
and the view to the right is subview2.
Here,assume anything less than 10 pixels is small and a handle will be shown
private-snap queries
-
canChangeExtentOfViewAt: anIndex
-
returns true if extent at an index is changable
-
initSnapAdornment
-
IdentityDictionary
-
snapAtIndexWillGrow: anIndex
-
returns true if the view assigned to the snap at an index will grow
if pressing the snap
-
snapLayoutAt: anIndex
-
returns the layout of the snap at an index
or nil if snaps are disabled
queries
-
hasSnapHandle
-
-
isHorizontal
-
-
isLayoutWrapper
-
answer true, if this view defines the layout of it's subviews
realization
-
fixSize
-
(comment from inherited method)
This is called right before the view is made visible.
Adjust the size of the view according to either relative/abs or
block extent; also set origin. Also, subclasses may redefine this
method to adjust the size based on some extent (for example, PopUpMenus
do so to take care of changed number of menu entries).
-
realize
-
force recomputation of subviews
SnapAdornment
example (notice that the subviews MUST have relative bounds):
|top p v1 v2 v3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
v1 := View origin:0.0@0.0 corner:1.0@(1/2) in:p.
v2 := View origin:0.0@(1/2) corner:1.0@(2/3) in:p.
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p.
v1 viewBackground:(Color red).
v2 viewBackground:(Color green).
v3 viewBackground:(Color yellow).
top open
|
change the handles level:
|top p v1 v2 v3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
p handleLevel:-1.
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p.
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p.
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p.
v1 viewBackground:(Color red).
v2 viewBackground:(Color green).
v3 viewBackground:(Color yellow).
top open
|
change the handles style to nil makes it invisible:
|top p v1 v2 v3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
p handleStyle:nil.
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p.
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p.
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p.
v1 viewBackground:(Color red).
v2 viewBackground:(Color green).
v3 viewBackground:(Color yellow).
top open
|
define your own handle (-bitmap):
|top p v1 v2 v3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
p handleImage:(Image fromFile:'bitmaps/ScrollLt.8.xbm').
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p.
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p.
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p.
v1 viewBackground:(Color red).
v2 viewBackground:(Color green).
v3 viewBackground:(Color yellow).
top open
|
another handle-bitmap:
|top p v1 v2 v3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
p handleImage:(Form width:9
height:11
fromArray:#(
2r00000000 2r00000000
2r00001000 2r00000000
2r00011100 2r00000000
2r00111110 2r00000000
2r01111111 2r00000000
2r00000000 2r00000000
2r01111111 2r00000000
2r00111110 2r00000000
2r00011100 2r00000000
2r00001000 2r00000000
2r00000000 2r00000000
)
).
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p.
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p.
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p.
v1 viewBackground:(Color red).
v2 viewBackground:(Color green).
v3 viewBackground:(Color yellow).
top open
|
placing scrolled and unscrolled views into a variablePanel:
|top p v1 v2 v3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
v1 := ScrollableView for:SelectionInListView in:p.
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5.
v1 list:(FileDirectory directoryNamed:'/etc') contents.
v1 action:[:selNr |
|fullName stream text|
fullName := '/etc/' , v1 selectionValue.
stream := fullName asFilename readStream.
stream notNil ifTrue:[
text := stream contents.
v2 contents:text.
v3 contents:text
]
].
v2 := TextView origin:0.0 @ 0.5 corner:1.0 @ 0.8 in:p.
v3 := ScrollableView for:TextView in:p.
v3 origin:0.0 @ 0.8 corner:1.0 @ 1.0.
top open
|
dynamically adding/removing views:
|top p v1 v2 b|
top := StandardSystemView new.
top extent:300@300.
b := Toggle label:'show' in:top.
b showLamp:false.
b origin:0.0 @ 0.0 corner:(1.0 @ 40).
b action:[:state |
state ifTrue:[
b label:'hide'.
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5.
v2 := ScrollableView for:EditTextView.
v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0.
v2 contents:'another text'.
p addSubView:v2.
v2 realize.
] ifFalse:[
b label:'show'.
v2 destroy.
v1 origin:0.0 @ 0.0 corner:1.0 @ 1.0
]
].
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
p topInset:50.
v1 := ScrollableView for:EditTextView in:p.
v1 origin:0.0 @ 0.0 corner:1.0 @ 1.0.
v1 contents:'some text'.
top open
|
dynamically flipping orientation:
Notice: you have to change the relative bounds of the subviews first.
|top p v1 v2 b|
top := StandardSystemView new.
top extent:300@300.
b := Toggle label:'flip' in:top.
b showLamp:false.
b origin:0.0 @ 0.0 corner:(1.0 @ 40).
b action:[:state |
state ifTrue:[
v1 origin:0.0 @ 0.0 corner:0.5 @ 1.0.
v2 origin:0.5 @ 0.0 corner:1.0 @ 1.0.
p orientation:#horizontal.
] ifFalse:[
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5.
v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0.
p orientation:#vertical.
].
].
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
p topInset:50.
v1 := ScrollableView for:EditTextView in:p.
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5.
v1 contents:'some text'.
v2 := ScrollableView for:EditTextView in:p.
v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0.
v2 contents:'another text'.
top open
|
combining fix-size with variable size:
(need 3 extra frame-views to place the extra labels into)
|top p v1 l1 v2 l2 v3 l3 f1 f2 f3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
f1 := View origin:0.0@0.0 corner:1.0@0.3 in:p.
f2 := View origin:0.0@0.3 corner:1.0@0.6 in:p.
f3 := View origin:0.0@0.6 corner:1.0@1.0 in:p.
v1 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f1.
v2 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f2.
v3 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f3.
l1 := Label label:'sub1' in:f1.
l2 := Label label:'sub2' in:f2.
l3 := Label label:'sub3' in:f3.
l1 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ;
bottomInset:(l1 preferredExtent y negated).
l2 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ;
bottomInset:(l2 preferredExtent y negated).
l3 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ;
bottomInset:(l3 preferredExtent y negated).
v1 topInset:(l1 preferredExtent y); level:-1.
v2 topInset:(l2 preferredExtent y); level:-1.
v3 topInset:(l3 preferredExtent y); level:-1.
v1 viewBackground:(Color red).
v2 viewBackground:(Color green).
v3 viewBackground:(Color yellow).
top open
|
VerticalPansels allow a label to be associated with the
handles; this looks much like the above, but is slightly
more compact. Notice, no label can be placed above the first
view - it has no handle.
|top p v1 v2 v3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
p handleLabels:#('ignored' 'sub2' 'sub3').
v1 := View origin:0.0@0.0 corner:1.0@0.3 in:p.
v2 := View origin:0.0@0.3 corner:1.0@0.6 in:p.
v3 := View origin:0.0@0.6 corner:1.0@1.0 in:p.
v1 viewBackground:(Color red).
v2 viewBackground:(Color green).
v3 viewBackground:(Color yellow).
top open
|
handle labels can be more than strings ....
(however, they should have about the same height, since
the largest defines heights of all bars;
retry the example below with a larger bitmap image ...)
|top e p v1 v2 v3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
e := Array with:#bold
with:#color->Color red.
p handleLabels:(Array with:nil
with:('bold and red' asText emphasizeAllWith:e)
with:(Image fromFile:'ScrollRt.xbm')).
v1 := View origin:0.0@0.0 corner:1.0@0.3 in:p.
v2 := View origin:0.0@0.3 corner:1.0@0.6 in:p.
v3 := View origin:0.0@0.6 corner:1.0@1.0 in:p.
v1 viewBackground:(Color red).
v2 viewBackground:(Color green).
v3 viewBackground:(Color yellow).
top open
|
BAD EXAMPLE (wrong relative sizes - repaired on handle move):
|top p v1 v2 v3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
v1 := View origin:0.0 @ 0.0 corner:1.0 @ (1/4) in:p.
v2 := View origin:0.0 @ (1/2) corner:1.0 @ (3/4) in:p.
v3 := View origin:0.0 @ (3/4) corner:1.0 @ 1.0 in:p.
v1 viewBackground:(Color red).
v2 viewBackground:(Color green).
v3 viewBackground:(Color yellow).
top open
|
example with snapMode:
|top p v1 v2 v3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
p snapMode:#min.
v1 := View origin:0.0@0.0 corner:1.0@(1/2) in:p.
v2 := View origin:0.0@(1/2) corner:1.0@(2/3) in:p.
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p.
v1 viewBackground:(Color red).
v2 viewBackground:(Color green).
v3 viewBackground:(Color yellow).
top open
|
example with redefined handle-image:
|top p v1 v2 v3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
p handleImage:(ToolbarIconLibrary barResizeVerticalIcon).
p showHandle:true.
v1 := View origin:0.0@0.0 corner:1.0@(1/2) in:p.
v2 := View origin:0.0@(1/2) corner:1.0@(2/3) in:p.
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p.
v1 viewBackground:(Color red).
v2 viewBackground:(Color green).
v3 viewBackground:(Color yellow).
top open
|
predefine the relative sizes:
|top p v1 v2 v3|
top := StandardSystemView new.
top extent:300@300.
p := VariablePanel
origin:0.0 @ 0.0
corner:1.0 @ 1.0
in:top.
p orientation:#vertical.
p handleImage:(ToolbarIconLibrary barResizeVerticalIcon).
p showHandle:true.
v1 := View in:p.
v2 := View in:p.
v3 := View in:p.
v1 viewBackground:(Color red).
v2 viewBackground:(Color green).
v3 viewBackground:(Color yellow).
p relativeHandlePositions:#(0.25 0.75 1.0).
top open
|
|