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