--- a/MultiColListEntry.st Sat Apr 27 20:20:27 1996 +0200
+++ b/MultiColListEntry.st Sat Apr 27 20:23:13 1996 +0200
@@ -57,205 +57,212 @@
"
putting multiColListEntries into a ListView
(instead of strings)'
-
- |v e myList tabs|
+ [exBegin]
+ |v e myList tabs|
- myList := OrderedCollection new.
+ myList := OrderedCollection new.
- tabs := TabulatorSpecification new.
- tabs unit:#inch.
- tabs positions:#(0 3 4).
- tabs align:#(left #center #left).
+ tabs := TabulatorSpecification new.
+ tabs unit:#inch.
+ tabs positions:#(0 3 4).
+ tabs align:#(left #center #left).
- e := MultiColListEntry
- fromString:'left centered left'.
- e tabulatorSpecification:tabs.
- myList add:e.
+ e := MultiColListEntry
+ fromString:'left centered left'.
+ e tabulatorSpecification:tabs.
+ myList add:e.
- e := MultiColListEntry
- fromString:'| | |'.
- e tabulatorSpecification:tabs.
- myList add:e.
- myList add:''.
+ e := MultiColListEntry
+ fromString:'| | |'.
+ e tabulatorSpecification:tabs.
+ myList add:e.
+ myList add:''.
- e := MultiColListEntry
- fromString:'hello hallo salut'.
- e tabulatorSpecification:tabs.
- myList add:e.
+ e := MultiColListEntry
+ fromString:'hello hallo salut'.
+ e tabulatorSpecification:tabs.
+ myList add:e.
- e := MultiColListEntry
- fromString:'good morning,guten Morgen,bon jour'
- separatedBy:$,.
- e tabulatorSpecification:tabs.
- myList add:e.
+ e := MultiColListEntry
+ fromString:'good morning,guten Morgen,bon jour'
+ separatedBy:$,.
+ e tabulatorSpecification:tabs.
+ myList add:e.
- e := MultiColListEntry new.
- e colAt:1 put:'good bye'.
- e colAt:2 put:'auf Wiedersehen'.
- e colAt:3 put:'au revoir '.
- e tabulatorSpecification:tabs.
- myList add:e.
+ e := MultiColListEntry new.
+ e colAt:1 put:'good bye'.
+ e colAt:2 put:'auf Wiedersehen'.
+ e colAt:3 put:'au revoir '.
+ e tabulatorSpecification:tabs.
+ myList add:e.
- v := ListView new.
- v setList:myList expandTabs:false.
- v extent:500@100.
- v open
+ v := ListView new.
+ v setList:myList expandTabs:false.
+ v extent:500@100.
+ v open
+ [exEnd]
many multiColListEntries in a scrollable ListView
+ [exBegin]
+ |v l e myList tabs|
- |v l e myList tabs|
-
- myList := OrderedCollection new.
+ myList := OrderedCollection new.
- tabs := TabulatorSpecification new.
- tabs unit:#cm.
- tabs positions:#(1 3 5).
- tabs align:#(#right #center #left).
+ tabs := TabulatorSpecification new.
+ tabs unit:#cm.
+ tabs positions:#(1 3 5).
+ tabs align:#(#right #center #left).
- 1 to:100 do:[:i|
- e := MultiColListEntry new.
- e colAt:1 put:i printString.
- e colAt:2 put:i squared printString.
- e colAt:3 put:i sqrt printString.
- e tabulatorSpecification:tabs.
- myList add:e.
- ].
- l := ListView new.
- l setList:myList expandTabs:false.
- v := ScrollableView forView:l.
- v extent:300@200.
- v open
+ 1 to:100 do:[:i|
+ e := MultiColListEntry new.
+ e colAt:1 put:i printString.
+ e colAt:2 put:i squared printString.
+ e colAt:3 put:i sqrt printString.
+ e tabulatorSpecification:tabs.
+ myList add:e.
+ ].
+ l := ListView new.
+ l setList:myList expandTabs:false.
+ v := ScrollableView forView:l.
+ v extent:300@200.
+ v open
+ [exEnd]
like above, but uses nicer decimal alignments
+ [exBegin]
+ |v l e myList tabs|
- |v l e myList tabs|
-
- myList := OrderedCollection new.
+ myList := OrderedCollection new.
- tabs := TabulatorSpecification new.
- tabs unit:#cm.
- tabs positions:#(1 3 6 9 12).
- tabs align:#(#right #decimal #decimal #decimal #decimal).
+ tabs := TabulatorSpecification new.
+ tabs unit:#cm.
+ tabs positions:#(1 3 6 9 12).
+ tabs align:#(#right #decimal #decimal #decimal #decimal).
- 1 to:100 do:[:i|
- e := MultiColListEntry new.
- e colAt:1 put:i printString.
- e colAt:2 put:i log printString.
- e colAt:3 put:i sqrt printString.
- e colAt:4 put:i sin printString.
- e colAt:5 put:i cos printString.
- e tabulatorSpecification:tabs.
- myList add:e.
- ].
- l := ListView new.
- l setList:myList expandTabs:false.
- v := ScrollableView forView:l.
- v extent:600@200.
- v open
+ 1 to:100 do:[:i|
+ e := MultiColListEntry new.
+ e colAt:1 put:i printString.
+ e colAt:2 put:i log printString.
+ e colAt:3 put:i sqrt printString.
+ e colAt:4 put:i sin printString.
+ e colAt:5 put:i cos printString.
+ e tabulatorSpecification:tabs.
+ myList add:e.
+ ].
+ l := ListView new.
+ l setList:myList expandTabs:false.
+ v := ScrollableView forView:l.
+ v extent:600@200.
+ v open
+ [exEnd]
specifying tabs in inches
-
- |v l e myList tabs|
+ [exBegin]
+ |v l e myList tabs|
- myList := OrderedCollection new.
+ myList := OrderedCollection new.
- tabs := TabulatorSpecification new.
- tabs unit:#inch.
- tabs positions:#(0 2 3.5 4 6 8 10 12).
+ tabs := TabulatorSpecification new.
+ tabs unit:#inch.
+ tabs positions:#(0 2 3.5 4 6 8 10 12).
- e := MultiColListEntry new.
- e colAt:1 put:'2'.
- e colAt:2 put:'3.5'.
- e colAt:3 put:'4'.
- e colAt:4 put:'6'.
- e colAt:5 put:'8'.
- e colAt:6 put:'10'.
- e colAt:7 put:'12'.
- e tabulatorSpecification:tabs.
- myList add:e.
+ e := MultiColListEntry new.
+ e colAt:1 put:'2'.
+ e colAt:2 put:'3.5'.
+ e colAt:3 put:'4'.
+ e colAt:4 put:'6'.
+ e colAt:5 put:'8'.
+ e colAt:6 put:'10'.
+ e colAt:7 put:'12'.
+ e tabulatorSpecification:tabs.
+ myList add:e.
- myList add:((MultiColListEntry fromString:'| | | | | | |')
- tabulatorSpecification:tabs).
- myList add:((MultiColListEntry fromString:'xxx xxx xxx xxx xxx xxx xxx')
- tabulatorSpecification:tabs).
+ myList add:((MultiColListEntry fromString:'| | | | | | |')
+ tabulatorSpecification:tabs).
+ myList add:((MultiColListEntry fromString:'xxx xxx xxx xxx xxx xxx xxx')
+ tabulatorSpecification:tabs).
- l := ListView new.
- l setList:myList expandTabs:false.
- v := HVScrollableView forView:l.
- v extent:600@200.
- v open
+ l := ListView new.
+ l setList:myList expandTabs:false.
+ v := HVScrollableView forView:l.
+ v extent:600@200.
+ v open
+ [exEnd]
if you have the columns available as a collection,
setup can be done easier
-
- |v l e myList tabs|
+ [exBegin]
+ |v l e myList tabs|
- myList := OrderedCollection new.
+ myList := OrderedCollection new.
- tabs := TabulatorSpecification new.
- tabs unit:#inch.
- tabs positions:#(0 2 3.5 4 6 8 10 12).
+ tabs := TabulatorSpecification new.
+ tabs unit:#inch.
+ tabs positions:#(0 2 3.5 4 6 8 10 12).
- e := MultiColListEntry new.
- e strings:#('2' '3.5' '4' '6' '8' '10' '12').
- e tabulatorSpecification:tabs.
- myList add:e.
+ e := MultiColListEntry new.
+ e strings:#('2' '3.5' '4' '6' '8' '10' '12').
+ e tabulatorSpecification:tabs.
+ myList add:e.
- l := ListView new.
- l setList:myList expandTabs:false.
- v := HVScrollableView forView:l.
- v extent:600@200.
- v open
+ l := ListView new.
+ l setList:myList expandTabs:false.
+ v := HVScrollableView forView:l.
+ v extent:600@200.
+ v open
+ [exEnd]
concrete example, show /etc/passwd in a table:
-
- |v l s myList line e htabs tabs fingerEntry|
+ [exBegin]
+
+ |v l s myList line e htabs tabs fingerEntry|
- tabs := TabulatorSpecification new.
- tabs unit:#inch.
- tabs positions:#(0 2 3.5 4.5 5 8 11).
- tabs align: #(left left right right left left left).
+ tabs := TabulatorSpecification new.
+ tabs unit:#inch.
+ tabs positions:#(0 2 3.5 4.5 5 8 11).
+ tabs align: #(left left right right left left left).
- htabs := TabulatorSpecification new.
- htabs unit:#inch.
- htabs positions:#(0 2 3.5 4.5 5 8 11).
- htabs align: #(left center center center left left left).
+ htabs := TabulatorSpecification new.
+ htabs unit:#inch.
+ htabs positions:#(0 2 3.5 4.5 5 8 11).
+ htabs align: #(left center center center left left left).
- myList := OrderedCollection new.
+ myList := OrderedCollection new.
- e := MultiColListEntry
- fromString:'login-name:password:uid:gid:finger-entry:home-dir:shell'
- separatedBy:$:.
- e tabulatorSpecification:htabs.
- myList add:e.
- myList add:''.
+ e := MultiColListEntry
+ fromString:'login-name:password:uid:gid:finger-entry:home-dir:shell'
+ separatedBy:$:.
+ e tabulatorSpecification:htabs.
+ myList add:e.
+ myList add:''.
- s := '/etc/passwd' asFilename readStream.
- [s atEnd] whileFalse:[
- line := s nextLine.
- e := MultiColListEntry
- fromString:line
- separatedBy:$:.
- fingerEntry := e colAt:5.
- e colAt:5 put:(fingerEntry asCollectionOfSubstringsSeparatedBy:$,) first.
- e tabulatorSpecification:tabs.
- myList add:e.
- ].
- s close.
+ s := '/etc/passwd' asFilename readStream.
+ [s atEnd] whileFalse:[
+ line := s nextLine.
+ e := MultiColListEntry
+ fromString:line
+ separatedBy:$:.
+ fingerEntry := e colAt:5.
+ e colAt:5 put:(fingerEntry asCollectionOfSubstringsSeparatedBy:$,) first.
+ e tabulatorSpecification:tabs.
+ myList add:e.
+ ].
+ s close.
- l := ListView new.
- l setList:myList expandTabs:false.
- v := HVScrollableView forView:l.
- v extent:600@200.
- v open
+ l := ListView new.
+ l setList:myList expandTabs:false.
+ v := HVScrollableView forView:l.
+ v extent:600@200.
+ v open
+ [exEnd]
"
! !
@@ -450,5 +457,5 @@
!MultiColListEntry class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/MultiColListEntry.st,v 1.15 1996-04-25 17:31:14 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/MultiColListEntry.st,v 1.16 1996-04-27 18:22:18 cg Exp $'
! !