MultiColListEntry.st
author Claus Gittinger <cg@exept.de>
Mon, 06 May 2002 08:06:12 +0200
changeset 2098 d59707230877
parent 1969 e325d38ce469
child 2925 359505806538
permissions -rw-r--r--
#on: -> #onDevice
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
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
    13
"{ Package: 'stx:libwidg2' }"
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
    14
58
claus
parents: 36
diff changeset
    15
ListEntry subclass:#MultiColListEntry
158
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    16
	instanceVariableNames:'strings tabSpec'
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    17
	classVariableNames:'DefaultTabSpec'
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    18
	poolDictionaries:''
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    19
	category:'Views-Support'
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    20
!
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    21
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
    22
!MultiColListEntry class methodsFor:'documentation'!
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    23
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    24
copyright
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    25
"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    26
 COPYRIGHT (c) 1994 by Claus Gittinger
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    27
	      All Rights Reserved
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    28
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    29
 This software is furnished under a license and may be used
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    30
 only in accordance with the terms of that license and with the
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    32
 be provided or otherwise made available to, or used by, any
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    33
 other person.  No title to or ownership of the software is
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    34
 hereby transferred.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    35
"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    36
!
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    37
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    38
documentation
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    39
"
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    40
    Instances of MultiColListEntry can be used in place of strings
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    41
    as entries of the list in a ListView or SelectionInListView.
34
159147b254e1 *** empty log message ***
claus
parents: 25
diff changeset
    42
    They allow data to be presented in table (or any other) form.
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    43
    See example here and in TabulatorSpecs documentation.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    44
    Notice, that each entry can have its own tabulator specification;
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    45
    although, usually all share a single spec.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    46
    Also, notice that each column may align different; making these
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    47
    perfect elements to present table data.
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    48
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    49
    MultiColListEntry and TabulatorSpec were originally created to
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
    50
    support nice tabular display of file-lists in the FileBrowser
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
    51
    (see its long list); you may find many other uses ...
158
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    52
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    53
    [author:]
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 109
diff changeset
    54
        Claus Gittinger
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    55
"
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    56
!
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    57
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    58
examples
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
    59
"
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
    60
     putting multiColListEntries into a ListView (instead of strings)
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    61
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    62
        |v e myList tabs|
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    63
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    64
        myList := OrderedCollection new.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    65
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    66
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    67
        tabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    68
        tabs positions:#(0 3 4).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    69
        tabs align:#(left #center #left).
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    70
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
    71
        e := MultiColListEntry fromString:'left centered left'.
161
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
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
    75
        e := MultiColListEntry fromString:'| | |'.
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    76
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    77
        myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    78
        myList add:''.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    79
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
    80
        e := MultiColListEntry fromString:'hello hallo salut'.
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    81
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    82
        myList add:e.
58
claus
parents: 36
diff changeset
    83
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    84
        e := MultiColListEntry 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    85
                 fromString:'good morning,guten Morgen,bon jour'
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    86
                 separatedBy:$,.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    87
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    88
        myList add:e.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    89
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    90
        e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    91
        e colAt:1 put:'good bye'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    92
        e colAt:2 put:'auf Wiedersehen'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    93
        e colAt:3 put:'au revoir '.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    94
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    95
        myList add:e.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    96
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    97
        v := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    98
        v setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    99
        v extent:500@100.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   100
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   101
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   102
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   103
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   104
58
claus
parents: 36
diff changeset
   105
     many multiColListEntries in a scrollable ListView
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   106
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   107
        |v l e myList tabs|
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   108
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   109
        myList := OrderedCollection new.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   110
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   111
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   112
        tabs unit:#cm.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   113
        tabs positions:#(1 3 5).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   114
        tabs align:#(#right #center #left).
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   115
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   116
        1 to:100 do:[:i|
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   117
            e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   118
            e colAt:1 put:i printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   119
            e colAt:2 put:i squared printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   120
            e colAt:3 put:i sqrt  printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   121
            e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   122
            myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   123
        ].
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   124
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   125
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   126
        v := ScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   127
        v extent:300@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   128
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   129
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   130
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   131
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   132
58
claus
parents: 36
diff changeset
   133
     like above, but uses nicer decimal alignments
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   134
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   135
        |v l e myList tabs|
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   136
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   137
        myList := OrderedCollection new.
58
claus
parents: 36
diff changeset
   138
        
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   139
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   140
        tabs unit:#cm.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   141
        tabs positions:#(1 3 6 9 12).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   142
        tabs align:#(#right #decimal #decimal #decimal #decimal).
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   143
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   144
        1 to:100 do:[:i|
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   145
            e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   146
            e colAt:1 put:i printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   147
            e colAt:2 put:i log printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   148
            e colAt:3 put:i sqrt  printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   149
            e colAt:4 put:i sin  printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   150
            e colAt:5 put:i cos  printString.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   151
            e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   152
            myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   153
        ].
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   154
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   155
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   156
        v := ScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   157
        v extent:600@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   158
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   159
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   160
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   161
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   162
58
claus
parents: 36
diff changeset
   163
     specifying tabs in inches
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   164
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   165
        |v l e myList tabs|
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   166
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   167
        myList := OrderedCollection new.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   168
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   169
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   170
        tabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   171
        tabs positions:#(0 2 3.5 4 6 8 10 12).
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   172
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   173
        e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   174
        e colAt:1 put:'2'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   175
        e colAt:2 put:'3.5'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   176
        e colAt:3 put:'4'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   177
        e colAt:4 put:'6'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   178
        e colAt:5 put:'8'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   179
        e colAt:6 put:'10'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   180
        e colAt:7 put:'12'.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   181
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   182
        myList add:e.
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   183
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   184
        myList add:((MultiColListEntry fromString:'| | | | | | |')
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   185
                         tabulatorSpecification:tabs).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   186
        myList add:((MultiColListEntry fromString:'xxx xxx xxx xxx xxx xxx xxx')
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   187
                         tabulatorSpecification:tabs).
58
claus
parents: 36
diff changeset
   188
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   189
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   190
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   191
        v := HVScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   192
        v extent:600@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   193
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   194
                                                                        [exEnd]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   195
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   196
58
claus
parents: 36
diff changeset
   197
     if you have the columns available as a collection, 
claus
parents: 36
diff changeset
   198
     setup can be done easier
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   199
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   200
        |v l e myList tabs|
58
claus
parents: 36
diff changeset
   201
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   202
        myList := OrderedCollection new.
58
claus
parents: 36
diff changeset
   203
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   204
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   205
        tabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   206
        tabs positions:#(0 2 3.5 4 6 8 10 12).
58
claus
parents: 36
diff changeset
   207
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   208
        e := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   209
        e strings:#('2' '3.5' '4' '6' '8' '10' '12').
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   210
        e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   211
        myList add:e.
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   212
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   213
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   214
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   215
        v := HVScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   216
        v extent:600@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   217
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   218
                                                                        [exEnd]
58
claus
parents: 36
diff changeset
   219
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   220
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   221
     using icons instead of strings:
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   222
                                                                        [exBegin]
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   223
        |v l e myList tabs i1 i2 i3|
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   224
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   225
        myList := OrderedCollection new.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   226
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   227
        tabs := TabulatorSpecification new.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   228
        tabs unit:#cm.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   229
        tabs positions:#(1 3 5).
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   230
        tabs align:#(#left #left #left).
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   231
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   232
        i1 := Image fromFile:'bitmaps/xpmBitmaps/document_images/small_dir.xpm'.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   233
        i2 := Image fromFile:'bitmaps/xpmBitmaps/document_images/small_file.xpm'.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   234
        i3 := Image fromFile:'bitmaps/xpmBitmaps/document_images/small_file_binary.xpm'.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   235
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   236
        1 to:100 do:[:i|
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   237
            e := MultiColListEntry new.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   238
            i odd ifTrue:[
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   239
                e colAt:1 put:i1.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   240
            ] ifFalse:[
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   241
                e colAt:1 put:i2
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   242
            ].
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   243
            e colAt:2 put:i printString.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   244
            e colAt:3 put:i3.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   245
            e tabulatorSpecification:tabs.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   246
            myList add:e.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   247
        ].
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   248
        l := SelectionInListView new.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   249
        l setList:myList expandTabs:false.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   250
        v := ScrollableView forView:l.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   251
        v extent:300@200.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   252
        v open
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   253
                                                                        [exEnd]
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   254
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   255
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   256
58
claus
parents: 36
diff changeset
   257
    concrete example, show /etc/passwd in a table:
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   258
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   259
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   260
        |v l s myList line e htabs tabs fingerEntry|
58
claus
parents: 36
diff changeset
   261
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   262
        tabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   263
        tabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   264
        tabs positions:#(0    2      3.5  4.5   5    8    11).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   265
        tabs align:    #(left left right right left left left).
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   266
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   267
        htabs := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   268
        htabs unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   269
        htabs positions:#(0    2      3.5      4.5    5    8    11).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   270
        htabs align:    #(left center center center left left left).
58
claus
parents: 36
diff changeset
   271
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   272
        myList := OrderedCollection new.
58
claus
parents: 36
diff changeset
   273
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   274
        e := MultiColListEntry 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   275
                    fromString:'login-name:password:uid:gid:finger-entry:home-dir:shell' 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   276
                    separatedBy:$:.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   277
        e tabulatorSpecification:htabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   278
        myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   279
        myList add:''.
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   280
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   281
        s := '/etc/passwd' asFilename readStream.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   282
        [s atEnd] whileFalse:[
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   283
            line := s nextLine.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   284
            e := MultiColListEntry 
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   285
                        fromString:line
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   286
                        separatedBy:$:.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   287
            fingerEntry := e colAt:5.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   288
            e colAt:5 put:(fingerEntry asCollectionOfSubstringsSeparatedBy:$,) first.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   289
            e tabulatorSpecification:tabs.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   290
            myList add:e.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   291
        ].
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   292
        s close.
58
claus
parents: 36
diff changeset
   293
        
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   294
        l := ListView new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   295
        l setList:myList expandTabs:false.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   296
        v := HVScrollableView forView:l.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   297
        v extent:600@200.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   298
        v open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   299
                                                                        [exEnd]
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   300
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   301
    a (dynamic) menu with aligned columns:
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   302
                                                                        [exBegin]
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   303
    |menu item l tabSpec n1 n2 n3 n4|
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   304
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   305
    menu := Menu new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   306
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   307
    tabSpec := TabulatorSpecification new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   308
    tabSpec unit:#inch.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   309
    tabSpec positions:#(0     1.5     ).
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   310
    tabSpec align:    #(#left #right).
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   311
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   312
    n1 := 123456.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   313
    n2 := 123.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   314
    n3 := 11111.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   315
    n4 := 9876.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   316
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   317
    l := MultiColListEntry fromStrings:#('N1:' '') tabulatorSpecification:tabSpec.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   318
    l colAt:2 put:n1 printString.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   319
    item := MenuItem new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   320
    item label:l.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   321
    menu addItem:item.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   322
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   323
    l := MultiColListEntry fromStrings:#('N2:' '') tabulatorSpecification:tabSpec.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   324
    l colAt:2 put:n2 printString.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   325
    item := MenuItem new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   326
    item label:l.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   327
    menu addItem:item.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   328
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   329
    l := MultiColListEntry fromStrings:#('N3:' '') tabulatorSpecification:tabSpec.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   330
    l colAt:2 put:n3 printString.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   331
    item := MenuItem new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   332
    item label:l.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   333
    menu addItem:item.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   334
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   335
    l := MultiColListEntry fromStrings:#('N4:' '') tabulatorSpecification:tabSpec.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   336
    l colAt:2 put:n4 printString.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   337
    item := MenuItem new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   338
    item label:l.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   339
    menu addItem:item.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   340
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   341
    menu showAtPointer.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   342
                                                                        [exEnd]
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   343
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   344
"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   345
! !
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   346
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   347
!MultiColListEntry class methodsFor:'instance creation'!
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   348
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   349
fromString:aString
1159
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   350
    "create and return a new listEntry with columns taken
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   351
     from the words of aString. Assumes that columns are
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   352
     separated by spaces in the string"
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   353
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   354
    ^ self fromString:aString separatedBy:(Character space)
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   355
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   356
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   357
     self fromString:'hello world a b' 
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   358
    "
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   359
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   360
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   361
fromString:aString separatedBy:separatorCharacter
1159
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   362
    "create and return a new listEntry with columns taken
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   363
     from the words of aString. Assumes that columns are
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   364
     separated by separatorCharacter in the string"
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   365
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   366
    |subStrings|
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   367
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   368
    subStrings := aString asCollectionOfSubstringsSeparatedBy:separatorCharacter.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   369
    ^ self fromStrings:subStrings
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   370
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   371
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   372
     self fromString:'hello:world:a:b' separatedBy:$:
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   373
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   374
!
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   375
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   376
fromString:aString separatedBy:separatorCharacter tabulatorSpecification:aTabSpec
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   377
    "create and return a new listEntry with columns taken
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   378
     from the words of aString. Assumes that columns are
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   379
     separated by separatorCharacter in the string"
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   380
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   381
    |e|
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   382
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   383
    e := self fromString:aString separatedBy:separatorCharacter.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   384
    e tabulatorSpecification:aTabSpec.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   385
    ^ e
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   386
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   387
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   388
     |tabSpec|
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   389
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   390
     tabSpec := TabulatorSpecification new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   391
     tabSpec unit:#inch.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   392
     tabSpec positions:#(0     1.5     ).
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   393
     tabSpec align:    #(#left #right).
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   394
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   395
     self fromString:'hello world a b' separatedBy:(Character space) tabulatorSpecification:tabSpec
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   396
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   397
!
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   398
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   399
fromStrings:aCollectionOfStrings
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   400
    "create and return a new listEntry with columns taken
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   401
     from the given aStrings."
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   402
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   403
    |idx e|
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   404
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   405
    e := self new.
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   406
    idx := 1.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   407
    aCollectionOfStrings do:[:sub |
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   408
        e colAt:idx put:sub.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   409
        idx := idx + 1.
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   410
    ].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   411
    ^ e
1969
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   412
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   413
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   414
     self fromStrings:#('hello' 'world')
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   415
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   416
!
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   417
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   418
fromStrings:aCollectionOfStrings tabulatorSpecification:aTabSpec
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   419
    "create and return a new listEntry with columns taken
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   420
     from the given aStrings."
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   421
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   422
    ^ (self fromStrings:aCollectionOfStrings) tabulatorSpecification:aTabSpec
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   423
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   424
    "
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   425
     |tabSpec|
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   426
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   427
     tabSpec := TabulatorSpecification new.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   428
     tabSpec unit:#inch.
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   429
     tabSpec positions:#(0     1.5     ).
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   430
     tabSpec align:    #(#left #right).
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   431
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   432
     self fromStrings:#('hello' 'world') tabulatorSpecification:tabSpec
e325d38ce469 examples and additional inst-creation
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
   433
    "
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   434
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   435
70
claus
parents: 62
diff changeset
   436
new:numberOfColumns
1159
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   437
    "create and return a new listEntry with numberOfColumns empty columns"
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   438
70
claus
parents: 62
diff changeset
   439
    |e|
claus
parents: 62
diff changeset
   440
claus
parents: 62
diff changeset
   441
    e := self new.
claus
parents: 62
diff changeset
   442
    1 to:numberOfColumns do:[:i |
1159
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   443
        e colAt:i put:''.
70
claus
parents: 62
diff changeset
   444
    ].
claus
parents: 62
diff changeset
   445
    ^ e
claus
parents: 62
diff changeset
   446
claus
parents: 62
diff changeset
   447
    "Modified: 30.8.1995 / 16:33:53 / claus"
claus
parents: 62
diff changeset
   448
!
claus
parents: 62
diff changeset
   449
claus
parents: 62
diff changeset
   450
new:numberOfColumns tabulatorSpecification:aTabSpec
1159
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   451
    "create and return a new listEntry with numberOfColumns empty columns
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   452
     and the given tab-specification"
eda06596899f comments
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
   453
70
claus
parents: 62
diff changeset
   454
    ^ (self new:numberOfColumns) tabulatorSpecification:aTabSpec
claus
parents: 62
diff changeset
   455
claus
parents: 62
diff changeset
   456
    "Modified: 30.8.1995 / 16:34:23 / claus"
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   457
! !
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   458
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   459
!MultiColListEntry methodsFor:'accessing'!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   460
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   461
colAt:index
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   462
    "return the substring at column index"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   463
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   464
    index > strings size ifTrue:[^ nil].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   465
    ^ strings at:index
70
claus
parents: 62
diff changeset
   466
!
claus
parents: 62
diff changeset
   467
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   468
colAt:index put:aString
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   469
    "replace the substring at column index"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   470
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   471
    strings isNil ifTrue:[
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   472
	strings := OrderedCollection new:index
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   473
    ].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   474
    index > strings size ifTrue:[strings grow:index].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   475
    strings at:index put:aString
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   476
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   477
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   478
strings:aCollectionOfStrings
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   479
    "replace all substrings"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   480
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   481
    strings := OrderedCollection withAll:aCollectionOfStrings. 
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   482
!
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   483
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   484
tabulatorSpecification:aTabSpec
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   485
    "set the tabulator spec"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   486
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   487
    tabSpec := aTabSpec
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   488
! !
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   489
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   490
!MultiColListEntry methodsFor:'converting'!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   491
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   492
asString
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   493
    "return the receiver as a string with embedded tabs"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   494
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   495
    |s sub tab 
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   496
     nSub "{ Class: SmallInteger }"|
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   497
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   498
    s := ''.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   499
    tab := Character tab asString.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   500
    nSub := strings size.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   501
    1 to:nSub do:[:subStringIndex |
363
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   502
        sub := strings at:subStringIndex.
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   503
        sub notNil ifTrue:[
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   504
            sub isString ifTrue:[
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   505
                s := s , sub.
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   506
            ]
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   507
        ].
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   508
        subStringIndex == nSub ifFalse:[
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   509
            s := s , tab
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   510
        ]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   511
    ].
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   512
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   513
    ^ s
103
f950776fd4e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   514
f950776fd4e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   515
    "Created: 24.11.1995 / 18:54:27 / cg"
363
c025abf2d73c care for non-string entries in #asString.
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   516
    "Modified: 17.4.1997 / 03:21:13 / cg"
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   517
! !
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   518
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   519
!MultiColListEntry methodsFor:'defaults'!
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   520
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   521
defaultTabSpec
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   522
    "the default tabulators are 1 inch apart"
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   523
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   524
    |spec|
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   525
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   526
    spec := DefaultTabSpec.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   527
    spec isNil ifTrue:[
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   528
	spec := TabulatorSpecification new.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   529
	spec unit:#inch.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   530
	spec positions:(0 to:20).
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   531
	spec align:    #left.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   532
	DefaultTabSpec := spec.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   533
    ].
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   534
    ^ spec.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   535
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   536
    "Created: 17.11.1995 / 12:23:29 / cg"
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   537
    "Modified: 17.11.1995 / 12:24:20 / cg"
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   538
! !
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   539
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   540
!MultiColListEntry methodsFor:'drawing'!
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   541
108
b228b94be590 displayOpaque fixes
Claus Gittinger <cg@exept.de>
parents: 103
diff changeset
   542
displayOn:aGC x:x y:y opaque:opaque
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   543
    "display the receiver on a GC"
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   544
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   545
    |xPos spec tabPos prevString y0|
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   546
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   547
    spec := tabSpec.
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   548
    spec isNil ifTrue:[
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   549
        spec := self defaultTabSpec
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   550
    ].
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   551
    xPos := x.
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   552
    prevString := ''.
364
38653918fee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   553
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   554
    aGC font:(aGC font onDevice:aGC device).
366
34e1870524f1 fetch device font before querying
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   555
34e1870524f1 fetch device font before querying
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   556
    y0 := y - aGC font ascent.
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   557
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   558
    strings keysAndValuesDo:[:index :subString |
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   559
        |item|
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   560
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   561
        subString notNil ifTrue:[
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   562
            "
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   563
             find next tab
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   564
            "
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   565
            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
   566
            tabPos isNil ifTrue:[
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   567
                "
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   568
                 no tab - just continue where we are ...
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   569
                "
2098
d59707230877 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
   570
                xPos := xPos + (prevString widthOn:aGC). "/ not: (aGC font widthOf:prevString) -- could be text or image
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   571
            ] ifFalse:[
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   572
                xPos := tabPos + x.
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   573
            ].
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   574
            subString isString ifFalse:[
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   575
                item := subString.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   576
                item isImage ifTrue:[
2098
d59707230877 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
   577
                    strings at:index put:(item := item onDevice:aGC device)
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   578
                ].
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   579
                item displayOn:aGC x:xPos y:y0
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   580
            ] ifTrue:[
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   581
                opaque ifTrue:[    
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   582
                    aGC displayOpaqueString:subString x:xPos y:y.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   583
                ] ifFalse:[    
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   584
                    aGC displayString:subString x:xPos y:y.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   585
                ].    
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   586
            ].
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   587
            prevString := subString.
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   588
        ]
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   589
    ].
89
eec056360d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   590
366
34e1870524f1 fetch device font before querying
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   591
    "Modified: 19.4.1997 / 09:54:56 / cg"
58
claus
parents: 36
diff changeset
   592
! !
36
160b8f0dfd7d *** empty log message ***
claus
parents: 34
diff changeset
   593
58
claus
parents: 36
diff changeset
   594
!MultiColListEntry methodsFor:'queries'!
claus
parents: 36
diff changeset
   595
357
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   596
heightOn:aGC
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   597
    "return the height of the receiver when displayed in aGC"
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   598
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   599
    |hMax|
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   600
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   601
    hMax := 0.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   602
    strings keysAndValuesDo:[:index :subString |
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   603
        |h|
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   604
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   605
        subString notNil ifTrue:[
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   606
            h := subString heightOn:aGC.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   607
            hMax := hMax max:h.
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   608
        ]
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   609
    ].
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   610
    ^ hMax
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   611
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   612
    "Created: 15.4.1997 / 09:39:07 / cg"
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   613
!
658764fa1f0f handle non-string items
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
   614
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   615
widthOn:aGC
58
claus
parents: 36
diff changeset
   616
    "return the width of the receiver when displayed in aGC"
claus
parents: 36
diff changeset
   617
62
claus
parents: 58
diff changeset
   618
    |xPos xMax tabPos prevLen|
58
claus
parents: 36
diff changeset
   619
claus
parents: 36
diff changeset
   620
    "just to make certain:
claus
parents: 36
diff changeset
   621
     do not assume, that the last col is the rightmost one ...
claus
parents: 36
diff changeset
   622
    "
claus
parents: 36
diff changeset
   623
    xPos := 0.
claus
parents: 36
diff changeset
   624
    xMax := 0.
claus
parents: 36
diff changeset
   625
    prevLen := 0.
claus
parents: 36
diff changeset
   626
    strings keysAndValuesDo:[:index :subString |
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   627
        |w|
62
claus
parents: 58
diff changeset
   628
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   629
        subString notNil ifTrue:[
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   630
            "
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   631
             find next tab
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   632
            "
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   633
            tabPos := tabSpec positionOfTab:index forString:subString on:aGC.
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   634
            tabPos isNil ifTrue:[
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   635
                "
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   636
                 no tab - just continue where we are ...
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   637
                "
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   638
                xPos := xPos + prevLen.
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   639
            ] ifFalse:[
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   640
                xPos := tabPos.
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   641
            ].
211
f6e9378de69f allow columns to consist of Text instances
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   642
            w := prevLen := subString widthOn:aGC. "/ aGC font widthOf:subString.
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   643
            xMax := xMax max:(xPos + w).
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   644
        ]
58
claus
parents: 36
diff changeset
   645
    ].
364
38653918fee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   646
    xMax isInteger ifFalse:[
38653918fee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   647
        ^ xMax truncated + 1
38653918fee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   648
    ].
58
claus
parents: 36
diff changeset
   649
    ^ xMax
173
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   650
d111da00daa9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   651
    "Created: 12.5.1996 / 20:38:38 / cg"
364
38653918fee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   652
    "Modified: 17.4.1997 / 12:52:00 / cg"
58
claus
parents: 36
diff changeset
   653
! !
claus
parents: 36
diff changeset
   654
329
098318898b01 comment
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   655
!MultiColListEntry class methodsFor:'documentation'!
98
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   656
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   657
version
2098
d59707230877 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
   658
    ^ '$Header: /cvs/stx/stx/libwidg2/MultiColListEntry.st,v 1.27 2002-05-06 06:06:12 cg Exp $'
98
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   659
! !