DialogBox.st
author Claus Gittinger <cg@exept.de>
Sat, 27 Jan 1996 18:58:46 +0100
changeset 312 008267b920d9
parent 310 4bbc8deffc8c
child 314 705185e7001d
permissions -rw-r--r--
allow more control over the indent when adding components
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
     1
"
81e3409404d2 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
81e3409404d2 Initial revision
claus
parents:
diff changeset
     3
	      All Rights Reserved
81e3409404d2 Initial revision
claus
parents:
diff changeset
     4
81e3409404d2 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
81e3409404d2 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
81e3409404d2 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
81e3409404d2 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
81e3409404d2 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
81e3409404d2 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
81e3409404d2 Initial revision
claus
parents:
diff changeset
    11
"
81e3409404d2 Initial revision
claus
parents:
diff changeset
    12
81e3409404d2 Initial revision
claus
parents:
diff changeset
    13
ModalBox subclass:#DialogBox
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    14
	instanceVariableNames:'buttonPanel okButton okAction abortButton abortAction
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    15
		acceptReturnAsOK yPosition leftIndent rightIndent bindings
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    16
		addedComponents inputFieldGroup acceptOnLeave acceptValue
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
    17
		tabableElements hideOnAccept acceptCheck needResize'
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    18
	classVariableNames:''
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    19
	poolDictionaries:''
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    20
	category:'Views-DialogBoxes'
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
    21
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
    22
81e3409404d2 Initial revision
claus
parents:
diff changeset
    23
!DialogBox class methodsFor:'documentation'!
81e3409404d2 Initial revision
claus
parents:
diff changeset
    24
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    25
copyright
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    26
"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    27
 COPYRIGHT (c) 1994 by Claus Gittinger
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    28
	      All Rights Reserved
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    29
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    30
 This software is furnished under a license and may be used
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    31
 only in accordance with the terms of that license and with the
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    33
 be provided or otherwise made available to, or used by, any
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    34
 other person.  No title to or ownership of the software is
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    35
 hereby transferred.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    36
"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
    37
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
    38
81e3409404d2 Initial revision
claus
parents:
diff changeset
    39
documentation
81e3409404d2 Initial revision
claus
parents:
diff changeset
    40
"
81e3409404d2 Initial revision
claus
parents:
diff changeset
    41
    this class implements the common behavior of dialogboxes.
81e3409404d2 Initial revision
claus
parents:
diff changeset
    42
81e3409404d2 Initial revision
claus
parents:
diff changeset
    43
    DialogBox is an (abstract) superclass of many other boxes - see InfoBox,
81e3409404d2 Initial revision
claus
parents:
diff changeset
    44
    WarningBox, YesNoBox etc. for concrete examples.
81e3409404d2 Initial revision
claus
parents:
diff changeset
    45
    Most of them simply add buttons or other elements.
81e3409404d2 Initial revision
claus
parents:
diff changeset
    46
121
claus
parents: 120
diff changeset
    47
    For programmatically created boxes, instances support adding of components
claus
parents: 120
diff changeset
    48
    in a top-to-bottom fashion, and also keep track of added text-fields and,
claus
parents: 120
diff changeset
    49
    since they are most common, automatically create an EnterFieldGroup for
claus
parents: 120
diff changeset
    50
    them.
122
claus
parents: 121
diff changeset
    51
    Caveat: more adding support is required - especially for row-wise
claus
parents: 121
diff changeset
    52
    construction.
claus
parents: 121
diff changeset
    53
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    54
    Historic note:
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    55
	originally, ST/X had separate classes for the various entry methods;
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    56
	there were YesNoBox, EnterBox, InfoBox and so on.
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    57
	ST-80 has all this defined in the common Dialog.
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    58
	Therefore, for compatibility, many ST/X methods defined here in Dialogs 
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    59
	class protocol simply dispatch to some other boxes class method.
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    60
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    61
121
claus
parents: 120
diff changeset
    62
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
    63
    instance variables:
81e3409404d2 Initial revision
claus
parents:
diff changeset
    64
81e3409404d2 Initial revision
claus
parents:
diff changeset
    65
	buttonPanel      <PanelView>    contains the button(s)
81e3409404d2 Initial revision
claus
parents:
diff changeset
    66
81e3409404d2 Initial revision
claus
parents:
diff changeset
    67
	okButton         <Button>       the ok-Button
81e3409404d2 Initial revision
claus
parents:
diff changeset
    68
81e3409404d2 Initial revision
claus
parents:
diff changeset
    69
	okAction         <Block>        the action to be performed when ok is pressed,
81e3409404d2 Initial revision
claus
parents:
diff changeset
    70
					or return is pressed.
81e3409404d2 Initial revision
claus
parents:
diff changeset
    71
81e3409404d2 Initial revision
claus
parents:
diff changeset
    72
	acceptReturnAsOK <Boolean>      if true, pressing the return-key counts
81e3409404d2 Initial revision
claus
parents:
diff changeset
    73
					as if ok was pressed. Default is true.
81e3409404d2 Initial revision
claus
parents:
diff changeset
    74
81e3409404d2 Initial revision
claus
parents:
diff changeset
    75
	abortButton      <Button>       the cancel-Button
81e3409404d2 Initial revision
claus
parents:
diff changeset
    76
81e3409404d2 Initial revision
claus
parents:
diff changeset
    77
	abortAction      <Block>        the action to be performed when cancel is
81e3409404d2 Initial revision
claus
parents:
diff changeset
    78
					pressed.
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
    79
121
claus
parents: 120
diff changeset
    80
	yPosisition      <Integer>      current y position when adding components
claus
parents: 120
diff changeset
    81
128
claus
parents: 126
diff changeset
    82
	leftIndent       <Integer>      left inset to use when adding components
claus
parents: 126
diff changeset
    83
claus
parents: 126
diff changeset
    84
	rightIndent      <Integer>      right inset to use when adding components
121
claus
parents: 120
diff changeset
    85
claus
parents: 120
diff changeset
    86
	addedComponents  <Collection>   programmatically added components
claus
parents: 120
diff changeset
    87
claus
parents: 120
diff changeset
    88
	inputFieldGroup  <EnterFieldGroup>   
claus
parents: 120
diff changeset
    89
					for added input fields
claus
parents: 120
diff changeset
    90
125
claus
parents: 122
diff changeset
    91
	acceptOnLeave    <Boolean>      if true (the default) and there are 
claus
parents: 122
diff changeset
    92
					tabable inputFields, accept and close when
claus
parents: 122
diff changeset
    93
					the last field is left. If false, the ok
claus
parents: 122
diff changeset
    94
					button must be pressed to close the box.
claus
parents: 122
diff changeset
    95
128
claus
parents: 126
diff changeset
    96
	acceptedValue    v(<Boolean>)   valueHolder on a boolean
claus
parents: 126
diff changeset
    97
					after close: holds true if box was accepted
claus
parents: 126
diff changeset
    98
					(i.e. ok-Button was pressed), false if box was
claus
parents: 126
diff changeset
    99
					closed via cancel or window manager.
121
claus
parents: 120
diff changeset
   100
claus
parents: 120
diff changeset
   101
        
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   102
    For compatibility with ST-80, this class is also available under
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   103
    the global names DialogView and Dialog (see patches file).
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   104
"
81e3409404d2 Initial revision
claus
parents:
diff changeset
   105
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
   106
81e3409404d2 Initial revision
claus
parents:
diff changeset
   107
examples
81e3409404d2 Initial revision
claus
parents:
diff changeset
   108
"
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   109
    historically, DialogBox was used as an abstract class as a base for InfoBox, 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   110
    YesNoBox etc. However, the programmatic construction protocol (addComponent)
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   111
    now allows those classes to be easily replaced and future versions may
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   112
    do this and make those subclasses obsolete.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   113
125
claus
parents: 122
diff changeset
   114
    For most simple standard dialogs, there are ready to use
claus
parents: 122
diff changeset
   115
    methods in the class protocol.
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   116
125
claus
parents: 122
diff changeset
   117
    For example:
claus
parents: 122
diff changeset
   118
claus
parents: 122
diff changeset
   119
      info & warnings:
claus
parents: 122
diff changeset
   120
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   121
        Dialog information:'hi there'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   122
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   123
        Dialog warn:'oops'
125
claus
parents: 122
diff changeset
   124
claus
parents: 122
diff changeset
   125
claus
parents: 122
diff changeset
   126
      yes/no questions:
claus
parents: 122
diff changeset
   127
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   128
        (Dialog confirm:'is this simple ?')
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   129
        ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   130
            Transcript showCr:'thats what I expected'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   131
        ] ifFalse:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   132
            Transcript showCr:'read more examples and documentation'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   133
        ]
125
claus
parents: 122
diff changeset
   134
claus
parents: 122
diff changeset
   135
claus
parents: 122
diff changeset
   136
      yes/no question with cancel option:
claus
parents: 122
diff changeset
   137
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   138
        |answer|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   139
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   140
        answer := Dialog confirmWithCancel:'is this simple ?'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   141
        answer isNil ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   142
            Transcript showCr:'no easy decision'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   143
        ] ifFalse:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   144
            answer ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   145
                Transcript showCr:'thats what I expected'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   146
            ] ifFalse:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   147
                Transcript showCr:'read more examples and documentation'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   148
            ]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   149
        ]
125
claus
parents: 122
diff changeset
   150
claus
parents: 122
diff changeset
   151
claus
parents: 122
diff changeset
   152
      asking for a string:
claus
parents: 122
diff changeset
   153
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   154
        |s|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   155
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   156
        s := Dialog request:'enter your name, please:'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   157
        s notEmpty ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   158
            Transcript showCr:'you entered: ' , s.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   159
        ]
125
claus
parents: 122
diff changeset
   160
claus
parents: 122
diff changeset
   161
claus
parents: 122
diff changeset
   162
      asking for a string with given default:
claus
parents: 122
diff changeset
   163
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   164
        |s|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   165
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   166
        s := Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   167
                request:'enter your name, please:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   168
                initialAnswer:(OperatingSystem getLoginName).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   169
        s notEmpty ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   170
            Transcript showCr:'you entered: ' , s.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   171
        ]
125
claus
parents: 122
diff changeset
   172
claus
parents: 122
diff changeset
   173
claus
parents: 122
diff changeset
   174
      asking for a filename:
claus
parents: 122
diff changeset
   175
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   176
        |s|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   177
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   178
        s := Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   179
                requestFileName:'select a file, please:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   180
                default:''.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   181
        Transcript show:'you entered: '; showCr:s.
125
claus
parents: 122
diff changeset
   182
claus
parents: 122
diff changeset
   183
claus
parents: 122
diff changeset
   184
      with changed button label and pattern:
claus
parents: 122
diff changeset
   185
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   186
        |s|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   187
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   188
        s := Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   189
                requestFileName:'select a file, please:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   190
                default:''
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   191
                ok:'show'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   192
                abort:'cancel'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   193
                pattern:'*.rc'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   194
        Transcript show:'you entered: '; showCr:s.
125
claus
parents: 122
diff changeset
   195
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   196
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   197
      asking for a password:
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   198
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   199
        |s|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   200
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   201
        s := Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   202
                requestPassword:'enter your secret, please:'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   203
        Transcript show:'you entered: '; showCr:s.
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   204
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   205
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   206
118
claus
parents: 112
diff changeset
   207
    However, you can construct dialogs programmatically, as shown in
claus
parents: 112
diff changeset
   208
    the following examples:
91
e8db16616e97 *** empty log message ***
claus
parents: 76
diff changeset
   209
121
claus
parents: 120
diff changeset
   210
    basic (unusable) example:
claus
parents: 120
diff changeset
   211
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   212
        DialogBox new open
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   213
121
claus
parents: 120
diff changeset
   214
    still unusable - only an ok-button:
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   215
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   216
        DialogBox new addOkButton; open
121
claus
parents: 120
diff changeset
   217
claus
parents: 120
diff changeset
   218
    both ok- and abortButtons:
118
claus
parents: 112
diff changeset
   219
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   220
        DialogBox new addAbortButton; addOkButton; open
121
claus
parents: 120
diff changeset
   221
122
claus
parents: 121
diff changeset
   222
    with different ok-label:
claus
parents: 121
diff changeset
   223
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   224
        DialogBox new addAbortButton; addOkButtonLabelled:'yeah'; open
122
claus
parents: 121
diff changeset
   225
121
claus
parents: 120
diff changeset
   226
    adding a textlabel gives an infoBox:
120
claus
parents: 118
diff changeset
   227
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   228
        DialogBox new
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   229
            addTextLabel:'hello';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   230
            addOkButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   231
            open
121
claus
parents: 120
diff changeset
   232
claus
parents: 120
diff changeset
   233
    a textlabel with abort- and okButton gives a yesNoBox:
118
claus
parents: 112
diff changeset
   234
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   235
        DialogBox new
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   236
            addTextLabel:'hello';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   237
            addAbortButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   238
            addOkButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   239
            open
121
claus
parents: 120
diff changeset
   240
claus
parents: 120
diff changeset
   241
    the same, adjusting the labels contents to the left:
claus
parents: 120
diff changeset
   242
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   243
        |box|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   244
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   245
        box := DialogBox new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   246
        (box addTextLabel:'hello') adjust:#left.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   247
        box addAbortButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   248
            addOkButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   249
            open
121
claus
parents: 120
diff changeset
   250
122
claus
parents: 121
diff changeset
   251
    with modified buttons:
claus
parents: 121
diff changeset
   252
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   253
        |box|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   254
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   255
        box := DialogBox new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   256
        (box addTextLabel:'are you certain ?') adjust:#left.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   257
        box addAbortButtonLabelled:'not really'. 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   258
        (box addOkButtonLabelled:'yes, absolutely') 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   259
                activeBackgroundColor:Color red. 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   260
        box open
122
claus
parents: 121
diff changeset
   261
claus
parents: 121
diff changeset
   262
162
claus
parents: 157
diff changeset
   263
    mswindows style:
claus
parents: 157
diff changeset
   264
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   265
        |b box|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   266
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   267
        box := DialogBox new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   268
        (box addTextLabel:'are you certain ?') adjust:#left.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   269
        b := Button new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   270
        b activeLogo:(Image fromFile:'bitmaps/cancel_down.bmp').
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   271
        b passiveLogo:(Image fromFile:'bitmaps/cancel_up.bmp').
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   272
        b focusLogo:(Image fromFile:'bitmaps/cancel_focus.bmp').
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   273
        b beImageButton.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   274
        box addAbortButton:b.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   275
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   276
        b := Button new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   277
        b activeLogo:(Image fromFile:'bitmaps/ok_down.bmp').
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   278
        b passiveLogo:(Image fromFile:'bitmaps/ok_up.bmp').
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   279
        b focusLogo:(Image fromFile:'bitmaps/ok_focus.bmp').
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   280
        b beImageButton.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   281
        box addOkButton:b.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   282
        box open
162
claus
parents: 157
diff changeset
   283
claus
parents: 157
diff changeset
   284
121
claus
parents: 120
diff changeset
   285
    two textlabels:
118
claus
parents: 112
diff changeset
   286
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   287
        DialogBox new
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   288
            addTextLabel:'hello';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   289
            addTextLabel:'world';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   290
            addAbortButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   291
            addOkButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   292
            open
118
claus
parents: 112
diff changeset
   293
121
claus
parents: 120
diff changeset
   294
    fixing the dialogs size (suppres it calculating its size from the
130
claus
parents: 128
diff changeset
   295
    preferredExtents of its components):
118
claus
parents: 112
diff changeset
   296
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   297
        DialogBox new
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   298
            label:'a simple dialog';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   299
            addTextLabel:'hello';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   300
            addAbortButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   301
            addOkButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   302
            extent:200@200;
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   303
            sizeFixed:true;
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   304
            open
118
claus
parents: 112
diff changeset
   305
121
claus
parents: 120
diff changeset
   306
    asking the box if it was closed via ok:
118
claus
parents: 112
diff changeset
   307
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   308
        (DialogBox new
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   309
            label:'a simple dialog';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   310
            addTextLabel:'hello';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   311
            addAbortButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   312
            addOkButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   313
            extent:200@200;
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   314
            sizeFixed:true;
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   315
            open
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   316
        ) accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   317
            Transcript showCr:'yes'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   318
        ] ifFalse:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   319
            Transcript showCr:'no'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   320
        ]
118
claus
parents: 112
diff changeset
   321
121
claus
parents: 120
diff changeset
   322
    textLabels are not limited to strings (although, the name which is
claus
parents: 120
diff changeset
   323
    used for ST-80 compatibility, suggests it):
118
claus
parents: 112
diff changeset
   324
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   325
        DialogBox new
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   326
            addTextLabel:(Image fromFile:'bitmaps/garfield.gif');
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   327
            addOkButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   328
            open
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   329
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   330
        DialogBox new
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   331
            addTextLabel:'hello';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   332
            addTextLabel:((Image fromFile:'bitmaps/garfield.gif')
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   333
                                magnifiedTo:200@150);
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   334
            addTextLabel:'world';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   335
            addAbortButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   336
            addOkButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   337
            open
120
claus
parents: 118
diff changeset
   338
121
claus
parents: 120
diff changeset
   339
    adding an input field (on a string model):
claus
parents: 120
diff changeset
   340
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   341
        |stringModel|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   342
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   343
        stringModel := '' asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   344
        (DialogBox new
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   345
            addTextLabel:'Please enter a string:';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   346
            addInputFieldOn:stringModel; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   347
            addAbortButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   348
            addOkButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   349
            open
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   350
        ) accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   351
            Transcript showCr:'entered: ', stringModel value
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   352
        ]
120
claus
parents: 118
diff changeset
   353
claus
parents: 118
diff changeset
   354
121
claus
parents: 120
diff changeset
   355
    multiple input fields (notice, that the dialog connects the fields
claus
parents: 120
diff changeset
   356
    in a group, so stepping is allowed via Cursor and Return keys):
claus
parents: 120
diff changeset
   357
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   358
        |firstName lastName|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   359
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   360
        firstName := '' asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   361
        lastName := '' asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   362
        (DialogBox new
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   363
            addTextLabel:'Please enter your name:';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   364
            addInputFieldOn:firstName; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   365
            addVerticalSpace;
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   366
            addInputFieldOn:lastName; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   367
            addAbortButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   368
            addOkButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   369
            open
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   370
        ) accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   371
            Transcript showCr:'entered: ', firstName value , ' ' , lastName value
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   372
        ]
121
claus
parents: 120
diff changeset
   373
claus
parents: 120
diff changeset
   374
claus
parents: 120
diff changeset
   375
    of course, the model may contain a value initially:
claus
parents: 120
diff changeset
   376
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   377
        |firstName lastName p line i name|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   378
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   379
        firstName := '' asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   380
        lastName := '' asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   381
        p := PipeStream readingFrom:'finger ' , OperatingSystem getLoginName.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   382
        p notNil ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   383
            line := p nextLine.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   384
            (i := line findString:'Name:') ~~ 0 ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   385
                name := line copyFrom:(i + 'Name:' size).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   386
            ] ifFalse:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   387
                (i := line findString:'real life:') == 0 ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   388
                    line := p nextLine.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   389
                ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   390
                (i := line findString:'real life:') ~~ 0 ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   391
                    name := line copyFrom:(i + 'real life:' size).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   392
                ]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   393
            ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   394
            name notNil ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   395
                firstName value: name asCollectionOfWords first.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   396
                lastName  value: name asCollectionOfWords last.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   397
                Transcript showCr:'initially ' , firstName value , ' ' , lastName value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   398
            ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   399
            p close.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   400
        ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   401
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   402
        (DialogBox new
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   403
            addTextLabel:'Please enter your name:';
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   404
            addInputFieldOn:firstName; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   405
            addVerticalSpace;
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   406
            addInputFieldOn:lastName; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   407
            addAbortButton; 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   408
            addOkButton;
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   409
            open
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   410
        ) accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   411
            Transcript showCr:'entered: ', firstName value , ' ' , lastName value
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   412
        ]
121
claus
parents: 120
diff changeset
   413
120
claus
parents: 118
diff changeset
   414
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   415
    validated password entry:
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   416
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   417
        |box firstEntry secondEntry|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   418
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   419
        firstEntry := '' asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   420
        secondEntry := '' asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   421
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   422
        box := DialogBox new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   423
        (box addTextLabel:'Please enter your secret:') adjust:#left.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   424
        (box addInputFieldOn:firstEntry) passwordCharacter:$*. 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   425
        box addVerticalSpace.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   426
        (box addInputFieldOn:secondEntry) passwordCharacter:$*. 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   427
        box addAbortButton. 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   428
        box addOkButton. 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   429
        box open.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   430
        box accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   431
            firstEntry value ~= secondEntry value ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   432
                Transcript showCr:'wrong input - try again'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   433
            ] ifFalse:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   434
                Transcript showCr:'entered: ', firstEntry value
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   435
            ]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   436
        ]
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   437
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   438
121
claus
parents: 120
diff changeset
   439
   constructing a dialog from other elements:
claus
parents: 120
diff changeset
   440
claus
parents: 120
diff changeset
   441
     adding a fileSelectionList:
claus
parents: 120
diff changeset
   442
     (since the dialog adds the component with its preferred extent,
claus
parents: 120
diff changeset
   443
      ignoring the 300-height, this looks ugly ... 
claus
parents: 120
diff changeset
   444
      ... especially when resized vertically)
claus
parents: 120
diff changeset
   445
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   446
        |top l scr fileName|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   447
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   448
        fileName := '' asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   449
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   450
        top := DialogBox new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   451
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   452
        l := FileSelectionList new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   453
        l useIndex:false.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   454
        l doubleClickAction:[:name | top okPressed].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   455
        l action:[:name | fileName value:name].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   456
        scr := ScrollableView forView:l.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   457
        scr extent:(1.0 @ 300).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   458
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   459
        top addComponent:scr.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   460
        top addAbortButton; addOkButton.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   461
        top openModal.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   462
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   463
        top accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   464
            Transcript show:'fileName: '; showCr:fileName value storeString.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   465
        ]
121
claus
parents: 120
diff changeset
   466
claus
parents: 120
diff changeset
   467
    same, looks better, since the height is made larger (not using 
claus
parents: 120
diff changeset
   468
    fileLists preferredExtent):
claus
parents: 120
diff changeset
   469
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   470
        |top l scr fileName|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   471
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   472
        fileName := '' asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   473
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   474
        top := DialogBox new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   475
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   476
        l := FileSelectionList new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   477
        l useIndex:false.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   478
        l doubleClickAction:[:name | top okPressed].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   479
        l action:[:name | fileName value:name].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   480
        scr := ScrollableView forView:l.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   481
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   482
        top addComponent:scr withExtent:300@300.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   483
        top addAbortButton; addOkButton.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   484
        top openModal.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   485
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   486
        top accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   487
            Transcript show:'fileName: '; showCr:fileName value storeString.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   488
        ]
121
claus
parents: 120
diff changeset
   489
claus
parents: 120
diff changeset
   490
claus
parents: 120
diff changeset
   491
    again, setting the boxes initial size and fixing it
130
claus
parents: 128
diff changeset
   492
    (let it ignore the components' preferredExtent):
121
claus
parents: 120
diff changeset
   493
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   494
        |top fixFrame l scr fileName|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   495
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   496
        fileName := '' asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   497
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   498
        top := DialogBox new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   499
        top extent:300@300.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   500
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   501
        fixFrame := View new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   502
        fixFrame extent:(1.0 @ 300).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   503
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   504
        l := FileSelectionList new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   505
        l useIndex:false.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   506
        l doubleClickAction:[:name | top okPressed].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   507
        l action:[:name | fileName value:name].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   508
        scr := ScrollableView forView:l.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   509
        scr origin:0.0@0.0 corner:1.0@1.0.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   510
        fixFrame add:scr.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   511
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   512
        top addComponent:fixFrame.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   513
        top addAbortButton; addOkButton.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   514
        top openModal.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   515
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   516
        top accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   517
            Transcript show:'fileName: '; showCr:fileName value storeString.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   518
        ]
118
claus
parents: 112
diff changeset
   519
claus
parents: 112
diff changeset
   520
claus
parents: 112
diff changeset
   521
   adding a panel with checkBoxes:
claus
parents: 112
diff changeset
   522
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   523
        |top panel b value1 value2 value3 value4|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   524
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   525
        value1 := true asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   526
        value2 := false asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   527
        value3 := false asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   528
        value4 := true asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   529
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   530
        top := DialogBox new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   531
        top extent:200@300.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   532
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   533
        panel := VerticalPanelView new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   534
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   535
        b := CheckBox on:value1. b label:'check1'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   536
        panel addSubView:b.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   537
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   538
        b := CheckBox on:value2. b label:'check2'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   539
        panel addSubView:b.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   540
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   541
        b := CheckBox on:value3. b label:'check3'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   542
        panel addSubView:b.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   543
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   544
        b := CheckBox on:value4. b label:'check4'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   545
        panel addSubView:b.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   546
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   547
        top addComponent:panel.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   548
        top addAbortButton; addOkButton.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   549
        top open.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   550
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   551
        top accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   552
            Transcript show:'value1: '; showCr:value1 value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   553
            Transcript show:'value2: '; showCr:value2 value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   554
            Transcript show:'value3: '; showCr:value3 value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   555
            Transcript show:'value4: '; showCr:value4 value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   556
        ]
118
claus
parents: 112
diff changeset
   557
120
claus
parents: 118
diff changeset
   558
   same, using a more convenient interface:
claus
parents: 118
diff changeset
   559
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   560
        |box value1 value2 value3 value4|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   561
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   562
        value1 := true asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   563
        value2 := false asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   564
        value3 := false asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   565
        value4 := true asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   566
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   567
        box := DialogBox new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   568
        box extent:200@300.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   569
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   570
        box addCheckBox:'check1' on:value1.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   571
        box addVerticalSpace.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   572
        box addCheckBox:'check2' on:value2.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   573
        box addVerticalSpace.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   574
        box addCheckBox:'check3' on:value3.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   575
        box addVerticalSpace.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   576
        box addCheckBox:'check4' on:value4.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   577
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   578
        box addAbortButton; addOkButton.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   579
        box open.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   580
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   581
        box accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   582
            Transcript show:'value1: '; showCr:value1 value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   583
            Transcript show:'value2: '; showCr:value2 value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   584
            Transcript show:'value3: '; showCr:value3 value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   585
            Transcript show:'value4: '; showCr:value4 value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   586
        ]
126
claus
parents: 125
diff changeset
   587
claus
parents: 125
diff changeset
   588
164
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   589
    adding two panels in a frame:
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   590
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   591
        |box frame vPanel1 vPanel2 m1 m2 m3 m4 chk ef|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   592
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   593
        box := Dialog new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   594
        box label:'example'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   595
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   596
        frame := FramedBox label:'frame'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   597
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   598
        vPanel1 := VerticalPanelView origin:0.0@0.0 corner:0.5@1.0 in:frame.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   599
        vPanel1 horizontalLayout:#leftSpace.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   600
        vPanel1 verticalLayout:#top.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   601
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   602
        vPanel2 := VerticalPanelView origin:0.5@0.0 corner:1.0@1.0 in:frame.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   603
        vPanel2 horizontalLayout:#leftSpace.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   604
        vPanel2 verticalLayout:#top.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   605
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   606
        m1 := true asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   607
        m2 := true asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   608
        m3 := true asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   609
        m4 := 'hello' asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   610
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   611
        vPanel1 add:(Label label:'check1').
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   612
        vPanel1 add:(Label label:'m2').
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   613
        vPanel1 add:(Label label:'m3').
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   614
        vPanel1 add:(Label label:'enter').
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   615
        vPanel1 add:(Label label:'lbl1').
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   616
        vPanel1 add:(Label label:'lbl2').
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   617
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   618
        vPanel2 add:(chk := CheckToggle on:m1). 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   619
        box makeTabable:chk.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   620
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   621
        vPanel2 add:(chk := CheckToggle on:m2). 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   622
        box makeTabable:chk.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   623
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   624
        vPanel2 add:(chk := CheckToggle on:m3). 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   625
        box makeTabable:chk.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   626
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   627
        vPanel2 add:(chk := CheckToggle on:m3). 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   628
        box makeTabable:chk.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   629
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   630
        vPanel2 add:(chk := CheckToggle on:m3). 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   631
        box makeTabable:chk.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   632
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   633
        vPanel2 add:(ef := EditField on:m4). 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   634
        ef immediateAccept:true.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   635
        box makeTabable:ef.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   636
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   637
        box addComponent:frame.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   638
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   639
        box addAbortButton; addOkButton.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   640
        box openModal.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   641
        box accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   642
            Transcript showCr:'accepted with:'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   643
            Transcript showCr:'   m1: ' , m1 value printString.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   644
            Transcript showCr:'   m2: ' , m2 value printString.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   645
            Transcript showCr:'   m3: ' , m3 value printString.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   646
            Transcript showCr:'   m4: ' , m4 value printString.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   647
        ]
164
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   648
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   649
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   650
126
claus
parents: 125
diff changeset
   651
    a full example:
claus
parents: 125
diff changeset
   652
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   653
        |box warnSTX allowUnderscore immutableArrays logDoits
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   654
         listOfLanguages listOfStyles styleNames 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   655
         frame panel c resourceDir dir |
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   656
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   657
        warnSTX := Compiler warnSTXSpecials asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   658
        allowUnderscore := Compiler allowUnderscoreInIdentifier asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   659
        immutableArrays := Compiler arraysAreImmutable asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   660
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   661
        logDoits := Smalltalk logDoits asValue.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   662
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   663
        listOfLanguages := SelectionInList with:#('english'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   664
                                                  'french'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   665
                                                  'german'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   666
                                                  'italian'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   667
                                                  'spanish'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   668
                                                 ).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   669
        listOfLanguages selection:(Language asString).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   670
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   671
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   672
        resourceDir := Smalltalk getSystemFileName:'resources'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   673
        dir := FileDirectory directoryNamed:resourceDir.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   674
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   675
        styleNames := dir select:[:aFileName | aFileName endsWith:'.style'].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   676
        styleNames := styleNames collect:[:aFileName | aFileName copyWithoutLast:6].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   677
        listOfStyles := SelectionInList with:styleNames sort.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   678
        listOfStyles selection:(View defaultStyle asString).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   679
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   680
        box := Dialog new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   681
        box label:'Settings'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   682
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   683
        frame := FramedBox label:'Compiler'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   684
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   685
        panel horizontalLayout:#leftSpace.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   686
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   687
        panel add:((CheckBox on:warnSTX) label:'warn about ST/X language extensions'; resize).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   688
        panel add:((CheckBox on:allowUnderscore) label:'allow underscore in identifiers'; resize).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   689
        panel add:((CheckBox on:immutableArrays) label:'literal arrays are immutable'; resize).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   690
        box addComponent:frame.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   691
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   692
        frame := FramedBox label:'Misc'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   693
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   694
        panel horizontalLayout:#leftSpace.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   695
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   696
        panel add:((CheckBox on:logDoits) label:'log doIts in changes file'; resize).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   697
        box addComponent:frame.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   698
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   699
        frame := FramedBox label:'Language'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   700
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   701
        panel horizontalLayout:#leftSpace.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   702
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   703
        panel add:((PopUpList on:listOfLanguages) width:0.5).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   704
        box addComponent:frame.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   705
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   706
        frame := FramedBox label:'Style'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   707
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   708
        panel horizontalLayout:#leftSpace.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   709
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   710
        panel add:((PopUpList on:listOfStyles) width:0.5).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   711
        box addComponent:frame.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   712
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   713
        box addAbortButton; addOkButton.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   714
        box showAtPointer.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   715
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   716
        box accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   717
            Transcript topView withCursor:Cursor wait do:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   718
                Compiler warnSTXSpecials:warnSTX value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   719
                Compiler allowUnderscoreInIdentifier:allowUnderscore value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   720
                Compiler arraysAreImmutable:immutableArrays value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   721
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   722
                Smalltalk logDoits:logDoits value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   723
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   724
                Transcript showCr:'change language to ' , listOfLanguages selection , ' ...'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   725
                Smalltalk at:#Language put:listOfLanguages selection asSymbol.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   726
                Smalltalk changed:#Language.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   727
                ResourcePack flushCachedResourcePacks.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   728
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   729
                Transcript showCr:'change style to ' , listOfStyles selection , ' ...'.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   730
                View defaultStyle:listOfStyles selection asSymbol.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   731
            ]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   732
        ]
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   733
"
81e3409404d2 Initial revision
claus
parents:
diff changeset
   734
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
   735
128
claus
parents: 126
diff changeset
   736
!DialogBox class methodsFor:'common dialogs'!
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   737
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   738
information:aString
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   739
    "launch a Dialog to tell user something"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   740
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   741
    (InfoBox title:aString) showAtPointer
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   742
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   743
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   744
     Dialog information:'help'
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   745
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   746
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   747
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   748
warn:aString
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   749
    "launch a Dialog to warn user"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   750
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   751
    (WarningBox title:aString) showAtPointer
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   752
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   753
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   754
     Dialog warn:'help'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   755
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   756
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   757
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   758
!DialogBox class methodsFor:'confirmation dialogs'!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   759
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   760
confirm:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   761
    "launch a Dialog, which allows user to enter yes or no.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   762
     return true for yes, false for no"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   763
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   764
    |box answer|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   765
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   766
    box := YesNoBox title:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   767
    box yesAction:[answer := true] noAction:[answer := false].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   768
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   769
    box yesAction:nil noAction:nil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   770
    ^ answer
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   771
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   772
    " 
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   773
     Dialog confirm:'really ?' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   774
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   775
     Transcript showCr:(
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   776
        Dialog confirm:'are you certain ?'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   777
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   778
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   779
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   780
    "Modified: 27.1.1996 / 14:19:39 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   781
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   782
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   783
confirm:aString initialAnswer:what
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   784
    "launch a Dialog, which allows user to enter yes or no.
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   785
     return true for yes, false for no.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   786
     InitialAnswer must be true or false and defines which button is to be
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   787
     the default (i.e. return-) button"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   788
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   789
    |box answer|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   790
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   791
    box := YesNoBox title:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   792
    box yesAction:[answer := true] noAction:[answer := false].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   793
    what == false ifTrue:[
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   794
        box okButton isReturnButton:false.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   795
        box acceptReturnAsOK:false.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   796
        box noButton beReturnButton.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   797
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   798
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   799
    box yesAction:nil noAction:nil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   800
    ^ answer
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   801
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   802
    " 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   803
     Dialog confirm:'really ?' initialAnswer:false
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   804
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   805
     Transcript showCr:(
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   806
        Dialog confirm:'are you certain ?' initialAnswer:false
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   807
     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   808
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   809
     Transcript showCr:(
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   810
        Dialog confirm:'are you certain ?' initialAnswer:true 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   811
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   812
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   813
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   814
    "Modified: 27.1.1996 / 14:24:39 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   815
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   816
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   817
confirm:aString yesLabel:yesText noLabel:noText
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   818
    "launch a Dialog, which allows user to enter yes or no.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   819
     return true for yes, false for no.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   820
     The yes/no buttons labels are defined by yesText/noText."
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   821
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   822
    |box answer|
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   823
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   824
    box := YesNoBox title:aString.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   825
    box yesLabel:yesText; noLabel:noText.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   826
    box yesAction:[answer := true] noAction:[answer := false].
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   827
    box showAtPointer.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   828
    box yesAction:nil noAction:nil.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   829
    ^ answer
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   830
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   831
    " 
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   832
     Dialog confirm:'really ?' yesLabel:'oh well' noLabel:'nope'
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   833
    "
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   834
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   835
    "Modified: 13.12.1995 / 16:22:29 / cg"
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   836
!
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   837
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   838
confirmWithCancel:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   839
    "launch a Dialog, which allows user to enter yes, no and cancel.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   840
     return true for 'yes', false for 'no', nil for 'cancel'"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   841
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   842
    |box answer|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   843
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   844
    box := OptionBox title:aString numberOfOptions:3. 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   845
    box buttonTitles:(self classResources array:
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   846
                        #('cancel' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   847
                          'no' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   848
                          'yes')
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   849
                     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   850
             actions:(Array with:[answer := nil]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   851
                            with:[answer := false] 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   852
                            with:[answer := true]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   853
                     ).
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   854
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   855
    box actions:nil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   856
    ^ answer
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   857
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   858
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   859
     Dialog confirmWithCancel:'really ?' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   860
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   861
     Transcript showCr:(
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   862
        Dialog confirmWithCancel:'really ?'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   863
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   864
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   865
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   866
    "Modified: 27.1.1996 / 14:25:49 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   867
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   868
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   869
!DialogBox class methodsFor:'file name dialogs'!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   870
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   871
requestFileName:titleString
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   872
    "launch a Dialog, which allows user to enter a filename.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   873
     The box will not allow pressing 'ok' without an entered string.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   874
     Return the pathname string consisting of the full pathname of the filename,
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   875
     or an empty string (if cancel was pressed)."
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   876
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   877
    ^ self requestFileName:titleString 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   878
                   default:'file.ext' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   879
                   version:nil 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   880
                    ifFail:''
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   881
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   882
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   883
     Dialog requestFileName:'enter a fileName:' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   884
     Dialog requestFileName:'enter a fileName:' 
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   885
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   886
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   887
    "Created: 27.1.1996 / 13:24:35 / cg"
118
claus
parents: 112
diff changeset
   888
!
claus
parents: 112
diff changeset
   889
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   890
requestFileName:titleString default:defaultName
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   891
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   892
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   893
     Return the pathname string consisting of the full pathname of the filename,
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   894
     or an empty string (if cancel was pressed)."
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   895
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   896
    ^ self requestFileName:titleString 
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   897
		   default:defaultName 
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   898
		   version:nil 
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   899
		    ifFail:''
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   900
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   901
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   902
     Dialog requestFileName:'enter a fileName:' default:''  
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   903
     Dialog requestFileName:'enter a fileName:' default:'Makefile.bak'  
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   904
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   905
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   906
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   907
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   908
    "launch a Dialog, which allows user to enter a filename.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   909
     The box will show okText in its okButton, abortText in the abortButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   910
     The matchPattern is set to pattern initially.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   911
     Return the string or nil if cancel was pressed."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   912
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   913
    |box|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   914
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   915
    box := FileSelectionBox 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   916
	       title:titleString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   917
	       okText:okText 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   918
	       abortText:abortText
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   919
	       action:[:fileName | ^ fileName].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   920
    box pattern:pattern.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   921
    box initialText:defaultName.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   922
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   923
    box action:nil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   924
    ^ nil
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   925
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   926
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   927
     Dialog requestFileName:'enter a fileName:'
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   928
			default:''
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   929
			     ok:'yeah' 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   930
			  abort:'oh, no' 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   931
			pattern:'*.st'   
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   932
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   933
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   934
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   935
requestFileName:titleString default:defaultName version:versionSymbol
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   936
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   937
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   938
     Return the pathname string or the empty string if cancel was pressed.
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   939
     The version argument allows validation of the files existance;
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   940
     it may be any of:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   941
        #mustBeNew      - fail (return empty string) if the file exists
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   942
        #new            - confirm if the file exists
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   943
        #mustBeOld      - fail if the file does not exist
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   944
        #old            - confirm if the file does not exist
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   945
        #any (other)    - no validation
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   946
    "
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   947
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   948
    ^ self requestFileName:titleString 
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   949
                   default:defaultName 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   950
                   version:versionSymbol 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   951
                    ifFail:''
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   952
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   953
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   954
     Dialog requestFileName:'enter a fileName:'
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   955
                        default:''
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   956
                        version:nil   
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   957
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   958
     Dialog requestFileName:'enter a fileName:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   959
                        default:''
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   960
                        version:#mustBeNew 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   961
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   962
     Dialog requestFileName:'enter a fileName:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   963
                        default:''
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   964
                        version:#new   
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   965
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   966
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   967
    "Modified: 27.1.1996 / 13:42:16 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   968
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   969
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   970
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   971
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   972
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   973
     Return the string or the value of failBlock if cancel was pressed.
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   974
     The version argument allows validation of the files existance;
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   975
     it may be any of:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   976
        #mustBeNew      - fail (return empty string) if the file exists
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   977
        #new            - confirm if the file exists
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   978
        #mustBeOld      - fail if the file does not exist
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   979
        #old            - confirm if the file does not exist
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   980
        #any (other)    - no validation
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   981
    "
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   982
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   983
    |box|
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   984
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   985
    box := FileSelectionBox title:titleString.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   986
    box initialText:defaultName.
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   987
    box action:[:name | 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   988
        versionSymbol == #mustBeNew ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   989
            "/ file may not exist
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   990
            name asFilename exists ifTrue:[^ ''].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   991
        ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   992
        versionSymbol == #new ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   993
            "/ file may not exist
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   994
            name asFilename exists ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   995
                (self confirm:(ClassResources string:'''%1'' exists.\\Continue anyway ?' with:box fileName) withCRs)
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   996
                ifFalse:[^ ''].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   997
            ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   998
        ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   999
        versionSymbol == #mustBeOld ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1000
            name asFilename exists ifFalse:[^ ''].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1001
        ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1002
        versionSymbol == #old ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1003
            "/ file may not exist
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1004
            name asFilename exists ifFalse:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1005
                (self confirm:(ClassResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:box fileName) withCRs)
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1006
                ifFalse:[^ ''].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1007
            ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1008
        ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1009
        
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1010
        ^ name
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1011
    ].
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1012
    box showAtPointer.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1013
    box action:nil.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1014
    ^ failBlock value
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1015
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1016
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1017
     Dialog requestFileName:'enter a fileName:'
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1018
                        default:''
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1019
                        version:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1020
                         ifFail:['none']   
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1021
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1022
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1023
     Dialog requestFileName:'enter a fileName:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1024
                        default:''
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1025
                        version:#old 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1026
                         ifFail:['none']   
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1027
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1028
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1029
    "Modified: 27.1.1996 / 13:35:37 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1030
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1031
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1032
requestNewFileName:titleString default:defaultName
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1033
    "launch a Dialog, which allows user to enter a filename.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1034
     We expect a new files (i.e. nonexisting) name to be enterred,
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1035
     and confirm if it already exists.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1036
     The box will not allow pressing 'ok' without an entered string.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1037
     Return the pathname string consisting of the full pathname of the filename,
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1038
     or an empty string (if cancel was pressed)."
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1039
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1040
    ^ self requestFileName:titleString 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1041
                   default:defaultName 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1042
                   version:#new 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1043
                    ifFail:''
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1044
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1045
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1046
     Dialog requestNewFileName:'enter a fileName:' default:''  
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1047
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1048
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1049
    "Modified: 27.1.1996 / 13:44:13 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1050
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1051
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1052
!DialogBox class methodsFor:'fill in the blank dialogs'!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1053
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1054
request:aString 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1055
    "launch a Dialog, which allows user to enter something.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1056
     Return the entered string (may be empty string) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1057
     or the empty string (if cancel was pressed)"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1058
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1059
    ^ self 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1060
        request:aString 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1061
        displayAt:nil 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1062
        centered:false 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1063
        action:nil 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1064
        initialAnswer:''
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1065
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1066
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1067
     Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1068
         request:'enter a string:' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1069
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1070
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1071
    "Modified: 27.1.1996 / 14:44:30 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1072
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1073
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1074
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1075
    "launch a Dialog, which allows user to enter a string.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1076
     If aPoint is nonNil, the box is shown there, optionally centered.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1077
     If it is nil, it is shown at the current pointer position or at the screen center.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1078
     Return the string or an empty string (if cancel was pressed)"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1079
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1080
    ^ self
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1081
        request:aString 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1082
        displayAt:aPoint 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1083
        centered:centered 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1084
        action:resultAction 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1085
        initialAnswer:initial
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1086
        onCancel:''
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1087
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1088
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1089
     centered around 200@200:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1090
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1091
         Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1092
            request:'enter a string:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1093
            displayAt:200@200
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1094
            centered:true
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1095
            action:[:result | result printNewline]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1096
            initialAnswer:'the default'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1097
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1098
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1099
     origin at 200@200:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1100
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1101
         Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1102
            request:'enter a string:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1103
            displayAt:200@200
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1104
            centered:false 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1105
            action:[:result | result printNewline]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1106
            initialAnswer:'the default'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1107
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1108
     under mouse pointer:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1109
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1110
         Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1111
            request:'enter a string:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1112
            displayAt:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1113
            centered:false 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1114
            action:[:result | result printNewline]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1115
            initialAnswer:'the default'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1116
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1117
     centered on the screen:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1118
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1119
         Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1120
            request:'enter a string:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1121
            displayAt:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1122
            centered:true 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1123
            action:[:result | result printNewline]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1124
            initialAnswer:'the default'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1125
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1126
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1127
    "Created: 7.12.1995 / 23:14:10 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1128
    "Modified: 27.1.1996 / 14:44:08 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1129
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1130
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1131
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial onCancel:cancelValue
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1132
    "launch a Dialog, which allows user to enter a string.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1133
     If aPoint is nonNil, the box is shown there, optionally centered.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1134
     If it is nil, it is shown at the current pointer position or at the screen center.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1135
     Return the string or the value of cancelValue (if cancel was pressed)"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1136
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1137
    |box|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1138
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1139
    box := EnterBox title:aString.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1140
    box initialText:initial.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1141
    box abortAction:[:val | ^ cancelValue value].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1142
    resultAction isNil ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1143
        box action:[:val | ^ val]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1144
    ] ifFalse:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1145
        box action:[:val | ^ resultAction value:val]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1146
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1147
    aPoint notNil ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1148
        box showAt:aPoint center:centered
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1149
    ] ifFalse:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1150
        centered ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1151
            box showAtCenter
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1152
        ] ifFalse:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1153
            box showAtPointer
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1154
        ]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1155
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1156
    ^ cancelValue value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1157
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1158
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1159
     at topLeft (centering is suppressed, to make the box fully visible)    
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1160
         Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1161
            request:'enter a string:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1162
            displayAt:0@0
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1163
            centered:true
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1164
            action:[:result | result printNewline]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1165
            initialAnswer:'the default'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1166
            onCancel:#foo
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1167
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1168
     centered around 200@200:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1169
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1170
         Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1171
            request:'enter a string:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1172
            displayAt:200@200
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1173
            centered:true
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1174
            action:[:result | result printNewline]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1175
            initialAnswer:'the default'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1176
            onCancel:#foo
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1177
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1178
     topLeft of box at 200@200:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1179
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1180
         Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1181
            request:'enter a string:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1182
            displayAt:200@200
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1183
            centered:false 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1184
            action:[:result | result printNewline]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1185
            initialAnswer:'the default'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1186
            onCancel:#foo
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1187
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1188
     under mouse pointer:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1189
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1190
         Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1191
            request:'enter a string:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1192
            displayAt:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1193
            centered:false 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1194
            action:[:result | result printNewline]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1195
            initialAnswer:'the default'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1196
            onCancel:#foo
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1197
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1198
     centered on the screen:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1199
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1200
         Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1201
            request:'enter a string:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1202
            displayAt:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1203
            centered:true 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1204
            action:[:result | result printNewline]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1205
            initialAnswer:'the default'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1206
            onCancel:#foo
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1207
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1208
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1209
    "Created: 7.12.1995 / 23:14:10 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1210
    "Modified: 27.1.1996 / 14:41:40 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1211
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1212
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1213
request:aString displayAt:aPoint initialAnswer:initial
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1214
    "launch a Dialog, which allows user to enter something.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1215
     The boxes topLeft is placed at aPoint, or under the mouse pointer (if aPoint is nil).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1216
     Return the entered string (may be empty string) or nil (if cancel was pressed)"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1217
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1218
    ^ self 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1219
        request:aString 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1220
        displayAt:aPoint 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1221
        centered:false 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1222
        action:nil 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1223
        initialAnswer:initial
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1224
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1225
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1226
     Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1227
         request:'enter a string:' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1228
         displayAt:(250 @ 250) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1229
         initialAnswer:'the default' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1230
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1231
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1232
    "Modified: 27.1.1996 / 14:45:47 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1233
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1234
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1235
request:aString initialAnswer:initial
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1236
    "launch a Dialog, which allows user to enter something.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1237
     Return the entered string (may be empty string) or nil (if cancel was pressed)"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1238
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1239
    ^ self 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1240
        request:aString 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1241
        displayAt:nil 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1242
        centered:false 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1243
        action:nil 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1244
        initialAnswer:initial
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1245
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1246
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1247
     Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1248
         request:'enter a string:' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1249
         initialAnswer:'the default'  
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1250
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1251
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1252
    "Modified: 27.1.1996 / 14:44:22 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1253
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1254
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1255
request:aString initialAnswer:initial onCancel:cancelAction
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1256
    "launch a Dialog, which allows user to enter something.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1257
     Return the entered string (may be empty string) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1258
     or cancelValue (if cancel was pressed)"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1259
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1260
    self 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1261
        request:aString 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1262
        displayAt:nil 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1263
        centered:false 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1264
        action:[:result | ^ result] 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1265
        initialAnswer:initial.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1266
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1267
    ^ cancelAction value
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1268
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1269
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1270
     Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1271
         request:'enter a string:' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1272
         initialAnswer:'the default'  
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1273
         onCancel:['foooo']   
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1274
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1275
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1276
    "Modified: 27.1.1996 / 14:46:00 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1277
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1278
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1279
request:aString onCancel:cancelAction
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1280
    "launch a Dialog, which allows user to enter something.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1281
     Return the entered string (may be empty string) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1282
     or the value of cancelAction (if cancel was pressed)."
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1283
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1284
    self 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1285
        request:aString 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1286
        displayAt:nil 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1287
        centered:false 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1288
        action:[:result | ^ result] 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1289
        initialAnswer:''.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1290
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1291
    ^ cancelAction value
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1292
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1293
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1294
     Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1295
         request:'enter a string:'
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1296
         onCancel:nil       
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1297
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1298
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1299
    "Created: 27.1.1996 / 14:31:45 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1300
    "Modified: 27.1.1996 / 14:46:10 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1301
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1302
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1303
requestPassword:aString 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1304
    "launch a Dialog, which allows user to enter something invisibly.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1305
     Return the entered string (may be empty string) 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1306
     or nil (if cancel was pressed)"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1307
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1308
    ^ EnterBox requestPassword:aString 
133
claus
parents: 132
diff changeset
  1309
claus
parents: 132
diff changeset
  1310
    "
claus
parents: 132
diff changeset
  1311
     Dialog 
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1312
	 requestPassword:'enter secret:'
133
claus
parents: 132
diff changeset
  1313
    "
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1314
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1315
    "Created: 17.11.1995 / 09:45:21 / cg"
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1316
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1317
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1318
!DialogBox class methodsFor:'multiple choice dialogs'!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1319
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1320
choose:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1321
    "launch a Dialog showing the message and list.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1322
     The user can select an item and click ok; in this case, the corresponding value
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1323
     from listValues is returned (doubleclick works as well). 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1324
     The list may be suppressed (if the list arg is nil).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1325
     Below the list, an optional row of buttons is shown, which can also be
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1326
     clicked upon, and a corresponding value from buttonValues is returned.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1327
     If cancel is pressed, the value of cancelBlock is returned.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1328
     Pressing ok without a selection is treated like cancel."
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1329
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1330
    |box listView panel answer idx|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1331
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1332
    box := Dialog new.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1333
    (box addTextLabel:aString) adjust:#left.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1334
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1335
    list notNil ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1336
        listView := ScrollableView for:SelectionInListView.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1337
        listView list:list.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1338
        listView doubleClickAction:[:line | box hide. ^ listValues at:line].
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1339
        box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines).
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1340
        box makeTabable:listView.
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1341
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1342
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1343
    buttonLabels notNil ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1344
        panel := HorizontalPanelView new.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1345
        panel horizontalLayout:#fitSpace.
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1346
        buttonLabels keysAndValuesDo:[:index :label |
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1347
            |b|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1348
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1349
            b := Button label:label.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1350
            b action:[box hide. ^ buttonValues at:index].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1351
            panel add:b.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1352
            box makeTabable:b.
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1353
        ].
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1354
        box addComponent:panel indent:0.  "/ panel has its own idea of indenting
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1355
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1356
    box addAbortButton.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1357
    list notNil ifTrue:[box addOkButton].
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1358
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1359
    listView notNil ifTrue:[box stickAtBottomWithVariableHeight:listView].
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1360
    panel notNil ifTrue:[box stickAtBottomWithFixHeight:panel].
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1361
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1362
    box showAtPointer.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1363
    box accepted ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1364
        (answer := listView selection) notNil ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1365
            ^ listValues at:answer
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1366
        ]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1367
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1368
    ^ cancelBlock value
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1369
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1370
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1371
     full example:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1372
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1373
         Transcript showCr:(
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1374
             Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1375
                choose:'choose any' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1376
                fromList:#('one' 'two' 'three' 'four') 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1377
                values:#(1 2 3 4) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1378
                buttons:#('five' 'six' 'seven')
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1379
                values:#(5 6 7)
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1380
                lines:10 
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1381
                cancel:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1382
         )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1383
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1384
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1385
     no buttons:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1386
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1387
         Transcript showCr:(
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1388
             Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1389
                choose:'choose any' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1390
                fromList:#('one' 'two' 'three' 'four') 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1391
                values:#(1 2 3 4) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1392
                buttons:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1393
                values:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1394
                lines:4
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1395
                cancel:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1396
         )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1397
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1398
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1399
     no list:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1400
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1401
         Transcript showCr:(
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1402
             Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1403
                choose:'choose any' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1404
                fromList:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1405
                values:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1406
                buttons:#('one' 'two' 'three' 'four') 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1407
                values:#(1 2 3 4) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1408
                lines:4
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1409
                cancel:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1410
         )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1411
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1412
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1413
      full including cancel value:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1414
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1415
         Transcript showCr:(
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1416
             Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1417
                choose:'choose example' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1418
                fromList:#('one' 'two' 'three' 'four') 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1419
                values:#(1 2 3 4) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1420
                buttons:#('five' 'six' 'seven')
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1421
                values:#(5 6 7)
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1422
                lines:4
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1423
                cancel:[Transcript flash. #aborted]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1424
         )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1425
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1426
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1427
     degenerated:
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1428
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1429
         Transcript showCr:(
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1430
             Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1431
                choose:'choose any' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1432
                fromList:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1433
                values:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1434
                buttons:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1435
                values:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1436
                lines:nil 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1437
                cancel:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1438
         )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1439
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1440
133
claus
parents: 132
diff changeset
  1441
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1442
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1443
    "Modified: 27.1.1996 / 17:20:16 / cg"
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1444
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1445
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1446
choose:aString fromList:list values:listValues lines:maxLines cancel:cancelBlock
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1447
    "launch a Dialog showing the message and list.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1448
     The user can select an item and click ok; in this case, the corresponding value
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1449
     from listValues is returned (doubleclick works as well).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1450
     If cancel is pressed, the value of cancelBlock is returned.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1451
     Pressing ok without a selection is treated like cancel."
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1452
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1453
    ^ self
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1454
        choose:aString 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1455
        fromList:list 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1456
        values:listValues
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1457
        buttons:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1458
        values:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1459
        lines:maxLines
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1460
        cancel:cancelBlock
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1461
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1462
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1463
     Transcript showCr:(
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1464
         Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1465
            choose:'choose any' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1466
            fromList:#('one' 'two' 'three' 'four') 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1467
            values:#(1 2 3 4) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1468
            lines:4
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1469
            cancel:nil
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1470
     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1471
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1472
     Transcript showCr:(
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1473
         Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1474
            choose:'choose example' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1475
            fromList:#('one' 'two' 'three' 'four') 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1476
            values:#(1 2 3 4) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1477
            lines:4
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1478
            cancel:[Transcript flash. #aborted]
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1479
     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1480
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1481
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1482
    "Modified: 27.1.1996 / 14:17:07 / cg"
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1483
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1484
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1485
choose:aString labels:buttonLabels values:values default:default
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1486
    "launch a Dialog, which allows user to enter any of buttonLabels.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1487
     Returning a corresponding value from the values-array.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1488
     The default entries button is marked as a return button and entering
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1489
     return will choose that value.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1490
     For a good userInterface style, we recommend this being the last
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1491
     entry (to make the right-most button the default button)."
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1492
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1493
    |box answer idx|
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1494
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1495
    box := OptionBox title:aString numberOfOptions:buttonLabels size. 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1496
    box buttonTitles:(self classResources array:buttonLabels)
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1497
             actions:(values collect:[:val | [answer := val]]).
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1498
    answer := default.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1499
    box buttons last isReturnButton:false.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1500
    idx := values indexOf:default.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1501
    idx ~~ 0 ifTrue:[box defaultButtonIndex:idx].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1502
    box showAtPointer.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1503
    box actions:nil.
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1504
    ^ answer
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1505
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1506
    "no good style (default button is not the rightmost one)
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1507
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1508
     Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1509
        choose:'choose any' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1510
        labels:#('one' 'two' 'three' 'four') 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1511
        values:#(1 2 3 4) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1512
        default:2 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1513
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1514
     Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1515
        choose:'choose any' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1516
        labels:#('cancel' 'foo' 'bar' 'baz') 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1517
        values:#(nil foo bar baz) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1518
        default:#baz     
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1519
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1520
      Dialog 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1521
        choose:'choose any' 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1522
        labels:#('one' 'two' 'three' 'four') 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1523
        values:#(1 2 3 4) 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1524
        default:nil 
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1525
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1526
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1527
    "Modified: 27.1.1996 / 13:48:17 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1528
! !
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1529
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1530
!DialogBox methodsFor:'accessing'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1531
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1532
abortText:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1533
    "define the label in the abort-button"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1534
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1535
    |oldSize|
121
claus
parents: 120
diff changeset
  1536
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1537
    aString ~= abortButton label ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1538
	oldSize := abortButton extent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1539
	abortButton label:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1540
	abortButton resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1541
	abortButton extent ~= oldSize ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1542
	    shown ifTrue:[self resize]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1543
	]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1544
    ]
121
claus
parents: 120
diff changeset
  1545
!
claus
parents: 120
diff changeset
  1546
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1547
okText:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1548
    "define the text in the ok-button"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1549
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1550
    |oldSize|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1551
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1552
    aString ~= okButton label ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1553
	oldSize := okButton extent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1554
	okButton label:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1555
	okButton resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1556
	okButton extent ~= oldSize ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1557
	    shown ifTrue:[self resize]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1558
	]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1559
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1560
!
125
claus
parents: 122
diff changeset
  1561
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1562
okText:okString abortText:abortString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1563
    "set both texts displayed in the buttons"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1564
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1565
    (abortString ~= abortButton label 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1566
    or:[okString ~= okButton label]) ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1567
	okButton label:okString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1568
	abortButton label:abortString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1569
	okButton resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1570
	abortButton resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1571
	shown ifTrue:[self resize]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1572
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1573
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1574
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1575
!DialogBox methodsFor:'accessing-behavior'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1576
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1577
abortAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1578
    "define the action to be performed when abort is pressed"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1579
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1580
    abortAction := aBlock
125
claus
parents: 122
diff changeset
  1581
!
claus
parents: 122
diff changeset
  1582
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1583
acceptCheck:aBlock
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1584
    "if nonNil, the acceptCheck-block is evaluated when the dialog is
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1585
     accepted (ok-button or Return-key). If it returns true, the box is closed,
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1586
     otherwise not."
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1587
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1588
    acceptCheck := aBlock
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1589
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1590
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1591
acceptOnLeave:aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1592
    "define the behavior when the last input field is left via cursor keys.
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1593
     The default is to accept & close the dialog"
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1594
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1595
    acceptOnLeave := aBoolean.
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1596
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1597
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1598
acceptReturnAsOK:aBoolean
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1599
    "turn on/off interpretation of return-key as ok.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1600
     Default is on"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1601
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1602
    acceptReturnAsOK := aBoolean.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1603
    okButton notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1604
	okButton isReturnButton:aBoolean.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1605
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1606
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1607
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1608
action:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1609
    "set the action to be performed when user presses ok-button;
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1610
     aBlock must be nil or a block. This method simply
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1611
     reuses okAction: and has been added for a consistent action-setting
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1612
     protocol."
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1613
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1614
    self okAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1615
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1616
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1617
focusOnField:anInputField
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1618
    inputFieldGroup makeActive:anInputField
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1619
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1620
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1621
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1622
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1623
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1624
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1625
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1626
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1627
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1628
hideOnAccept:aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1629
    "control if the dialog should close when accepted.
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1630
     The default is true"
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1631
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1632
    hideOnAccept := aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1633
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1634
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1635
okAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1636
    "define the action to be performed when ok is pressed"
133
claus
parents: 132
diff changeset
  1637
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1638
    okAction := aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1639
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1640
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1641
!DialogBox methodsFor:'accessing-components'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1642
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1643
abortButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1644
    "return the abortButton - this access is provided to allow
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1645
     setting the buttons look (for example: colors or font)"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1646
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1647
    ^ abortButton
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1648
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1649
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1650
okButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1651
    "return the okButton - this access is provided to allow
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1652
     setting the buttons look (for example: colors or font)"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1653
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1654
    ^ okButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1655
! !
155
claus
parents: 146
diff changeset
  1656
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1657
!DialogBox methodsFor:'accessing-elements'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1658
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1659
componentAt:name
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1660
    bindings isNil ifTrue:[^ nil].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1661
    ^ bindings at:name ifAbsent:nil
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1662
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1663
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1664
inputFieldGroup
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1665
    ^ inputFieldGroup
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1666
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1667
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1668
name:element as:name
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1669
    bindings isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1670
	bindings := IdentityDictionary new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1671
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1672
    bindings at:name put:element
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1673
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1674
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1675
!DialogBox methodsFor:'accessing-models'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1676
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1677
accept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1678
    "return the valueHolder holding true when the box
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1679
     is accepted, false if closed via the windowManager or
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1680
     the cancel button.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1681
     This is confusing: this method was originally called #acceptValue,
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1682
     but renamed for compatibility with ST-80.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1683
     This looks like a bad name to me, since in most other situations, #accept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1684
     is used to force an accept, not to return some valueHolder ...)."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1685
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1686
    ^ acceptValue
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1687
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1688
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1689
acceptChannel:aValueHolder
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1690
    "set the valueHolder which is set to true when the box
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1691
     is accepted"
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1692
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1693
    acceptValue := aValueHolder
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1694
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1695
120
claus
parents: 118
diff changeset
  1696
!DialogBox methodsFor:'construction-adding'!
claus
parents: 118
diff changeset
  1697
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1698
addAbortButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1699
    "create an abortButton - to be sent from redefined initialize
162
claus
parents: 157
diff changeset
  1700
     methods in subclasses or when creating a box programmatically.
claus
parents: 157
diff changeset
  1701
     Returns the button."
claus
parents: 157
diff changeset
  1702
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1703
    ^ self addAbortButtonLabelled:nil
122
claus
parents: 121
diff changeset
  1704
!
120
claus
parents: 118
diff changeset
  1705
162
claus
parents: 157
diff changeset
  1706
addAbortButton:aButton 
claus
parents: 157
diff changeset
  1707
    "add an already created abortButton - to be sent from redefined initialize
claus
parents: 157
diff changeset
  1708
     methods in subclasses or when creating a box programmatically.
claus
parents: 157
diff changeset
  1709
     Returns the button."
claus
parents: 157
diff changeset
  1710
claus
parents: 157
diff changeset
  1711
    abortButton := aButton.
claus
parents: 157
diff changeset
  1712
    aButton model:self; change:#abortPressed.
claus
parents: 157
diff changeset
  1713
    ^ self addButton:aButton.
claus
parents: 157
diff changeset
  1714
claus
parents: 157
diff changeset
  1715
    "Created: 17.9.1995 / 20:17:26 / claus"
claus
parents: 157
diff changeset
  1716
!
claus
parents: 157
diff changeset
  1717
122
claus
parents: 121
diff changeset
  1718
addAbortButtonLabelled:buttonLabel
claus
parents: 121
diff changeset
  1719
    "create an abortButton with a label - to be sent from redefined initialize
claus
parents: 121
diff changeset
  1720
     methods in subclasses or when creating a box programmatically.
claus
parents: 121
diff changeset
  1721
     A nil argument creates one with the default label.
claus
parents: 121
diff changeset
  1722
     Returns the button."
claus
parents: 121
diff changeset
  1723
162
claus
parents: 157
diff changeset
  1724
    |aButton|
claus
parents: 157
diff changeset
  1725
claus
parents: 157
diff changeset
  1726
    aButton := Button abortButton.
claus
parents: 157
diff changeset
  1727
    buttonLabel notNil ifTrue:[aButton label:buttonLabel].
claus
parents: 157
diff changeset
  1728
    ^ self addAbortButton:aButton
claus
parents: 157
diff changeset
  1729
claus
parents: 157
diff changeset
  1730
    "Modified: 17.9.1995 / 20:18:00 / claus"
120
claus
parents: 118
diff changeset
  1731
!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1732
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1733
addButton:aButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1734
    "add a button into the buttonPanel.
122
claus
parents: 121
diff changeset
  1735
     Returns the button."
120
claus
parents: 118
diff changeset
  1736
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1737
    ^ self addButton:aButton after:nil
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1738
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1739
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1740
addButton:aButton after:someOtherButtonOrNil
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1741
    "add a button in the buttonPanel.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1742
     If the argument someOtherButtonOrNil is nil, the button is
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1743
     added at the end."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1744
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1745
    |h|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1746
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1747
    buttonPanel addSubView:aButton after:someOtherButtonOrNil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1748
    buttonPanel subViews size > 1 ifTrue:[
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1749
        buttonPanel horizontalLayout:#fitSpace.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1750
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1751
    (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1752
         buttonPanel topInset:h negated
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1753
    ].
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1754
    needResize := true.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1755
    ^ aButton
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1756
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1757
    "Modified: 27.1.1996 / 18:20:18 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1758
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1759
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1760
addCheckBox:label on:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1761
    "create a checkBox with label on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1762
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1763
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1764
    ^ self addCheckBox:label on:aModel tabable:true
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1765
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1766
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1767
addCheckBox:label on:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1768
    "create a checkBox with label on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1769
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1770
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1771
    |b|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1772
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1773
    b := CheckBox on:aModel.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1774
    b label:label.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1775
    self addComponent:b tabable:tabable.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1776
    ^ b
120
claus
parents: 118
diff changeset
  1777
!
claus
parents: 118
diff changeset
  1778
130
claus
parents: 128
diff changeset
  1779
addColumn:aRow fromX:leftX toX:rightX collect:aBlock
claus
parents: 128
diff changeset
  1780
    "add some elements in a vertical column.
claus
parents: 128
diff changeset
  1781
     Equally space elements as returned from aBlock."
claus
parents: 128
diff changeset
  1782
claus
parents: 128
diff changeset
  1783
    |helper component|
claus
parents: 128
diff changeset
  1784
claus
parents: 128
diff changeset
  1785
    helper := VerticalPanelView new.
claus
parents: 128
diff changeset
  1786
claus
parents: 128
diff changeset
  1787
    aRow do:[:el |
claus
parents: 128
diff changeset
  1788
	component := aBlock value:el.
claus
parents: 128
diff changeset
  1789
	helper add:component.
claus
parents: 128
diff changeset
  1790
	component resize.
claus
parents: 128
diff changeset
  1791
    ].    
claus
parents: 128
diff changeset
  1792
claus
parents: 128
diff changeset
  1793
    helper resize.
claus
parents: 128
diff changeset
  1794
    self addComponent:helper.
claus
parents: 128
diff changeset
  1795
    width < helper preferredExtent x ifTrue:[
claus
parents: 128
diff changeset
  1796
	self width:helper preferredExtent x.
claus
parents: 128
diff changeset
  1797
Transcript show:'w now: '; showCr:helper preferredExtent x
claus
parents: 128
diff changeset
  1798
    ].
claus
parents: 128
diff changeset
  1799
    helper horizontalLayout:#fit.
claus
parents: 128
diff changeset
  1800
    helper left:leftX asFloat;
claus
parents: 128
diff changeset
  1801
	   right:rightX asFloat.
claus
parents: 128
diff changeset
  1802
claus
parents: 128
diff changeset
  1803
    "
claus
parents: 128
diff changeset
  1804
     |dialog|
claus
parents: 128
diff changeset
  1805
claus
parents: 128
diff changeset
  1806
     dialog := Dialog new.
claus
parents: 128
diff changeset
  1807
     dialog 
claus
parents: 128
diff changeset
  1808
	addColumn:#('a' 'b' 'c' 'd')
claus
parents: 128
diff changeset
  1809
	fromX:0
claus
parents: 128
diff changeset
  1810
	toX:1
claus
parents: 128
diff changeset
  1811
	collect:[:label | Label label:label].
claus
parents: 128
diff changeset
  1812
claus
parents: 128
diff changeset
  1813
     dialog addOkButton.
claus
parents: 128
diff changeset
  1814
     dialog open.
claus
parents: 128
diff changeset
  1815
    "
claus
parents: 128
diff changeset
  1816
claus
parents: 128
diff changeset
  1817
    "
claus
parents: 128
diff changeset
  1818
     |dialog y|
claus
parents: 128
diff changeset
  1819
claus
parents: 128
diff changeset
  1820
     dialog := Dialog new.
claus
parents: 128
diff changeset
  1821
     y := dialog yPosition.
claus
parents: 128
diff changeset
  1822
     dialog 
claus
parents: 128
diff changeset
  1823
	addColumn:#('a1' 'b1' 'c1' 'd1')
claus
parents: 128
diff changeset
  1824
	fromX:0
claus
parents: 128
diff changeset
  1825
	toX:(1/3) 
claus
parents: 128
diff changeset
  1826
	collect:[:label | Label label:label].
claus
parents: 128
diff changeset
  1827
claus
parents: 128
diff changeset
  1828
     dialog yPosition:y.
claus
parents: 128
diff changeset
  1829
     dialog 
claus
parents: 128
diff changeset
  1830
	addColumn:#('a2' 'b2' 'c2' 'd2')
claus
parents: 128
diff changeset
  1831
	fromX:(1/3)
claus
parents: 128
diff changeset
  1832
	toX:(2/3) 
claus
parents: 128
diff changeset
  1833
	collect:[:label | Label label:label].
claus
parents: 128
diff changeset
  1834
claus
parents: 128
diff changeset
  1835
     dialog yPosition:y.
claus
parents: 128
diff changeset
  1836
     dialog 
claus
parents: 128
diff changeset
  1837
	addColumn:#('a3' 'b3' 'c3' 'd3')
claus
parents: 128
diff changeset
  1838
	fromX:(2/3)
claus
parents: 128
diff changeset
  1839
	toX:1 
claus
parents: 128
diff changeset
  1840
	collect:[:label | Label label:label].
claus
parents: 128
diff changeset
  1841
claus
parents: 128
diff changeset
  1842
     dialog addOkButton.
claus
parents: 128
diff changeset
  1843
     dialog open.
claus
parents: 128
diff changeset
  1844
    "
claus
parents: 128
diff changeset
  1845
!
claus
parents: 128
diff changeset
  1846
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1847
addComponent:aComponent
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1848
    "add a component with its preferred height and full width.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1849
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1850
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1851
    ^ self addComponent:aComponent indent:nil tabable:false
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1852
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1853
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1854
addComponent:aComponent indent:indent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1855
    "add a component with its preferred height and full width.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1856
     The indent is temporarily changed to indent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1857
     Returns the component."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1858
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1859
    ^ self addComponent:aComponent indent:indent tabable:false
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1860
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1861
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1862
addComponent:aComponent indent:indent tabable:tabable
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1863
    "add a component with its preferred height and full width.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1864
     The indent is temporarily changed to indent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1865
     Returns the component."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1866
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1867
    |oldLeft oldRight result|
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1868
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1869
    oldLeft := leftIndent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1870
    oldRight := rightIndent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1871
    indent notNil ifTrue:[
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1872
        leftIndent := rightIndent := indent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1873
    ].
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1874
    result := self addComponent:aComponent tabable:tabable tabbedComponent:aComponent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1875
    leftIndent := oldLeft.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1876
    rightIndent := oldRight.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1877
    ^ result
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1878
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1879
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1880
addComponent:aComponent indent:indent withExtent:ext 
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1881
    "add a component with some given extent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1882
     Returns the component."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1883
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1884
    |fullSize lI rI|
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1885
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1886
    indent isNil ifTrue:[
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1887
        lI := leftIndent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1888
        rI := rightIndent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1889
    ] ifFalse:[
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1890
        lI := rI := indent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1891
    ].
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1892
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1893
    self basicAddComponent:aComponent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1894
    fullSize := ext + (lI + rI @ 0).
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1895
    aComponent extent:fullSize.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1896
    aComponent origin:0.0@yPosition; 
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1897
               leftInset:lI; 
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1898
               rightInset:rI.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1899
    yPosition := yPosition + aComponent height + ViewSpacing.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1900
    width := fullSize x max:width.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1901
    needResize := true.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1902
    ^ aComponent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1903
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1904
    "Modified: 27.1.1996 / 18:20:36 / cg"
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1905
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1906
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1907
addComponent:aComponent indent:indent withHeight:height 
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1908
    "add a component with some given height and full width.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1909
     Returns the component."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1910
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1911
    |lI rI|
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1912
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1913
    indent isNil ifTrue:[
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1914
        lI := leftIndent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1915
        rI := rightIndent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1916
    ] ifFalse:[
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1917
        lI := rI := indent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1918
    ].
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1919
    self basicAddComponent:aComponent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1920
    aComponent height:height.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1921
    aComponent origin:0.0@yPosition; 
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1922
               width:1.0; 
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1923
               leftInset:lI;
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1924
               rightInset:rI.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1925
    yPosition := yPosition + "aComponent" height + ViewSpacing.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1926
    needResize := true.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1927
    ^ aComponent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1928
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1929
    "Modified: 27.1.1996 / 18:20:39 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1930
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1931
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1932
addComponent:aComponent tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1933
    "add a component with its preferred height and full width.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1934
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1935
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1936
    ^ self addComponent:aComponent tabable:tabable tabbedComponent:aComponent 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1937
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1938
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1939
addComponent:aComponent tabable:tabable tabbedComponent:subComponent
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1940
    "add a component with its preferred height and full width.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1941
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1942
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1943
    tabable ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1944
	tabableElements isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1945
	    tabableElements := OrderedCollection new
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1946
	].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1947
	tabableElements add:subComponent
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1948
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1949
    ^ self addComponent:aComponent 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1950
	   withHeight:(aComponent preferredExtent y).
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1951
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1952
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1953
addComponent:aComponent withExtent:ext 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1954
    "add a component with some given extent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1955
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1956
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1957
    ^ self addComponent:aComponent indent:nil withExtent:ext
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1958
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1959
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1960
addComponent:aComponent withHeight:height 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1961
    "add a component with some given height and full width.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1962
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1963
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1964
    ^ self addComponent:aComponent indent:nil withHeight:height
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1965
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1966
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1967
addFilenameInputFieldOn:aModel in:aDirectory tabable:tabable
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1968
    "create a fileName input field on aModel and add it.
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1969
     Returns the field. This is much like a normal input field,
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1970
     but supports filename completion."
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1971
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1972
    |f|
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1973
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1974
    f := FilenameEditField new.
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1975
    aDirectory notNil ifTrue:[f directory:aDirectory].
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1976
    f model:aModel.
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1977
    self addInputField:f tabable:tabable.
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1978
    ^ f
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1979
!
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  1980
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1981
addHorizontalLine
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1982
    "add a horizontal line as separator"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1983
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1984
    self addComponent:(Separator new extent:1.0 @ 5).
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1985
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1986
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1987
addInputField:aField
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1988
    "add an already created input field; return the field.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1989
     Returns the field."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1990
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1991
    ^ self addInputField:aField tabable:true
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1992
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1993
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1994
addInputField:aField tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1995
    "add an already created input field; return the field.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1996
     If tabable is true, the field is put into a group, to allow
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1997
     stepping through the fields with #NextField/#PreviousField keys.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1998
     Returns the field."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1999
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2000
    self addComponent:aField tabable:tabable.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2001
    tabable ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2002
	inputFieldGroup isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2003
	    inputFieldGroup := EnterFieldGroup new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2004
	    inputFieldGroup leaveAction:[self lastFieldLeft].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2005
	    aField hasKeyboardFocus:true.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2006
	].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2007
	inputFieldGroup add:aField.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2008
	self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus).
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2009
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2010
    ^ aField
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2011
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2012
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2013
addInputFieldOn:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2014
    "create an input field on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2015
     Returns the field."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2016
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2017
    ^ self addInputFieldOn:aModel tabable:true
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2018
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2019
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2020
     |dialog model field|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2021
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2022
     model := '' asValue.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2023
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2024
     dialog := DialogBox new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2025
     dialog addTextLabel:'enter a string'.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2026
     field := dialog addInputFieldOn:model.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2027
     dialog addAbortButton; addOkButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2028
     dialog open.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2029
     dialog accepted ifTrue:[Transcript showCr:model value].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2030
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2031
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2032
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2033
addInputFieldOn:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2034
    "create an input field on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2035
     Returns the field."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2036
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2037
    |f|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2038
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2039
    f := EditField new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2040
    f model:aModel.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2041
    self addInputField:f tabable:tabable.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2042
    ^ f
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2043
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2044
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2045
addOkButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2046
    "create an okButton - to be sent from redefined initialize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2047
     methods in subclasses or when creating a box programmatically.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2048
     Returns the button."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2049
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2050
    ^ self addOkButtonLabelled:nil
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2051
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2052
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2053
addOkButton:aButton 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2054
    "add an already created okButton - to be sent from redefined initialize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2055
     methods in subclasses or when creating a box programmatically.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2056
     Returns the button."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2057
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2058
    okButton := aButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2059
    aButton model:self; change:#okPressed.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2060
    ^ self addButton:aButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2061
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2062
    "Modified: 17.9.1995 / 20:20:41 / claus"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2063
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2064
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2065
addOkButtonLabelled:buttonLabel 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2066
    "create an okButton with a label - to be sent from redefined initialize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2067
     methods in subclasses or when creating a box programmatically.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2068
     A nil argument creates one with the default text.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2069
     Returns the button."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2070
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2071
    |aButton|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2072
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2073
    aButton := Button okButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2074
    buttonLabel notNil ifTrue:[aButton label:buttonLabel].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2075
    aButton isReturnButton:acceptReturnAsOK.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2076
    ^ self addOkButton:aButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2077
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2078
    "Modified: 17.9.1995 / 20:19:49 / claus"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2079
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2080
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2081
addPopUpList:labelString on:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2082
    "create a popUpList with a label on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2083
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2084
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2085
    ^ self addPopUpList:labelString on:aModel tabable:true
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2086
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2087
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2088
addPopUpList:labelString on:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2089
    "create a popUpList on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2090
     Returns the popUpList."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2091
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2092
    |p box l|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2093
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2094
    p := PopUpList on:aModel.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2095
    p resize; sizeFixed:true.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2096
    labelString notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2097
	box := HorizontalPanelView new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2098
	box borderWidth:0; horizontalLayout:#rightSpace.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2099
	box add:(l := Label label:labelString).
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2100
	l borderWidth:0.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2101
	box add:p.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2102
    ] ifFalse:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2103
	box := p.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2104
    ].        
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2105
    self addComponent:box tabable:tabable tabbedComponent:p.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2106
    ^ p
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2107
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2108
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2109
addPopUpListOn:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2110
    "create a popUpList on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2111
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2112
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2113
    ^ self addPopUpList:nil on:aModel tabable:true
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2114
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2115
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2116
addPopUpListOn:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2117
    "create a popUpList on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2118
     Returns the popUpList."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2119
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2120
    ^ self addPopUpList:nil on:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2121
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2122
130
claus
parents: 128
diff changeset
  2123
addRow:aCol fromX:leftX toX:rightX collect:aBlock
claus
parents: 128
diff changeset
  2124
    "add some elements in a horizontal row.
claus
parents: 128
diff changeset
  2125
     Equally space elements as returned from aBlock.
claus
parents: 128
diff changeset
  2126
     Advance y."
claus
parents: 128
diff changeset
  2127
claus
parents: 128
diff changeset
  2128
    |helper component|
claus
parents: 128
diff changeset
  2129
claus
parents: 128
diff changeset
  2130
    helper := HorizontalPanelView new.
claus
parents: 128
diff changeset
  2131
claus
parents: 128
diff changeset
  2132
    aCol do:[:el |
claus
parents: 128
diff changeset
  2133
	component := aBlock value:el.
claus
parents: 128
diff changeset
  2134
	component resize.
claus
parents: 128
diff changeset
  2135
	helper add:component.
claus
parents: 128
diff changeset
  2136
    ].    
claus
parents: 128
diff changeset
  2137
claus
parents: 128
diff changeset
  2138
    helper resize.
claus
parents: 128
diff changeset
  2139
    self addComponent:helper.
claus
parents: 128
diff changeset
  2140
    width < helper preferredExtent x ifTrue:[
claus
parents: 128
diff changeset
  2141
	self width:helper preferredExtent x.
claus
parents: 128
diff changeset
  2142
Transcript show:'w now: '; showCr:helper preferredExtent x
claus
parents: 128
diff changeset
  2143
    ].
claus
parents: 128
diff changeset
  2144
    helper verticalLayout:#fit.
claus
parents: 128
diff changeset
  2145
    helper left:leftX asFloat;
claus
parents: 128
diff changeset
  2146
	   right:rightX asFloat.
claus
parents: 128
diff changeset
  2147
claus
parents: 128
diff changeset
  2148
    "
claus
parents: 128
diff changeset
  2149
     |dialog|
claus
parents: 128
diff changeset
  2150
claus
parents: 128
diff changeset
  2151
     dialog := Dialog new.
claus
parents: 128
diff changeset
  2152
     dialog 
claus
parents: 128
diff changeset
  2153
	addRow:#('a' 'b' 'c' 'd')
claus
parents: 128
diff changeset
  2154
	fromX:0
claus
parents: 128
diff changeset
  2155
	toX:1
claus
parents: 128
diff changeset
  2156
	collect:[:label | Label label:label].
claus
parents: 128
diff changeset
  2157
claus
parents: 128
diff changeset
  2158
     dialog addOkButton.
claus
parents: 128
diff changeset
  2159
     dialog open.
claus
parents: 128
diff changeset
  2160
    "
claus
parents: 128
diff changeset
  2161
claus
parents: 128
diff changeset
  2162
    "
claus
parents: 128
diff changeset
  2163
     |dialog|
claus
parents: 128
diff changeset
  2164
claus
parents: 128
diff changeset
  2165
     dialog := Dialog new.
claus
parents: 128
diff changeset
  2166
     dialog 
claus
parents: 128
diff changeset
  2167
	addRow:#('a1' 'b1' 'c1' 'd1')
claus
parents: 128
diff changeset
  2168
	fromX:0
claus
parents: 128
diff changeset
  2169
	toX:1 
claus
parents: 128
diff changeset
  2170
	collect:[:label | Label label:label].
claus
parents: 128
diff changeset
  2171
claus
parents: 128
diff changeset
  2172
     dialog 
claus
parents: 128
diff changeset
  2173
	addRow:#('a2' 'b2' 'c2' 'd2')
claus
parents: 128
diff changeset
  2174
	fromX:0
claus
parents: 128
diff changeset
  2175
	toX:0.5 
claus
parents: 128
diff changeset
  2176
	collect:[:label | Label label:label].
claus
parents: 128
diff changeset
  2177
claus
parents: 128
diff changeset
  2178
     dialog 
claus
parents: 128
diff changeset
  2179
	addRow:#('a3' 'b3' 'c3' 'd3')
claus
parents: 128
diff changeset
  2180
	fromX:0.5
claus
parents: 128
diff changeset
  2181
	toX:1 
claus
parents: 128
diff changeset
  2182
	collect:[:label | Label label:label].
claus
parents: 128
diff changeset
  2183
claus
parents: 128
diff changeset
  2184
     dialog addOkButton.
claus
parents: 128
diff changeset
  2185
     dialog open.
claus
parents: 128
diff changeset
  2186
    "
claus
parents: 128
diff changeset
  2187
!
claus
parents: 128
diff changeset
  2188
120
claus
parents: 118
diff changeset
  2189
addTextLabel:aString
claus
parents: 118
diff changeset
  2190
    "create a text label - the name has been choosen for ST-80 compatibility;
122
claus
parents: 121
diff changeset
  2191
     however, ST/X labels allow image labels too.
claus
parents: 121
diff changeset
  2192
     Returns the label."
120
claus
parents: 118
diff changeset
  2193
claus
parents: 118
diff changeset
  2194
    |l|
claus
parents: 118
diff changeset
  2195
claus
parents: 118
diff changeset
  2196
    l := Label new label:aString.
claus
parents: 118
diff changeset
  2197
    self addComponent:l.
claus
parents: 118
diff changeset
  2198
    ^ l
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2199
120
claus
parents: 118
diff changeset
  2200
    "
claus
parents: 118
diff changeset
  2201
     |b|
claus
parents: 118
diff changeset
  2202
claus
parents: 118
diff changeset
  2203
     b := DialogBox new.
claus
parents: 118
diff changeset
  2204
     b addTextLabel:'hello'.
claus
parents: 118
diff changeset
  2205
     b showAtPointer
claus
parents: 118
diff changeset
  2206
    "
claus
parents: 118
diff changeset
  2207
    "
claus
parents: 118
diff changeset
  2208
     |b|
claus
parents: 118
diff changeset
  2209
claus
parents: 118
diff changeset
  2210
     b := DialogBox new.
claus
parents: 118
diff changeset
  2211
     b leftIndent:100.
claus
parents: 118
diff changeset
  2212
     b addTextLabel:'hello'.
claus
parents: 118
diff changeset
  2213
     b leftIndent:0.
claus
parents: 118
diff changeset
  2214
     b addTextLabel:'world'.
claus
parents: 118
diff changeset
  2215
     b showAtPointer
claus
parents: 118
diff changeset
  2216
    "
claus
parents: 118
diff changeset
  2217
    "
claus
parents: 118
diff changeset
  2218
     |b|
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2219
120
claus
parents: 118
diff changeset
  2220
     b := DialogBox new.
claus
parents: 118
diff changeset
  2221
     b addTextLabel:'hello'.
claus
parents: 118
diff changeset
  2222
     b addTextLabel:'world'.
claus
parents: 118
diff changeset
  2223
     b addOkButton.
claus
parents: 118
diff changeset
  2224
     b showAtPointer
claus
parents: 118
diff changeset
  2225
    "
claus
parents: 118
diff changeset
  2226
    "
claus
parents: 118
diff changeset
  2227
     |b|
claus
parents: 118
diff changeset
  2228
claus
parents: 118
diff changeset
  2229
     b := DialogBox new.
claus
parents: 118
diff changeset
  2230
     b addTextLabel:'hello'.
claus
parents: 118
diff changeset
  2231
     (b addTextLabel:'world') foregroundColor:Color red.
claus
parents: 118
diff changeset
  2232
     b addOkButton.
claus
parents: 118
diff changeset
  2233
     b showAtPointer
claus
parents: 118
diff changeset
  2234
    "
claus
parents: 118
diff changeset
  2235
    "
claus
parents: 118
diff changeset
  2236
     |b|
claus
parents: 118
diff changeset
  2237
claus
parents: 118
diff changeset
  2238
     b := DialogBox new.
claus
parents: 118
diff changeset
  2239
     b addTextLabel:'hello world\\How about this ?' withCRs.
claus
parents: 118
diff changeset
  2240
     b addOkButton.
claus
parents: 118
diff changeset
  2241
     b showAtPointer
claus
parents: 118
diff changeset
  2242
    "
claus
parents: 118
diff changeset
  2243
    "
claus
parents: 118
diff changeset
  2244
     |b|
claus
parents: 118
diff changeset
  2245
claus
parents: 118
diff changeset
  2246
     b := DialogBox new.
claus
parents: 118
diff changeset
  2247
     b addTextLabel:'hello world\\How about this ?' withCRs.
claus
parents: 118
diff changeset
  2248
     b addTextLabel:'not bad'.
claus
parents: 118
diff changeset
  2249
     b addAbortButton.
claus
parents: 118
diff changeset
  2250
     b addOkButton.
claus
parents: 118
diff changeset
  2251
     b showAtPointer
claus
parents: 118
diff changeset
  2252
    "
claus
parents: 118
diff changeset
  2253
!
claus
parents: 118
diff changeset
  2254
122
claus
parents: 121
diff changeset
  2255
addVerticalSpace
claus
parents: 121
diff changeset
  2256
    "add a default vertical space (1 mm)"
claus
parents: 121
diff changeset
  2257
claus
parents: 121
diff changeset
  2258
    self addVerticalSpace:(ViewSpacing).
claus
parents: 121
diff changeset
  2259
!
claus
parents: 121
diff changeset
  2260
claus
parents: 121
diff changeset
  2261
addVerticalSpace:nPixel
claus
parents: 121
diff changeset
  2262
    "add some pixels of space to the next component"
claus
parents: 121
diff changeset
  2263
claus
parents: 121
diff changeset
  2264
    yPosition := yPosition + nPixel.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2265
    needResize := true.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2266
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2267
    "Modified: 27.1.1996 / 18:21:27 / cg"
122
claus
parents: 121
diff changeset
  2268
!
claus
parents: 121
diff changeset
  2269
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2270
leftIndent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2271
    "return the current indent 
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2272
     (current x position - thats where the next component will be located)."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2273
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2274
    ^ leftIndent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2275
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2276
    "Modified: 27.1.1996 / 18:21:31 / cg"
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2277
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2278
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2279
leftIndent:aNumber 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2280
    "set the left indent (current x position - thats where the next component
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2281
     will be located)."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2282
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2283
    leftIndent := aNumber.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2284
    needResize := true.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2285
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2286
    "Modified: 27.1.1996 / 18:21:31 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2287
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2288
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2289
makeTabable:aComponentOrSubcomponent
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2290
    "add a component (usually a subcomponent, of which the dialog
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2291
     does not know) to the list of tabable ones (i.e. those, that can be
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2292
     stepped through via FocusNext/FocusPrevious)"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2293
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2294
    tabableElements isNil ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2295
	tabableElements := OrderedCollection new
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2296
    ].
276
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  2297
    tabableElements add:aComponentOrSubcomponent.
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  2298
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  2299
    (aComponentOrSubcomponent isKindOf:EditField) ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2300
	inputFieldGroup isNil ifTrue:[
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2301
	    inputFieldGroup := EnterFieldGroup new.
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2302
	    inputFieldGroup leaveAction:[self lastFieldLeft].
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2303
	    aComponentOrSubcomponent hasKeyboardFocus:true.
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2304
	].
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2305
	inputFieldGroup add:aComponentOrSubcomponent.
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2306
	self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus).
276
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  2307
    ].
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  2308
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2309
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2310
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2311
rightIndent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2312
    "return the current right indent."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2313
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2314
    ^ rightIndent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2315
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2316
    "Modified: 27.1.1996 / 18:21:31 / cg"
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2317
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2318
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2319
rightIndent:aNumber 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2320
    "set the right indent"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2321
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2322
    rightIndent := aNumber.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2323
    needResize := true.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2324
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2325
    "Modified: 27.1.1996 / 18:21:36 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2326
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2327
122
claus
parents: 121
diff changeset
  2328
yPosition 
claus
parents: 121
diff changeset
  2329
    "return the current y position (thats where the next component
claus
parents: 121
diff changeset
  2330
     will be located)."
claus
parents: 121
diff changeset
  2331
claus
parents: 121
diff changeset
  2332
    ^ yPosition 
claus
parents: 121
diff changeset
  2333
!
claus
parents: 121
diff changeset
  2334
claus
parents: 121
diff changeset
  2335
yPosition:aNumber 
claus
parents: 121
diff changeset
  2336
    "set the current y position (thats where the next component
claus
parents: 121
diff changeset
  2337
     will be located)."
claus
parents: 121
diff changeset
  2338
claus
parents: 121
diff changeset
  2339
    yPosition := aNumber.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2340
    needResize := true.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2341
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2342
    "Modified: 27.1.1996 / 18:21:40 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2343
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2344
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2345
!DialogBox methodsFor:'initialization'!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2346
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2347
focusSequence
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2348
    "return the elements through which we can step via 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2349
     NextField/PreviousField keys.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2350
     Here we return all tabable fields followed by all buttons in
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2351
     the panel."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2352
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2353
    |fields buttons|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2354
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2355
    tabableElements isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2356
	fields := #()
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2357
    ] ifFalse:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2358
	fields := tabableElements
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2359
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2360
    buttonPanel notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2361
	buttons := buttonPanel subViews.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2362
	buttons notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2363
	    fields := fields , buttonPanel subViews
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2364
	]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2365
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2366
    ^ fields
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2367
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2368
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2369
initialize
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2370
    |mm|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2371
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2372
    super initialize.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2373
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2374
    label := 'Dialog'.
128
claus
parents: 126
diff changeset
  2375
    acceptValue := false asValue.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2376
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2377
    mm := ViewSpacing.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2378
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2379
    acceptReturnAsOK := true.
125
claus
parents: 122
diff changeset
  2380
    acceptOnLeave := true.
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2381
    hideOnAccept := true.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2382
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2383
    buttonPanel := HorizontalPanelView in:self.
118
claus
parents: 112
diff changeset
  2384
    buttonPanel 
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2385
        origin:(0.0 @ 1.0) corner:(1.0 @ 1.0);
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2386
        bottomInset:mm; 
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2387
        topInset:(font height + mm * 2) negated;
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2388
        borderWidth:0;
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2389
        horizontalLayout:#spread.
118
claus
parents: 112
diff changeset
  2390
122
claus
parents: 121
diff changeset
  2391
    yPosition := ViewSpacing.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2392
    leftIndent := rightIndent := (ViewSpacing // 2).
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2393
    needResize := true.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2394
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2395
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2396
     |b|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2397
     b := DialogBox new.
118
claus
parents: 112
diff changeset
  2398
     b addAbortButton; 
claus
parents: 112
diff changeset
  2399
       addOkButton; 
claus
parents: 112
diff changeset
  2400
       showAtPointer
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2401
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2402
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2403
     |b|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2404
     b := DialogBox new.
118
claus
parents: 112
diff changeset
  2405
     b addOkButton; 
claus
parents: 112
diff changeset
  2406
       showAtPointer
claus
parents: 112
diff changeset
  2407
    "
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2408
    "
118
claus
parents: 112
diff changeset
  2409
     |b|
claus
parents: 112
diff changeset
  2410
     b := DialogBox new.
claus
parents: 112
diff changeset
  2411
     b addTextLabel:'hello world';
claus
parents: 112
diff changeset
  2412
       addOkButton; 
claus
parents: 112
diff changeset
  2413
       showAtPointer
claus
parents: 112
diff changeset
  2414
    "
claus
parents: 112
diff changeset
  2415
    "
claus
parents: 112
diff changeset
  2416
     |b|
claus
parents: 112
diff changeset
  2417
     b := DialogBox new.
claus
parents: 112
diff changeset
  2418
     b addTextLabel:'hello world';
claus
parents: 112
diff changeset
  2419
       addVerticalSpace:50; 
claus
parents: 112
diff changeset
  2420
       addOkButton; 
claus
parents: 112
diff changeset
  2421
       showAtPointer
claus
parents: 112
diff changeset
  2422
    "
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2423
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2424
    "Modified: 27.1.1996 / 17:21:22 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2425
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2426
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2427
reAdjustGeometry
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2428
    "sent late in snapin processing - gives me a chance
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2429
     to resize for changed font dimensions."
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2430
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2431
    super reAdjustGeometry.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2432
    okButton notNil ifTrue:[okButton resize].
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2433
    abortButton notNil ifTrue:[abortButton resize].
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2434
    self resize
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2435
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2436
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2437
!DialogBox methodsFor:'private'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2438
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2439
basicAddComponent:aComponent 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2440
    "add a component, dont change its size"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2441
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2442
    addedComponents isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2443
	addedComponents := OrderedCollection new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2444
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2445
    addedComponents add:aComponent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2446
    self addSubView:aComponent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2447
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2448
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2449
hideAndEvaluate:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2450
    "if I am modal, make myself invisible and evaluate aBlock.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2451
     If nonModal, stay up, but also evaluate the block."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2452
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2453
    (windowGroup notNil and:[windowGroup isModal]) ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2454
	self hide.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2455
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2456
    aBlock notNil ifTrue:[aBlock value]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2457
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2458
    "Modified: 5.9.1995 / 19:06:33 / claus"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2459
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2460
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2461
realize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2462
    "if any inputFields where added, activate the first one"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2463
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2464
    inputFieldGroup notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2465
	inputFieldGroup activateFirst
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2466
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2467
    super realize
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2468
!
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2469
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2470
resize
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2471
    needResize ifTrue:[
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2472
        needResize := false.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2473
        super resize
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2474
    ]
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2475
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2476
    "Created: 27.1.1996 / 17:22:33 / cg"
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2477
    "Modified: 27.1.1996 / 18:25:40 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2478
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2479
120
claus
parents: 118
diff changeset
  2480
!DialogBox methodsFor:'queries'!
118
claus
parents: 112
diff changeset
  2481
121
claus
parents: 120
diff changeset
  2482
accepted
128
claus
parents: 126
diff changeset
  2483
    "after the box has closed:
claus
parents: 126
diff changeset
  2484
	 return true if accepted, false if canceled"
125
claus
parents: 122
diff changeset
  2485
128
claus
parents: 126
diff changeset
  2486
    ^ acceptValue value
121
claus
parents: 120
diff changeset
  2487
!
claus
parents: 120
diff changeset
  2488
120
claus
parents: 118
diff changeset
  2489
positionOffset
claus
parents: 118
diff changeset
  2490
    "return the delta, by which the box should be displayed
claus
parents: 118
diff changeset
  2491
     from the mouse pointer. Value returned here makes center of
claus
parents: 118
diff changeset
  2492
     okButton appear under the cursor"
118
claus
parents: 112
diff changeset
  2493
120
claus
parents: 118
diff changeset
  2494
    okButton isNil ifTrue:[
claus
parents: 118
diff changeset
  2495
	^ super positionOffset
118
claus
parents: 112
diff changeset
  2496
    ].
120
claus
parents: 118
diff changeset
  2497
    buttonPanel setChildPositionsIfChanged.
claus
parents: 118
diff changeset
  2498
    ^ (okButton originRelativeTo:self) + (okButton extent // 2)
118
claus
parents: 112
diff changeset
  2499
!
claus
parents: 112
diff changeset
  2500
130
claus
parents: 128
diff changeset
  2501
preferredExtent 
132
claus
parents: 131
diff changeset
  2502
    "return my preferred extent.
claus
parents: 131
diff changeset
  2503
     That is the max component width, or my current width (default);
claus
parents: 131
diff changeset
  2504
     whichever is larger, by the sum of the components heights."
118
claus
parents: 112
diff changeset
  2505
120
claus
parents: 118
diff changeset
  2506
    |w h p|
118
claus
parents: 112
diff changeset
  2507
120
claus
parents: 118
diff changeset
  2508
    addedComponents notNil ifTrue:[
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2509
        w := addedComponents 
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2510
                inject:0 
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2511
                into:[:max :element |
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2512
                        |eExt|
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2513
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2514
                        eExt := (element preferredExtent x) + (element borderWidth * 2). "/ max:element extent x.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2515
                        max max:(eExt + element leftInset + element rightInset)].
120
claus
parents: 118
diff changeset
  2516
    ] ifFalse:[
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2517
        w := super preferredExtent x.
120
claus
parents: 118
diff changeset
  2518
    ].
132
claus
parents: 131
diff changeset
  2519
    w := w max:width.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2520
    h := yPosition + ViewSpacing.
118
claus
parents: 112
diff changeset
  2521
130
claus
parents: 128
diff changeset
  2522
    buttonPanel subViews size ~~ 0 ifTrue:[
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2523
        p := buttonPanel preferredExtent.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2524
        w := w max:p x.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2525
        h := h
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2526
             + p y
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2527
             + ViewSpacing.
120
claus
parents: 118
diff changeset
  2528
    ].
118
claus
parents: 112
diff changeset
  2529
120
claus
parents: 118
diff changeset
  2530
"/    okButton isNil ifTrue:[
130
claus
parents: 128
diff changeset
  2531
"/        ^ super preferredExtent
120
claus
parents: 118
diff changeset
  2532
"/    ].
130
claus
parents: 128
diff changeset
  2533
"/    p := buttonPanel preferredExtent.
120
claus
parents: 118
diff changeset
  2534
"/    w := p x.
claus
parents: 118
diff changeset
  2535
"/    h := ViewSpacing
claus
parents: 118
diff changeset
  2536
"/         + p y
claus
parents: 118
diff changeset
  2537
"/         + ViewSpacing.
claus
parents: 118
diff changeset
  2538
"/
claus
parents: 118
diff changeset
  2539
    ^ w @ h
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2540
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2541
    "Modified: 27.1.1996 / 18:19:50 / cg"
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2542
! !
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2543
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2544
!DialogBox methodsFor:'special geometry settings'!
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2545
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2546
stickAtBottomWithFixHeight:aComponent
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2547
    "arrange for a component to be positioned at a constant offset
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2548
     from the bottom of the box and its height to remain the same.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2549
     This will keep the component at a constant distance from the bottom
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2550
     (without this setup, it would stay at a constant offset from the top)"
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2551
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2552
    self resize.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2553
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2554
    aComponent
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2555
        topInset:(self height - aComponent top) negated;
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2556
        bottomInset:(self height - aComponent bottom); 
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2557
        origin:0.0 @ 1.0; corner:1.0 @ 1.0.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2558
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2559
    "
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2560
     compare the resizing behavior of:
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2561
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2562
        |box|
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2563
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2564
        box := Dialog new.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2565
        box addTextLabel:'hello'.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2566
        box addTextLabel:'hello2'.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2567
        box addOkButton.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2568
        box show
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2569
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2570
     with:
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2571
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2572
        |box l2|
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2573
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2574
        box := Dialog new.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2575
        box addTextLabel:'hello'.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2576
        l2 := box addTextLabel:'hello2'.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2577
        box addOkButton.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2578
        box stickAtBottomWithFixHeight:l2.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2579
        box show
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2580
   "
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2581
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2582
    "Created: 27.1.1996 / 17:17:41 / cg"
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2583
    "Modified: 27.1.1996 / 18:29:03 / cg"
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2584
!
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2585
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2586
stickAtBottomWithVariableHeight:aComponent
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2587
    "arrange for a component to be positioned at a constant offset
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2588
     from the bottom of the box and its height to be adjusted.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2589
     This will resize the component for a constant distance from the top,
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2590
     and the bottom.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2591
     (without this setup, its height would remain constant)"
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2592
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2593
    self resize.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2594
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2595
    aComponent
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2596
        bottomInset:(self height - aComponent bottom); 
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2597
        corner:1.0@1.0.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2598
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2599
    "
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2600
     compare the resizing behavior of:
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2601
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2602
        |box|
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2603
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2604
        box := Dialog new.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2605
        box addTextLabel:'hello'.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2606
        (box addComponent:(SelectionInListView new)) level:-1.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2607
        box addOkButton.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2608
        box show
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2609
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2610
     with:
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2611
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2612
        |box list|
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2613
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2614
        box := Dialog new.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2615
        box addTextLabel:'hello'.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2616
        list := (box addComponent:(SelectionInListView new)) level:-1.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2617
        box addOkButton.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2618
        box stickAtBottomWithVariableHeight:list.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2619
        box show
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2620
   "
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2621
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2622
    "Modified: 27.1.1996 / 18:27:36 / cg"
118
claus
parents: 112
diff changeset
  2623
! !
claus
parents: 112
diff changeset
  2624
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2625
!DialogBox methodsFor:'user actions'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2626
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2627
abortPressed
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2628
    "sent by the cancel button; user pressed abort button
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2629
     - hide myself and evaluate okAction"
121
claus
parents: 120
diff changeset
  2630
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2631
    abortButton turnOffWithoutRedraw.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2632
    acceptValue value:false.
121
claus
parents: 120
diff changeset
  2633
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2634
    "/ actually, only hides if I have been opened modal
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2635
    self hideAndEvaluate:abortAction
121
claus
parents: 120
diff changeset
  2636
!
claus
parents: 120
diff changeset
  2637
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2638
doAccept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2639
    "let all components accept (i.e. update their model from the values),
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2640
     then set my accept value to true.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2641
     This is confusing: this method was originally called #accept,
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2642
     but renamed for compatibility with ST-80, where #accept returns the
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2643
     accept-valueHolder (which looks like a bad name to me ...)."
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2644
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2645
    addedComponents notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2646
	addedComponents do:[:aComponent |
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2647
	    (aComponent respondsTo:#accept) ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2648
		 aComponent accept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2649
	    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2650
	].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2651
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2652
    acceptValue value:true.
128
claus
parents: 126
diff changeset
  2653
!
claus
parents: 126
diff changeset
  2654
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2655
keyPress:aKey x:x y:y
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2656
    "return-key dublicates ok-function if acceptReturnAsOK is true"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2657
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2658
    (aKey == #Return) ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2659
        (okButton notNil and:[okButton isReturnButton]) ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2660
            ^ self okPressed
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2661
        ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2662
        (abortButton notNil and:[abortButton isReturnButton]) ifTrue:[
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2663
            ^ self abortPressed
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2664
        ].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2665
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2666
    super keyPress:aKey x:x y:y
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2667
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2668
    "Modified: 27.1.1996 / 14:23:16 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2669
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2670
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2671
lastFieldLeft
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2672
    "if the dialog involves input fields, this is called
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2673
     when the last field is left by Return-key or NextField-key"
120
claus
parents: 118
diff changeset
  2674
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2675
    acceptOnLeave ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2676
	acceptValue value:true. 
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2677
	self okPressed
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2678
    ].
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2679
    inputFieldGroup activateFirst
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2680
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2681
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2682
okPressed
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2683
    "sent by the okButton; user pressed ok-button
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2684
     - make myself invisible and if an action was specified do it"
128
claus
parents: 126
diff changeset
  2685
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2686
    okButton notNil ifTrue:[okButton turnOffWithoutRedraw].
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2687
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2688
    self doAccept.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2689
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2690
    acceptCheck notNil ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2691
	acceptCheck value ifFalse:[^ self]
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2692
    ].
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2693
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2694
    hideOnAccept ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2695
	"/ actually, only hides if I have been opened modal
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2696
	self hideAndEvaluate:okAction.
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2697
    ] ifFalse:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  2698
	okAction value
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2699
    ]
128
claus
parents: 126
diff changeset
  2700
! !
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2701
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2702
!DialogBox class methodsFor:'documentation'!
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2703
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2704
version
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2705
    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.38 1996-01-27 17:58:46 cg Exp $'
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2706
! !