FileSelectionBox.st
author Claus Gittinger <cg@exept.de>
Mon, 12 Jan 1998 17:26:40 +0100
changeset 1411 c11734cd83ee
parent 1356 a30147637916
child 1571 fdaa3b9aa746
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1990 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 44
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
ListSelectionBox subclass:#FileSelectionBox
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
    14
	instanceVariableNames:'patternField selectingDirectory'
1320
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
    15
	classVariableNames:'LastFileSelectionDirectory'
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
    16
	poolDictionaries:''
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
    17
	category:'Views-DialogBoxes'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    18
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    19
849
3f3371dd8222 commentary
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
    20
!FileSelectionBox class methodsFor:'documentation'!
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    21
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    22
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    23
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    24
 COPYRIGHT (c) 1990 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 44
diff changeset
    25
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    26
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    27
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    28
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    30
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    31
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    32
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    33
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    34
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    35
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    36
documentation
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    37
"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    38
    this class implements file selection boxes. Instances show a list of
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    39
    files, and perform an action block with the selected pathname as
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    40
    argument when ok is clicked. It is also possible, to open the box
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    41
    without action and ask it afterward if it has been left with ok
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    42
    (i.e. the ST-80 way, asking 'aBox accepted ifTrue:[...]')
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    43
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    44
    There is an optional PatternField, which shows itself when a pattern
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    45
    is defined (i.e. if there is no pattern, it is hidden). 
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    46
    If there is a pattern, only files matching the pattern are shown in 
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    47
    the list. Directories are not affected by the patternField.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    48
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    49
    In addition, there is an optional matchBlock (actually this is defined 
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    50
    in the FileSelectionList). Only names for which this matchblock
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    51
    returns true will be presented. The matchBlock affects both regular files
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    52
    and names of directories. The argument passed to the matchBlock is the full
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    53
    pathname.
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    54
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    55
    All of the actual work is done in the fileList; see the documentation
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    56
    of FileSelectionList for more options 
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    57
    (you can access a boxes fileList via 'aBox>>listView' and get access to all
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    58
     of those fancy settings)
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    59
    For example, by accessing the list, it is possible to hide all directories 
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    60
    ('aBox listView ignoreDirectories:true'), to hide the parentDirectory alone 
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    61
    ('aBox listView ignoreParentDirectory') and to turn off the marking 
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    62
    of subdirectories ('aBox listView markSubdirectories:false').
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 548
diff changeset
    63
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 548
diff changeset
    64
    [author:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 548
diff changeset
    65
        Claus Gittinger
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 548
diff changeset
    66
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 548
diff changeset
    67
    [see also:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 548
diff changeset
    68
        DialogBox
648
fcf02d58882e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
    69
        EnterBox2 FilenameEnterBox YesNoBox
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    70
        ListSelectionBox FileSaveBox
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    71
        FileSelectionList SelectionInListView
62
7cc1e330da47 *** empty log message ***
claus
parents: 59
diff changeset
    72
"
7cc1e330da47 *** empty log message ***
claus
parents: 59
diff changeset
    73
!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    74
62
7cc1e330da47 *** empty log message ***
claus
parents: 59
diff changeset
    75
examples 
7cc1e330da47 *** empty log message ***
claus
parents: 59
diff changeset
    76
"
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    77
  simple standard queries
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    78
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
    79
    very simple:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    80
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
    81
        |name|
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
    82
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    83
        name := FileSelectionBox requestFileName.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
    84
        Transcript showCR:name
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    85
                                                                        [exEnd]
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    86
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
    87
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
    88
    simple:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    89
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
    90
        |name|
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
    91
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    92
        name := FileSelectionBox requestFileName:'which file ?'.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
    93
        Transcript showCR:name
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    94
                                                                        [exEnd]
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    95
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
    96
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
    97
    with initial selection:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    98
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
    99
        |name|
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   100
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   101
        name := FileSelectionBox requestFileName:'which file ?' default:'Make.proto'.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   102
        Transcript showCR:name
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   103
                                                                        [exEnd]
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   104
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   105
12
1c8e8c53e8cf *** empty log message ***
claus
parents: 7
diff changeset
   106
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   107
  more detailed setup
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   108
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   109
    setting title:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   110
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   111
        |box|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   112
        box := FileSelectionBox new.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   113
        box title:'Which file ?'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   114
        box open.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   115
        box accepted ifTrue:[
1411
c11734cd83ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1356
diff changeset
   116
            Transcript showCR:'you selected: ' , box pathName
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   117
        ]
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   118
                                                                        [exEnd]
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   119
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   120
    setting a matchpattern:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   121
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   122
        |box|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   123
        box := FileSelectionBox new.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   124
        box title:'Which file ?'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   125
        box pattern:'*.rc'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   126
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   127
                                                                        [exEnd]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   128
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   129
    setting multiple patterns:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   130
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   131
        |box|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   132
        box := FileSelectionBox new.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   133
        box title:'Which file ?'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   134
        box pattern:'*.rc;*.st'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   135
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   136
                                                                        [exEnd]
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   137
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   138
    setting a matchblock:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   139
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   140
        |box|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   141
        box := FileSelectionBox new.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   142
        box title:'Which file ?'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   143
        box directory:'/etc'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   144
        box pattern:'*'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   145
        box matchBlock:[:name | name asFilename baseName first between:$a and:$z].
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   146
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   147
                                                                        [exEnd]
44
f5e3a267fe4e pass fullname to matchblock
claus
parents: 41
diff changeset
   148
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   149
    both pattern and matchBlock:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   150
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   151
        |box|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   152
        box := FileSelectionBox new.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   153
        box title:'Which directory ?'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   154
        box selectingDirectory:true.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   155
        box pattern:'l*'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   156
        box matchBlock:[:name | OperatingSystem isDirectory:name].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   157
        box action:[:fn | Transcript showCR:fn].
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   158
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   159
                                                                        [exEnd]
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   160
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   161
    dont show the parent directory:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   162
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   163
        |box|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   164
        box := FileSelectionBox new.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   165
        box title:'Which directory ?'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   166
        box listView ignoreParentDirectory:true.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   167
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   168
                                                                        [exEnd]
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   169
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   170
    dont show any directory:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   171
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   172
        |box|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   173
        box := FileSelectionBox new.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   174
        box title:'Which file ?'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   175
        box listView ignoreDirectories:true.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   176
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   177
                                                                        [exEnd]
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   178
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   179
    dont show any directory or hidden file:
842
a27a1c6ddde0 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 800
diff changeset
   180
    (notice the basename extraction - we are not interested in the full pathName)
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   181
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   182
        |box|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   183
        box := FileSelectionBox new.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   184
        box title:'Which file ?'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   185
        box listView ignoreDirectories:true.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   186
        box matchBlock:[:name | (name asFilename baseName startsWith:'.') not].
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   187
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   188
                                                                        [exEnd]
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   189
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   190
    dont allow direct filename entry:
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   191
    (i.e. avoid the user choosing files from other directories)
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   192
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   193
        |box|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   194
        box := FileSelectionBox new.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   195
        box title:'Which one ?'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   196
        box enterField beInvisible.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   197
        box open.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   198
        box accepted ifTrue:[
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   199
            Transcript showCR:'path is ' , box pathName
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   200
        ].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   201
                                                                        [exEnd]
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   202
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   203
    combined with above directory ignoring,
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   204
    this limits selection of files from a single directory:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   205
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   206
        |box|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   207
        box := FileSelectionBox new.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   208
        box title:'Which file ?'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   209
        box enterField beInvisible.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   210
        box listView ignoreDirectories:true.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   211
        box open.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   212
        box accepted ifTrue:[
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   213
            Transcript showCR:'path is ' , box pathName
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   214
        ].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   215
                                                                        [exEnd]
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   216
238
a81e517187e4 examples
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   217
    finally, an action:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   218
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   219
        |box|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   220
        box := FileSelectionBox new.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   221
        box title:'Which directory ?'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   222
        box pattern:'l*'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   223
        box matchBlock:[:name | OperatingSystem isDirectory:name].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   224
        box action:[:name | Transcript showCR:name].
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   225
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   226
                                                                        [exEnd]
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   227
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   228
  concrete examples:
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   229
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   230
    only show files beginning with lowercase characters
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   231
    and ending in '.c':
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   232
                                                                        [exBegin]
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   233
        |box|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   234
        box := FileSelectionBox new.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   235
        box title:'Which directory ?'.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   236
        box matchBlock:[:name |
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   237
                            box pathName asFilename isDirectory
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   238
                            or:[name first isLowercase
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   239
                                and:[name endsWith:'.c']]
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   240
                       ].
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   241
        box open.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   242
        box accepted ifTrue:[
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   243
            Transcript showCR:'full path:  ' , box pathName.
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   244
            Transcript showCR:'files name: ' , box fileName.
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   245
            Transcript showCR:'directory : ' , box directory.
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   246
        ]
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   247
                                                                        [exEnd]
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   248
"
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   249
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   250
1320
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   251
!FileSelectionBox class methodsFor:'accessing'!
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   252
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   253
lastFileSelectionDirectory
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   254
    ^ LastFileSelectionDirectory
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   255
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   256
    "Created: 9.9.1997 / 10:03:17 / cg"
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   257
!
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   258
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   259
lastFileSelectionDirectory:aDirectoryString
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   260
    LastFileSelectionDirectory := aDirectoryString
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   261
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   262
    "Created: 9.9.1997 / 10:03:42 / cg"
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   263
! !
47ff27735939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   264
849
3f3371dd8222 commentary
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   265
!FileSelectionBox class methodsFor:'defaults'!
12
1c8e8c53e8cf *** empty log message ***
claus
parents: 7
diff changeset
   266
1c8e8c53e8cf *** empty log message ***
claus
parents: 7
diff changeset
   267
listViewType
1c8e8c53e8cf *** empty log message ***
claus
parents: 7
diff changeset
   268
    "return the type of listView - using a FileSelectionList here"
1c8e8c53e8cf *** empty log message ***
claus
parents: 7
diff changeset
   269
1c8e8c53e8cf *** empty log message ***
claus
parents: 7
diff changeset
   270
    ^ FileSelectionList
1c8e8c53e8cf *** empty log message ***
claus
parents: 7
diff changeset
   271
! !
1c8e8c53e8cf *** empty log message ***
claus
parents: 7
diff changeset
   272
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   273
!FileSelectionBox methodsFor:'accessing'!
3
claus
parents: 0
diff changeset
   274
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   275
contents
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   276
    "return the current entered value (i.e. the enterFields string).
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   277
     redefined to return the full pathname."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   278
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   279
    |string sep|
3
claus
parents: 0
diff changeset
   280
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   281
    string := super contents.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   282
    string isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   283
	^ selectionList directory pathName
121
claus
parents: 120
diff changeset
   284
    ].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   285
    sep := Filename separator.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   286
    (string startsWith:sep) ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   287
	^ string
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   288
    ].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   289
    ^ (selectionList directory pathName asFilename construct:string) asString
132
claus
parents: 130
diff changeset
   290
!
claus
parents: 130
diff changeset
   291
296
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   292
directory
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   293
    "return the directory which is currently shown"
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   294
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   295
    ^ selectionList directory
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   296
!
e1b9431b3aef more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   297
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   298
directory:directoryName
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   299
    "change the directory shown in the list."
41
2f8d0f8e796b update list when namefiled cannot complete name
claus
parents: 38
diff changeset
   300
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   301
    selectionList directory:directoryName
132
claus
parents: 130
diff changeset
   302
!
claus
parents: 130
diff changeset
   303
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   304
fileName
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   305
    "if some filename has been entered, return it (without the directory path)
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   306
     otherwise, return nil"
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   307
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   308
    |string|
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   309
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   310
    string := super contents.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   311
    string isNil ifTrue:[^ nil].
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   312
    ^ self pathName
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   313
!
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   314
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   315
matchBlock:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   316
    "set the matchBlock (in the selectionList). Only files
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   317
     for which the block returns true are shown.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   318
     The matching is actually done in the fileSelectionList."
77
565b052f5277 *** empty log message ***
claus
parents: 62
diff changeset
   319
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   320
    selectionList matchBlock:aBlock 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   321
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   322
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   323
openOn:aPath
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   324
    "open the box showing files in aPath.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   325
     This is only a shortcut message - no new functionality."
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   326
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   327
    self directory:aPath.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   328
    self showAtPointer
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   329
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   330
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   331
pathName
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   332
    "same as contents - return the full pathname of the selected file,
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   333
     or the pathname of the directory if nothing has been entered"
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   334
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   335
    ^ self contents
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   336
!
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   337
3
claus
parents: 0
diff changeset
   338
pattern:aPattern
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   339
    "set the pattern - this also enables the PatternField
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   340
     (if the pattern is non-nil) or hides it (if nil)."
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   341
1270
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   342
    |focusSequence|
130
claus
parents: 121
diff changeset
   343
3
claus
parents: 0
diff changeset
   344
    patternField initialText:aPattern.
12
1c8e8c53e8cf *** empty log message ***
claus
parents: 7
diff changeset
   345
    selectionList pattern:aPattern.
1c8e8c53e8cf *** empty log message ***
claus
parents: 7
diff changeset
   346
    aPattern isNil ifTrue:[
1270
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   347
        patternField beInvisible.
1356
a30147637916 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   348
        self makeUntabable:patternField.
1270
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   349
        focusSequence := (Array 
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   350
                             with:enterField 
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   351
                             with:selectionList 
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   352
                             with:okButton 
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   353
                             with:abortButton)
12
1c8e8c53e8cf *** empty log message ***
claus
parents: 7
diff changeset
   354
    ] ifFalse:[
1270
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   355
        patternField beVisible.
1356
a30147637916 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   356
        self makeTabable:patternField before:enterField.
1270
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   357
        focusSequence := (Array 
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   358
                             with:patternField 
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   359
                             with:enterField 
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   360
                             with:selectionList 
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   361
                             with:okButton 
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   362
                             with:abortButton)
130
claus
parents: 121
diff changeset
   363
    ].
claus
parents: 121
diff changeset
   364
claus
parents: 121
diff changeset
   365
    windowGroup notNil ifTrue:[
1270
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   366
        windowGroup focusSequence:focusSequence
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   367
    ].
1270
8f14ed5cfeb9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 849
diff changeset
   368
1356
a30147637916 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   369
    "Modified: 18.10.1997 / 03:02:05 / cg"
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   370
!
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   371
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   372
selectingDirectory:aBoolean
849
3f3371dd8222 commentary
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   373
    "setup the box for directory selection (hides regular files).
3f3371dd8222 commentary
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   374
     Use this, to ask the user for a directories name"
3f3371dd8222 commentary
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   375
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   376
    selectingDirectory := aBoolean.
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   377
    aBoolean ifTrue:[
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   378
        selectionList directoryChangeAction:[:entry | self directoryChanged].
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   379
        selectionList directorySelectAction:[:entry | self directorySelected].
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   380
        selectionList ignoreFiles:true.
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   381
    ]
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   382
849
3f3371dd8222 commentary
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   383
    "Modified: 22.10.1996 / 13:24:50 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   384
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   385
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   386
!FileSelectionBox methodsFor:'change & update'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   387
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   388
update:something with:argument from:changedObject
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   389
    |commonName index s|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   390
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   391
    something == #directory ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   392
	"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   393
	 sent by fileNameEnterField, if a filename
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   394
	 completion was not possible due to multiple
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   395
	 matches.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   396
	"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   397
	selectionList directory:argument.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   398
	s := enterField contents.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   399
	s notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   400
	    commonName := s asFilename baseName.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   401
	    commonName size > 0 ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   402
		index := selectionList list findFirst:[:entry | entry startsWith:commonName].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   403
		index ~~ 0 ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   404
		    selectionList makeLineVisible:index
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   405
		]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   406
	    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   407
	]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   408
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   409
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   410
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   411
!FileSelectionBox methodsFor:'initialization'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   412
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   413
createEnterField
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   414
    "if the (optional) class FilenameEditField is present, use
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   415
     it, since it provides filename completion. Otherwise, we have
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   416
     to live with the dumb (default) field ...
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   417
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   418
    FilenameEditField notNil ifTrue:[
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   419
        ^ FilenameEditField new.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   420
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   421
    ^ super createEnterField
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   422
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   423
    "Modified: 18.4.1996 / 20:02:24 / cg"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   424
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   425
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   426
initialize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   427
    |corner|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   428
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   429
    super initialize.
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   430
    selectingDirectory := false.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   431
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   432
    label := resources string:'File dialog'.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   433
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   434
    labelField extent:(0.7 @ labelField height).
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   435
    labelField label:(resources string:'select a file:').
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   436
    labelField adjust:#left.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   437
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   438
    patternField := EditField in:self.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   439
    self is3D ifTrue:[
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   440
        corner := (1.0 @ (labelField origin y+patternField heightIncludingBorder)).
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   441
    ] ifFalse:[
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   442
        corner := [(width - ViewSpacing - (patternField borderWidth * 2)) @ (labelField origin y+patternField height"IncludingBorder")].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   443
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   444
    patternField origin:(0.7 @ labelField origin y) corner:corner.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   445
    patternField rightInset:ViewSpacing.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   446
    patternField initialText:'*'.
746
4442a4d4121f dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   447
    patternField leaveAction:[:reason | self patternChanged]. 
4442a4d4121f dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   448
    patternField crAction:[self patternChanged].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   449
    patternField hiddenOnRealize:true. "delay showing, until a pattern is defined"
1356
a30147637916 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   450
"/ no, since its invisible
a30147637916 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   451
"/    self makeTabable:patternField before:enterField.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   452
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   453
    enterField addDependent:self.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   454
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   455
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   456
     FileSelectionBox open
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   457
     FileSelectionBox new show
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   458
    "
740
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   459
1356
a30147637916 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   460
    "Modified: 18.10.1997 / 02:47:49 / cg"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   461
!
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   462
1271
eb55fd7c60bb #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   463
postRealize
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   464
    "if some default is present in the enterField,
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   465
     scroll to make this one visible"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   466
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   467
    |contents|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   468
1271
eb55fd7c60bb #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   469
    super postRealize.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   470
    (contents := enterField contents) notNil ifTrue:[
1271
eb55fd7c60bb #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   471
        contents notEmpty ifTrue:[
eb55fd7c60bb #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   472
            selectionList makeVisible:contents
eb55fd7c60bb #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   473
        ]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   474
    ]
1271
eb55fd7c60bb #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   475
eb55fd7c60bb #realize -> #postRealize
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   476
    "Created: 24.7.1997 / 18:19:14 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   477
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   478
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   479
!FileSelectionBox methodsFor:'private'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   480
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   481
updateList
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   482
    selectionList updateList
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   483
! !
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   484
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   485
!FileSelectionBox methodsFor:'queries'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   486
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   487
preferredExtent
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   488
    "return my preferred extent - thats the minimum size 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   489
     to make everything visible"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   490
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   491
    |wWanted hWanted mm|
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   492
800
0d8a2d42398d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   493
    "/ If I have an explicit preferredExtent ..
0d8a2d42398d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   494
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   495
    preferredExtent notNil ifTrue:[
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   496
        ^ preferredExtent
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   497
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   498
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   499
    mm := ViewSpacing.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   500
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   501
    wWanted := mm + 
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   502
               labelField preferredExtent x + 
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   503
               (mm * 2) + 
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   504
               patternField preferredExtent x + 
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   505
               mm.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   506
    (wWanted < width) ifTrue:[
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   507
        wWanted := width
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   508
    ].
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   509
    hWanted := mm + labelField height +
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   510
               mm + enterField height +
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   511
               mm + selectionList height +
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   512
               mm + buttonPanel preferredExtent y +
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   513
               mm.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   514
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   515
    (hWanted < height) ifTrue:[
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   516
        hWanted := height
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   517
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   518
    ^ (wWanted @ hWanted)
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   519
800
0d8a2d42398d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   520
    "Modified: 19.7.1996 / 20:44:04 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   521
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   522
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   523
!FileSelectionBox methodsFor:'user actions'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   524
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   525
directoryChanged
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   526
    selectingDirectory ifTrue:[
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   527
        selectionList changeDirectory.
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   528
        enterField contents:(selectionList directory pathName).
682
8d54259c0fef selection: / setSelection:
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   529
        selectionList setSelection:nil.
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   530
    ].
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   531
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   532
    "Created: 18.4.1996 / 18:38:21 / cg"
682
8d54259c0fef selection: / setSelection:
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   533
    "Modified: 25.5.1996 / 12:27:05 / cg"
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   534
!
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   535
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   536
directorySelected
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   537
    selectingDirectory ifTrue:[
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   538
        enterField contents:(selectionList directory pathName
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   539
                             , '/' , selectionList selectionValue).
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   540
    ].
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   541
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   542
    "Modified: 18.4.1996 / 18:40:41 / cg"
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   543
    "Created: 18.4.1996 / 18:46:15 / cg"
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   544
!
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   545
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   546
doubleClick
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   547
    |entry|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   548
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   549
    entry := selectionList selectionValue.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   550
    entry notNil ifTrue:[
1356
a30147637916 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   551
        ((selectionList directory asFilename construct:entry) isDirectory) ifFalse:[
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   552
            selectingDirectory ifFalse:[
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   553
                enterField contents:entry.
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   554
                self okPressed
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   555
            ]
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   556
        ]
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   557
    ].
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   558
1356
a30147637916 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   559
    "Modified: 19.10.1997 / 00:17:37 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   560
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   561
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   562
okPressed
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   563
    "called for both on ok-press and on return-key"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   564
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   565
    |dir string fname|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   566
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   567
    string := enterField contents.
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   568
    (string notNil and:[string notEmpty]) ifTrue:[
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   569
        string := string withoutSeparators.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   570
        string asFilename isAbsolute ifTrue:[
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   571
            fname := string asFilename
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   572
        ] ifFalse:[
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   573
            dir := selectionList directory pathName asFilename.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   574
            fname := dir construct:string
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   575
        ].
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   576
        fname isDirectory ifTrue:[
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   577
            selectingDirectory ifFalse:[
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   578
                selectionList directory:fname asString.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   579
                self updateList.
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   580
                ^ self
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   581
            ]    
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   582
        ]
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   583
    ] ifFalse:[
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   584
        selectingDirectory ifTrue:[
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   585
            enterField contents:(selectionList directory pathName).
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   586
        ].
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   587
    ].
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   588
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   589
    super okPressed
351
24a527f86c7b allow multiple patterns sep'd by semi
ca
parents: 296
diff changeset
   590
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   591
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   592
746
4442a4d4121f dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   593
patternChanged
4442a4d4121f dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   594
    selectionList pattern:patternField contents. 
4442a4d4121f dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   595
    self updateList
4442a4d4121f dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   596
4442a4d4121f dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   597
    "Created: 4.6.1996 / 20:30:23 / cg"
4442a4d4121f dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   598
!
4442a4d4121f dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   599
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   600
selectionChanged
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   601
    |entry|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   602
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   603
    entry := selectionList selectionValue.
1333
56af09878b96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
   604
    (selectionList directory asFilename construct:entry) type == #directory ifFalse:[
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   605
        selectingDirectory ifTrue:[
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   606
            enterField contents:(selectionList directory pathName).
682
8d54259c0fef selection: / setSelection:
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   607
            selectionList setSelection:nil.
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   608
            ^ self
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   609
        ]
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   610
    ].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   611
    enterField contents:entry
548
c418699a90c0 moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   612
1333
56af09878b96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1320
diff changeset
   613
    "Modified: 21.9.1997 / 12:07:55 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   614
! !
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   615
849
3f3371dd8222 commentary
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   616
!FileSelectionBox class methodsFor:'documentation'!
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   617
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   618
version
1411
c11734cd83ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1356
diff changeset
   619
    ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionBox.st,v 1.47 1998-01-12 16:26:40 cg Exp $'
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   620
! !