MultiColListEntry.st
author Claus Gittinger <cg@exept.de>
Fri, 28 Mar 1997 15:22:14 +0100
changeset 329 098318898b01
parent 211 f6e9378de69f
child 357 658764fa1f0f
permissions -rw-r--r--
comment
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     1
"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     3
	      All Rights Reserved
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     4
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     5
 This software is furnished under a license and may be used
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     6
 only in accordance with the terms of that license and with the
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     8
 be provided or otherwise made available to, or used by, any
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
     9
 other person.  No title to or ownership of the software is
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    10
 hereby transferred.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    11
"
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    12
58
claus
parents: 36
diff changeset
    13
ListEntry subclass:#MultiColListEntry
158
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    14
	instanceVariableNames:'strings tabSpec'
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    15
	classVariableNames:'DefaultTabSpec'
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    16
	poolDictionaries:''
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    17
	category:'Views-Support'
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    18
!
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    19
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
    20
!MultiColListEntry class methodsFor:'documentation'!
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    21
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    22
copyright
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    23
"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    24
 COPYRIGHT (c) 1994 by Claus Gittinger
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    25
	      All Rights Reserved
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    26
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    27
 This software is furnished under a license and may be used
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    28
 only in accordance with the terms of that license and with the
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    30
 be provided or otherwise made available to, or used by, any
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    31
 other person.  No title to or ownership of the software is
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    32
 hereby transferred.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    33
"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    34
!
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    35
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    36
documentation
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    37
"
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    38
    Instances of MultiColListEntry can be used in place of strings
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    39
    as entries of the list in a ListView or SelectionInListView.
34
159147b254e1 *** empty log message ***
claus
parents: 25
diff changeset
    40
    They allow data to be presented in table (or any other) form.
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    41
    See example here and in TabulatorSpecs documentation.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    42
    Notice, that each entry can have its own tabulator specification;
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    43
    although, usually all share a single spec.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    44
    Also, notice that each column may align different; making these
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    45
    perfect elements to present table data.
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    46
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    47
    MultiColListEntry and TabulatorSpec were originally created to
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
    48
    support nice tabular display of file-lists in the FileBrowser
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
    49
    (see its long list); you may find many other uses ...
158
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    50
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    51
    [author:]
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    52
        Claus Gittinger
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    53
"
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    54
!
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    55
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    56
examples
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    57
"
58
claus
parents: 36
diff changeset
    58
     putting multiColListEntries into a ListView
claus
parents: 36
diff changeset
    59
     (instead of strings)'
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    60
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    61
        |v e myList tabs|
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    62
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    63
        myList := OrderedCollection new.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    64
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    65
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    66
        tabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    67
        tabs positions:#(0 3 4).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    68
        tabs align:#(left #center #left).
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    69
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    70
        e := MultiColListEntry 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    71
                 fromString:'left centered left'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    72
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    73
        myList add:e.
58
claus
parents: 36
diff changeset
    74
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    75
        e := MultiColListEntry 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    76
                 fromString:'| | |'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    77
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    78
        myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    79
        myList add:''.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    80
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    81
        e := MultiColListEntry 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    82
                 fromString:'hello hallo salut'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    83
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    84
        myList add:e.
58
claus
parents: 36
diff changeset
    85
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    86
        e := MultiColListEntry 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    87
                 fromString:'good morning,guten Morgen,bon jour'
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    88
                 separatedBy:$,.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    89
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    90
        myList add:e.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    91
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    92
        e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    93
        e colAt:1 put:'good bye'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    94
        e colAt:2 put:'auf Wiedersehen'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    95
        e colAt:3 put:'au revoir '.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    96
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    97
        myList add:e.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    98
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    99
        v := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   100
        v setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   101
        v extent:500@100.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   102
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   103
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   104
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   105
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   106
58
claus
parents: 36
diff changeset
   107
     many multiColListEntries in a scrollable ListView
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   108
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   109
        |v l e myList tabs|
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   110
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   111
        myList := OrderedCollection new.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   112
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   113
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   114
        tabs unit:#cm.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   115
        tabs positions:#(1 3 5).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   116
        tabs align:#(#right #center #left).
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   117
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   118
        1 to:100 do:[:i|
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   119
            e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   120
            e colAt:1 put:i printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   121
            e colAt:2 put:i squared printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   122
            e colAt:3 put:i sqrt  printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   123
            e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   124
            myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   125
        ].
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   126
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   127
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   128
        v := ScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   129
        v extent:300@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   130
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   131
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   132
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   133
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   134
58
claus
parents: 36
diff changeset
   135
     like above, but uses nicer decimal alignments
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   136
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   137
        |v l e myList tabs|
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   138
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   139
        myList := OrderedCollection new.
58
claus
parents: 36
diff changeset
   140
        
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   141
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   142
        tabs unit:#cm.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   143
        tabs positions:#(1 3 6 9 12).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   144
        tabs align:#(#right #decimal #decimal #decimal #decimal).
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   145
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   146
        1 to:100 do:[:i|
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   147
            e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   148
            e colAt:1 put:i printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   149
            e colAt:2 put:i log printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   150
            e colAt:3 put:i sqrt  printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   151
            e colAt:4 put:i sin  printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   152
            e colAt:5 put:i cos  printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   153
            e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   154
            myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   155
        ].
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   156
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   157
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   158
        v := ScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   159
        v extent:600@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   160
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   161
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   162
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   163
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   164
58
claus
parents: 36
diff changeset
   165
     specifying tabs in inches
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   166
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   167
        |v l e myList tabs|
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   168
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   169
        myList := OrderedCollection new.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   170
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   171
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   172
        tabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   173
        tabs positions:#(0 2 3.5 4 6 8 10 12).
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   174
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   175
        e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   176
        e colAt:1 put:'2'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   177
        e colAt:2 put:'3.5'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   178
        e colAt:3 put:'4'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   179
        e colAt:4 put:'6'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   180
        e colAt:5 put:'8'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   181
        e colAt:6 put:'10'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   182
        e colAt:7 put:'12'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   183
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   184
        myList add:e.
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   185
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   186
        myList add:((MultiColListEntry fromString:'| | | | | | |')
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   187
                         tabulatorSpecification:tabs).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   188
        myList add:((MultiColListEntry fromString:'xxx xxx xxx xxx xxx xxx xxx')
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   189
                         tabulatorSpecification:tabs).
58
claus
parents: 36
diff changeset
   190
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   191
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   192
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   193
        v := HVScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   194
        v extent:600@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   195
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   196
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   197
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   198
58
claus
parents: 36
diff changeset
   199
     if you have the columns available as a collection, 
claus
parents: 36
diff changeset
   200
     setup can be done easier
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   201
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   202
        |v l e myList tabs|
58
claus
parents: 36
diff changeset
   203
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   204
        myList := OrderedCollection new.
58
claus
parents: 36
diff changeset
   205
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   206
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   207
        tabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   208
        tabs positions:#(0 2 3.5 4 6 8 10 12).
58
claus
parents: 36
diff changeset
   209
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   210
        e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   211
        e strings:#('2' '3.5' '4' '6' '8' '10' '12').
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   212
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   213
        myList add:e.
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   214
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   215
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   216
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   217
        v := HVScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   218
        v extent:600@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   219
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   220
                                                                        [exEnd]
58
claus
parents: 36
diff changeset
   221
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   222
58
claus
parents: 36
diff changeset
   223
    concrete example, show /etc/passwd in a table:
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   224
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   225
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   226
        |v l s myList line e htabs tabs fingerEntry|
58
claus
parents: 36
diff changeset
   227
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   228
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   229
        tabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   230
        tabs positions:#(0    2      3.5  4.5   5    8    11).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   231
        tabs align:    #(left left right right left left left).
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   232
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   233
        htabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   234
        htabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   235
        htabs positions:#(0    2      3.5      4.5    5    8    11).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   236
        htabs align:    #(left center center center left left left).
58
claus
parents: 36
diff changeset
   237
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   238
        myList := OrderedCollection new.
58
claus
parents: 36
diff changeset
   239
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   240
        e := MultiColListEntry 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   241
                    fromString:'login-name:password:uid:gid:finger-entry:home-dir:shell' 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   242
                    separatedBy:$:.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   243
        e tabulatorSpecification:htabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   244
        myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   245
        myList add:''.
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   246
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   247
        s := '/etc/passwd' asFilename readStream.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   248
        [s atEnd] whileFalse:[
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   249
            line := s nextLine.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   250
            e := MultiColListEntry 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   251
                        fromString:line
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   252
                        separatedBy:$:.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   253
            fingerEntry := e colAt:5.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   254
            e colAt:5 put:(fingerEntry asCollectionOfSubstringsSeparatedBy:$,) first.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   255
            e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   256
            myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   257
        ].
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   258
        s close.
58
claus
parents: 36
diff changeset
   259
        
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   260
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   261
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   262
        v := HVScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   263
        v extent:600@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   264
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   265
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   266
"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   267
! !
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   268
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   269
!MultiColListEntry class methodsFor:'instance creation'!
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   270
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   271
fromString:aString
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   272
    ^ self fromString:aString separatedBy:Character space
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   273
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   274
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   275
fromString:aString separatedBy:separatorCharacter
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   276
     |subStrings e|
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   277
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   278
    e := self new.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   279
    subStrings := aString asCollectionOfSubstringsSeparatedBy:separatorCharacter.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   280
    subStrings keysAndValuesDo:[:i :sub |
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   281
	e colAt:i put:sub.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   282
    ].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   283
    ^ e
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   284
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   285
70
claus
parents: 62
diff changeset
   286
new:numberOfColumns
claus
parents: 62
diff changeset
   287
    |e|
claus
parents: 62
diff changeset
   288
claus
parents: 62
diff changeset
   289
    e := self new.
claus
parents: 62
diff changeset
   290
    1 to:numberOfColumns do:[:i |
claus
parents: 62
diff changeset
   291
	e colAt:i put:''.
claus
parents: 62
diff changeset
   292
    ].
claus
parents: 62
diff changeset
   293
    ^ e
claus
parents: 62
diff changeset
   294
claus
parents: 62
diff changeset
   295
    "Modified: 30.8.1995 / 16:33:53 / claus"
claus
parents: 62
diff changeset
   296
!
claus
parents: 62
diff changeset
   297
claus
parents: 62
diff changeset
   298
new:numberOfColumns tabulatorSpecification:aTabSpec
claus
parents: 62
diff changeset
   299
    ^ (self new:numberOfColumns) tabulatorSpecification:aTabSpec
claus
parents: 62
diff changeset
   300
claus
parents: 62
diff changeset
   301
    "Modified: 30.8.1995 / 16:34:23 / claus"
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   302
! !
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   303
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   304
!MultiColListEntry methodsFor:'accessing'!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   305
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   306
colAt:index
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   307
    "return the substring at column index"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   308
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   309
    index > strings size ifTrue:[^ nil].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   310
    ^ strings at:index
70
claus
parents: 62
diff changeset
   311
!
claus
parents: 62
diff changeset
   312
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   313
colAt:index put:aString
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   314
    "replace the substring at column index"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   315
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   316
    strings isNil ifTrue:[
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   317
	strings := OrderedCollection new:index
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   318
    ].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   319
    index > strings size ifTrue:[strings grow:index].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   320
    strings at:index put:aString
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   321
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   322
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   323
strings:aCollectionOfStrings
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   324
    "replace all substrings"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   325
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   326
    strings := OrderedCollection withAll:aCollectionOfStrings. 
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   327
!
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   328
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   329
tabulatorSpecification:aTabSpec
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   330
    "set the tabulator spec"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   331
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   332
    tabSpec := aTabSpec
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   333
! !
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   334
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   335
!MultiColListEntry methodsFor:'converting'!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   336
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   337
asString
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   338
    "return the receiver as a string with embedded tabs"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   339
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   340
    |s sub tab 
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   341
     nSub "{ Class: SmallInteger }"|
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   342
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   343
    s := ''.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   344
    tab := Character tab asString.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   345
    nSub := strings size.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   346
    1 to:nSub do:[:subStringIndex |
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   347
	sub := strings at:subStringIndex.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   348
	sub notNil ifTrue:[
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   349
	    s := s , sub.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   350
	].
103
f950776fd4e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   351
	subStringIndex == nSub ifFalse:[
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   352
	    s := s , tab
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   353
	]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   354
    ].
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   355
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   356
    ^ s
103
f950776fd4e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   357
f950776fd4e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   358
    "Created: 24.11.1995 / 18:54:27 / cg"
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   359
! !
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   360
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   361
!MultiColListEntry methodsFor:'defaults'!
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   362
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   363
defaultTabSpec
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   364
    "the default tabulators are 1 inch apart"
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   365
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   366
    |spec|
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   367
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   368
    spec := DefaultTabSpec.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   369
    spec isNil ifTrue:[
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   370
	spec := TabulatorSpecification new.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   371
	spec unit:#inch.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   372
	spec positions:(0 to:20).
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   373
	spec align:    #left.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   374
	DefaultTabSpec := spec.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   375
    ].
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   376
    ^ spec.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   377
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   378
    "Created: 17.11.1995 / 12:23:29 / cg"
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   379
    "Modified: 17.11.1995 / 12:24:20 / cg"
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   380
! !
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   381
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   382
!MultiColListEntry methodsFor:'drawing'!
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   383
108
b228b94be590 displayOpaque fixes
Claus Gittinger <cg@exept.de>
parents: 103
diff changeset
   384
displayOn:aGC x:x y:y opaque:opaque
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   385
    "display the receiver on a GC"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   386
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   387
    |xPos spec tabPos prevString|
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   388
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   389
    spec := tabSpec.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   390
    spec isNil ifTrue:[
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   391
        spec := self defaultTabSpec
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   392
    ].
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   393
    xPos := x.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   394
    prevString := ''.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   395
    strings keysAndValuesDo:[:index :subString |
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   396
        subString notNil ifTrue:[
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   397
            "
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   398
             find next tab
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   399
            "
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   400
            tabPos := spec positionOfTab:index forString:subString on:aGC.
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   401
            tabPos isNil ifTrue:[
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   402
                "
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   403
                 no tab - just continue where we are ...
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   404
                "
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   405
                xPos := xPos + (prevString widthOn:aGC). "/ (aGC font widthOf:prevString).
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   406
            ] ifFalse:[
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   407
                xPos := tabPos + x.
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   408
            ].
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   409
            opaque ifTrue:[    
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   410
                aGC displayOpaqueString:subString x:xPos y:y.
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   411
            ] ifFalse:[    
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   412
                aGC displayString:subString x:xPos y:y.
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   413
            ].    
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   414
            prevString := subString.
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   415
        ]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   416
    ].
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   417
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   418
    "Modified: 12.7.1996 / 23:03:19 / cg"
58
claus
parents: 36
diff changeset
   419
! !
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   420
58
claus
parents: 36
diff changeset
   421
!MultiColListEntry methodsFor:'queries'!
claus
parents: 36
diff changeset
   422
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   423
widthOn:aGC
58
claus
parents: 36
diff changeset
   424
    "return the width of the receiver when displayed in aGC"
claus
parents: 36
diff changeset
   425
62
claus
parents: 58
diff changeset
   426
    |xPos xMax tabPos prevLen|
58
claus
parents: 36
diff changeset
   427
claus
parents: 36
diff changeset
   428
    "just to make certain:
claus
parents: 36
diff changeset
   429
     do not assume, that the last col is the rightmost one ...
claus
parents: 36
diff changeset
   430
    "
claus
parents: 36
diff changeset
   431
    xPos := 0.
claus
parents: 36
diff changeset
   432
    xMax := 0.
claus
parents: 36
diff changeset
   433
    prevLen := 0.
claus
parents: 36
diff changeset
   434
    strings keysAndValuesDo:[:index :subString |
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   435
        |w|
62
claus
parents: 58
diff changeset
   436
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   437
        subString notNil ifTrue:[
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   438
            "
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   439
             find next tab
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   440
            "
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   441
            tabPos := tabSpec positionOfTab:index forString:subString on:aGC.
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   442
            tabPos isNil ifTrue:[
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   443
                "
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   444
                 no tab - just continue where we are ...
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   445
                "
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   446
                xPos := xPos + prevLen.
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   447
            ] ifFalse:[
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   448
                xPos := tabPos.
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   449
            ].
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   450
            w := prevLen := subString widthOn:aGC. "/ aGC font widthOf:subString.
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   451
            xMax := xMax max:(xPos + w).
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   452
        ]
58
claus
parents: 36
diff changeset
   453
    ].
claus
parents: 36
diff changeset
   454
    ^ xMax
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   455
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   456
    "Created: 12.5.1996 / 20:38:38 / cg"
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   457
    "Modified: 12.7.1996 / 23:01:51 / cg"
58
claus
parents: 36
diff changeset
   458
! !
claus
parents: 36
diff changeset
   459
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   460
!MultiColListEntry class methodsFor:'documentation'!
98
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   461
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   462
version
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   463
    ^ '$Header: /cvs/stx/stx/libwidg2/MultiColListEntry.st,v 1.19 1997-03-28 14:22:14 cg Exp $'
98
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   464
! !