DialogBox.st
author Claus Gittinger <cg@exept.de>
Wed, 28 Feb 1996 15:20:07 +0100
changeset 423 17f68f3dbeb6
parent 414 1435ecc200a9
child 424 1468956c1680
permissions -rw-r--r--
added #addComboList
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:
356
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    55
        originally, ST/X had separate classes for the various entry methods;
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    56
        there were YesNoBox, EnterBox, InfoBox and so on.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    57
        ST-80 has all this defined in the common Dialog.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    58
        Therefore, for compatibility, many ST/X methods defined here in Dialogs 
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    59
        class protocol simply dispatch to some other boxes class method.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    60
        In the future, those existing subclasses' functionality is going to
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    61
        be moved full into Dialog, and the subclasses will be replaced by dummy
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    62
        delegators. (They will be kept for backward compatibility, though).
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    63
121
claus
parents: 120
diff changeset
    64
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
    65
    instance variables:
81e3409404d2 Initial revision
claus
parents:
diff changeset
    66
356
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    67
        buttonPanel      <PanelView>    contains the button(s)
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    68
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    69
        okButton         <Button>       the ok-Button
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    70
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    71
        okAction         <Block>        the action to be performed when ok is pressed,
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    72
                                        or return is pressed.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    73
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    74
        acceptReturnAsOK <Boolean>      if true, pressing the return-key counts
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    75
                                        as if ok was pressed. Default is true.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    76
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    77
        abortButton      <Button>       the cancel-Button
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    78
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    79
        abortAction      <Block>        the action to be performed when cancel is
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    80
                                        pressed.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    81
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    82
        yPosisition      <Integer>      current y position when adding components
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    83
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    84
        leftIndent       <Integer>      left inset to use when adding components
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    85
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    86
        rightIndent      <Integer>      right inset to use when adding components
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    87
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    88
        addedComponents  <Collection>   programmatically added components
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    89
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    90
        inputFieldGroup  <EnterFieldGroup>   
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    91
                                        for added input fields
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    92
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    93
        acceptOnLeave    <Boolean>      if true (the default) and there are 
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    94
                                        tabable inputFields, accept and close when
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    95
                                        the last field is left. If false, the ok
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    96
                                        button must be pressed to close the box.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    97
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    98
        acceptedValue    v(<Boolean>)   valueHolder on a boolean
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    99
                                        after close: holds true if box was accepted
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   100
                                        (i.e. ok-Button was pressed), false if box was
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   101
                                        closed via cancel or window manager.
121
claus
parents: 120
diff changeset
   102
claus
parents: 120
diff changeset
   103
        
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   104
    For compatibility with ST-80, this class is also available under
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   105
    the global names DialogView and Dialog (see patches file).
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   106
"
81e3409404d2 Initial revision
claus
parents:
diff changeset
   107
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
   108
81e3409404d2 Initial revision
claus
parents:
diff changeset
   109
examples
81e3409404d2 Initial revision
claus
parents:
diff changeset
   110
"
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
   111
    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
   112
    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
   113
    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
   114
    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
   115
125
claus
parents: 122
diff changeset
   116
    For most simple standard dialogs, there are ready to use
claus
parents: 122
diff changeset
   117
    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
   118
125
claus
parents: 122
diff changeset
   119
    For example:
claus
parents: 122
diff changeset
   120
claus
parents: 122
diff changeset
   121
      info & warnings:
claus
parents: 122
diff changeset
   122
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   123
        Dialog information:'hi there'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   124
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   125
        Dialog warn:'oops'
125
claus
parents: 122
diff changeset
   126
claus
parents: 122
diff changeset
   127
claus
parents: 122
diff changeset
   128
      yes/no questions:
claus
parents: 122
diff changeset
   129
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   130
        (Dialog confirm:'is this simple ?')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   131
        ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   132
            Transcript showCr:'thats what I expected'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   133
        ] ifFalse:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   134
            Transcript showCr:'read more examples and documentation'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   135
        ]
125
claus
parents: 122
diff changeset
   136
claus
parents: 122
diff changeset
   137
claus
parents: 122
diff changeset
   138
      yes/no question with cancel option:
claus
parents: 122
diff changeset
   139
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   140
        |answer|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   141
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   142
        answer := Dialog confirmWithCancel:'is this simple ?'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   143
        answer isNil ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   144
            Transcript showCr:'no easy decision'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   145
        ] ifFalse:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   146
            answer ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   147
                Transcript showCr:'thats what I expected'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   148
            ] ifFalse:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   149
                Transcript showCr:'read more examples and documentation'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   150
            ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   151
        ]
125
claus
parents: 122
diff changeset
   152
claus
parents: 122
diff changeset
   153
claus
parents: 122
diff changeset
   154
      asking for a string:
claus
parents: 122
diff changeset
   155
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   156
        |s|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   157
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   158
        s := Dialog request:'enter your name, please:'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   159
        s notEmpty ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   160
            Transcript showCr:'you entered: ' , s.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   161
        ]
125
claus
parents: 122
diff changeset
   162
claus
parents: 122
diff changeset
   163
claus
parents: 122
diff changeset
   164
      asking for a string with given default:
claus
parents: 122
diff changeset
   165
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   166
        |s|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   167
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   168
        s := Dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   169
                request:'enter your name, please:'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   170
                initialAnswer:(OperatingSystem getLoginName).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   171
        s notEmpty ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   172
            Transcript showCr:'you entered: ' , s.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   173
        ]
125
claus
parents: 122
diff changeset
   174
claus
parents: 122
diff changeset
   175
claus
parents: 122
diff changeset
   176
      asking for a filename:
claus
parents: 122
diff changeset
   177
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   178
        |s|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   179
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   180
        s := Dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   181
                requestFileName:'select a file, please:'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   182
                default:''.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   183
        Transcript show:'you entered: '; showCr:s.
125
claus
parents: 122
diff changeset
   184
claus
parents: 122
diff changeset
   185
claus
parents: 122
diff changeset
   186
      with changed button label and pattern:
claus
parents: 122
diff changeset
   187
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   188
        |s|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   189
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   190
        s := Dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   191
                requestFileName:'select a file, please:'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   192
                default:''
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   193
                ok:'show'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   194
                abort:'cancel'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   195
                pattern:'*.rc'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   196
        Transcript show:'you entered: '; showCr:s.
125
claus
parents: 122
diff changeset
   197
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   198
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   199
      asking for a password:
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   200
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   201
        |s|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   202
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   203
        s := Dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   204
                requestPassword:'enter your secret, please:'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   205
        Transcript show:'you entered: '; showCr:s.
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   206
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   207
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   208
118
claus
parents: 112
diff changeset
   209
    However, you can construct dialogs programmatically, as shown in
claus
parents: 112
diff changeset
   210
    the following examples:
91
e8db16616e97 *** empty log message ***
claus
parents: 76
diff changeset
   211
121
claus
parents: 120
diff changeset
   212
    basic (unusable) example:
claus
parents: 120
diff changeset
   213
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   214
        DialogBox new open
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   215
121
claus
parents: 120
diff changeset
   216
    still unusable - only an ok-button:
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   217
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   218
        DialogBox new addOkButton; open
121
claus
parents: 120
diff changeset
   219
claus
parents: 120
diff changeset
   220
    both ok- and abortButtons:
118
claus
parents: 112
diff changeset
   221
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   222
        DialogBox new addAbortButton; addOkButton; open
121
claus
parents: 120
diff changeset
   223
122
claus
parents: 121
diff changeset
   224
    with different ok-label:
claus
parents: 121
diff changeset
   225
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   226
        DialogBox new addAbortButton; addOkButtonLabelled:'yeah'; open
122
claus
parents: 121
diff changeset
   227
121
claus
parents: 120
diff changeset
   228
    adding a textlabel gives an infoBox:
120
claus
parents: 118
diff changeset
   229
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   230
        DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   231
            addTextLabel:'hello';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   232
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   233
            open
121
claus
parents: 120
diff changeset
   234
claus
parents: 120
diff changeset
   235
    a textlabel with abort- and okButton gives a yesNoBox:
118
claus
parents: 112
diff changeset
   236
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   237
        DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   238
            addTextLabel:'hello';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   239
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   240
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   241
            open
121
claus
parents: 120
diff changeset
   242
claus
parents: 120
diff changeset
   243
    the same, adjusting the labels contents to the left:
claus
parents: 120
diff changeset
   244
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   245
        |box|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   246
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   247
        box := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   248
        (box addTextLabel:'hello') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   249
        box addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   250
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   251
            open
121
claus
parents: 120
diff changeset
   252
122
claus
parents: 121
diff changeset
   253
    with modified buttons:
claus
parents: 121
diff changeset
   254
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   255
        |box|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   256
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   257
        box := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   258
        (box addTextLabel:'are you certain ?') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   259
        box addAbortButtonLabelled:'not really'. 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   260
        (box addOkButtonLabelled:'yes, absolutely') 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   261
                activeBackgroundColor:Color red. 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   262
        box open
122
claus
parents: 121
diff changeset
   263
claus
parents: 121
diff changeset
   264
162
claus
parents: 157
diff changeset
   265
    mswindows style:
claus
parents: 157
diff changeset
   266
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   267
        |b box|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   268
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   269
        box := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   270
        (box addTextLabel:'are you certain ?') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   271
        b := Button new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   272
        b activeLogo:(Image fromFile:'bitmaps/cancel_down.bmp').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   273
        b passiveLogo:(Image fromFile:'bitmaps/cancel_up.bmp').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   274
        b focusLogo:(Image fromFile:'bitmaps/cancel_focus.bmp').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   275
        b beImageButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   276
        box addAbortButton:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   277
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   278
        b := Button new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   279
        b activeLogo:(Image fromFile:'bitmaps/ok_down.bmp').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   280
        b passiveLogo:(Image fromFile:'bitmaps/ok_up.bmp').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   281
        b focusLogo:(Image fromFile:'bitmaps/ok_focus.bmp').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   282
        b beImageButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   283
        box addOkButton:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   284
        box open
162
claus
parents: 157
diff changeset
   285
claus
parents: 157
diff changeset
   286
121
claus
parents: 120
diff changeset
   287
    two textlabels:
118
claus
parents: 112
diff changeset
   288
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   289
        DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   290
            addTextLabel:'hello';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   291
            addTextLabel:'world';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   292
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   293
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   294
            open
118
claus
parents: 112
diff changeset
   295
121
claus
parents: 120
diff changeset
   296
    fixing the dialogs size (suppres it calculating its size from the
130
claus
parents: 128
diff changeset
   297
    preferredExtents of its components):
118
claus
parents: 112
diff changeset
   298
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   299
        DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   300
            label:'a simple dialog';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   301
            addTextLabel:'hello';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   302
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   303
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   304
            extent:200@200;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   305
            sizeFixed:true;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   306
            open
118
claus
parents: 112
diff changeset
   307
121
claus
parents: 120
diff changeset
   308
    asking the box if it was closed via ok:
118
claus
parents: 112
diff changeset
   309
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   310
        (DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   311
            label:'a simple dialog';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   312
            addTextLabel:'hello';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   313
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   314
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   315
            extent:200@200;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   316
            sizeFixed:true;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   317
            open
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   318
        ) accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   319
            Transcript showCr:'yes'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   320
        ] ifFalse:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   321
            Transcript showCr:'no'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   322
        ]
118
claus
parents: 112
diff changeset
   323
121
claus
parents: 120
diff changeset
   324
    textLabels are not limited to strings (although, the name which is
claus
parents: 120
diff changeset
   325
    used for ST-80 compatibility, suggests it):
118
claus
parents: 112
diff changeset
   326
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   327
        DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   328
            addTextLabel:(Image fromFile:'bitmaps/garfield.gif');
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   329
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   330
            open
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   331
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   332
        DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   333
            addTextLabel:'hello';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   334
            addTextLabel:((Image fromFile:'bitmaps/garfield.gif')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   335
                                magnifiedTo:200@150);
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   336
            addTextLabel:'world';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   337
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   338
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   339
            open
120
claus
parents: 118
diff changeset
   340
121
claus
parents: 120
diff changeset
   341
    adding an input field (on a string model):
claus
parents: 120
diff changeset
   342
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   343
        |stringModel|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   345
        stringModel := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   346
        (DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   347
            addTextLabel:'Please enter a string:';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   348
            addInputFieldOn:stringModel; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   349
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   350
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   351
            open
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   352
        ) accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   353
            Transcript showCr:'entered: ', stringModel value
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   354
        ]
120
claus
parents: 118
diff changeset
   355
claus
parents: 118
diff changeset
   356
121
claus
parents: 120
diff changeset
   357
    multiple input fields (notice, that the dialog connects the fields
claus
parents: 120
diff changeset
   358
    in a group, so stepping is allowed via Cursor and Return keys):
claus
parents: 120
diff changeset
   359
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   360
        |firstName lastName|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   361
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   362
        firstName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   363
        lastName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   364
        (DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   365
            addTextLabel:'Please enter your name:';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   366
            addInputFieldOn:firstName; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   367
            addVerticalSpace;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   368
            addInputFieldOn:lastName; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   369
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   370
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   371
            open
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   372
        ) accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   373
            Transcript showCr:'entered: ', firstName value , ' ' , lastName value
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   374
        ]
121
claus
parents: 120
diff changeset
   375
claus
parents: 120
diff changeset
   376
claus
parents: 120
diff changeset
   377
    of course, the model may contain a value initially:
claus
parents: 120
diff changeset
   378
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   379
        |firstName lastName p line i name|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   380
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   381
        firstName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   382
        lastName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   383
        p := PipeStream readingFrom:'finger ' , OperatingSystem getLoginName.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   384
        p notNil ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   385
            line := p nextLine.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   386
            (i := line findString:'Name:') ~~ 0 ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   387
                name := line copyFrom:(i + 'Name:' size).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   388
            ] ifFalse:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   389
                (i := line findString:'real life:') == 0 ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   390
                    line := p nextLine.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   391
                ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   392
                (i := line findString:'real life:') ~~ 0 ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   393
                    name := line copyFrom:(i + 'real life:' size).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   394
                ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   395
            ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   396
            name notNil ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   397
                firstName value: name asCollectionOfWords first.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   398
                lastName  value: name asCollectionOfWords last.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   399
                Transcript showCr:'initially ' , firstName value , ' ' , lastName value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   400
            ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   401
            p close.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   402
        ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   403
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   404
        (DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   405
            addTextLabel:'Please enter your name:';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   406
            addInputFieldOn:firstName; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   407
            addVerticalSpace;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   408
            addInputFieldOn:lastName; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   409
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   410
            addOkButton;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   411
            open
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   412
        ) accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   413
            Transcript showCr:'entered: ', firstName value , ' ' , lastName value
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   414
        ]
121
claus
parents: 120
diff changeset
   415
120
claus
parents: 118
diff changeset
   416
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   417
    validated password entry:
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   418
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   419
        |box firstEntry secondEntry|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   420
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   421
        firstEntry := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   422
        secondEntry := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   423
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   424
        box := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   425
        (box addTextLabel:'Please enter your secret:') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   426
        (box addInputFieldOn:firstEntry) passwordCharacter:$*. 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   427
        box addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   428
        (box addInputFieldOn:secondEntry) passwordCharacter:$*. 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   429
        box addAbortButton. 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   430
        box addOkButton. 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   431
        box open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   432
        box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   433
            firstEntry value ~= secondEntry value ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   434
                Transcript showCr:'wrong input - try again'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   435
            ] ifFalse:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   436
                Transcript showCr:'entered: ', firstEntry value
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   437
            ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   438
        ]
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   439
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   440
121
claus
parents: 120
diff changeset
   441
   constructing a dialog from other elements:
claus
parents: 120
diff changeset
   442
claus
parents: 120
diff changeset
   443
     adding a fileSelectionList:
claus
parents: 120
diff changeset
   444
     (since the dialog adds the component with its preferred extent,
claus
parents: 120
diff changeset
   445
      ignoring the 300-height, this looks ugly ... 
claus
parents: 120
diff changeset
   446
      ... especially when resized vertically)
claus
parents: 120
diff changeset
   447
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   448
        |top l scr fileName|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   449
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   450
        fileName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   451
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   452
        top := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   453
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   454
        l := FileSelectionList new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   455
        l useIndex:false.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   456
        l doubleClickAction:[:name | top okPressed].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   457
        l action:[:name | fileName value:name].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   458
        scr := ScrollableView forView:l.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   459
        scr extent:(1.0 @ 300).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   460
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   461
        top addComponent:scr.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   462
        top addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   463
        top openModal.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   464
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   465
        top accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   466
            Transcript show:'fileName: '; showCr:fileName value storeString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   467
        ]
121
claus
parents: 120
diff changeset
   468
claus
parents: 120
diff changeset
   469
    same, looks better, since the height is made larger (not using 
claus
parents: 120
diff changeset
   470
    fileLists preferredExtent):
claus
parents: 120
diff changeset
   471
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   472
        |top l scr fileName|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   473
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   474
        fileName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   475
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   476
        top := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   477
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   478
        l := FileSelectionList new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   479
        l useIndex:false.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   480
        l doubleClickAction:[:name | top okPressed].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   481
        l action:[:name | fileName value:name].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   482
        scr := ScrollableView forView:l.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   483
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   484
        top addComponent:scr withExtent:300@300.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   485
        top addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   486
        top openModal.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   487
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   488
        top accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   489
            Transcript show:'fileName: '; showCr:fileName value storeString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   490
        ]
121
claus
parents: 120
diff changeset
   491
claus
parents: 120
diff changeset
   492
claus
parents: 120
diff changeset
   493
    again, setting the boxes initial size and fixing it
130
claus
parents: 128
diff changeset
   494
    (let it ignore the components' preferredExtent):
121
claus
parents: 120
diff changeset
   495
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   496
        |top fixFrame l scr fileName|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   497
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   498
        fileName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   499
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   500
        top := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   501
        top extent:300@300.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   502
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   503
        fixFrame := View new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   504
        fixFrame extent:(1.0 @ 300).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   505
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   506
        l := FileSelectionList new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   507
        l useIndex:false.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   508
        l doubleClickAction:[:name | top okPressed].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   509
        l action:[:name | fileName value:name].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   510
        scr := ScrollableView forView:l.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   511
        scr origin:0.0@0.0 corner:1.0@1.0.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   512
        fixFrame add:scr.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   513
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   514
        top addComponent:fixFrame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   515
        top addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   516
        top openModal.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   517
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   518
        top accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   519
            Transcript show:'fileName: '; showCr:fileName value storeString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   520
        ]
118
claus
parents: 112
diff changeset
   521
claus
parents: 112
diff changeset
   522
claus
parents: 112
diff changeset
   523
   adding a panel with checkBoxes:
claus
parents: 112
diff changeset
   524
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   525
        |top panel b value1 value2 value3 value4|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   526
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   527
        value1 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   528
        value2 := false asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   529
        value3 := false asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   530
        value4 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   531
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   532
        top := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   533
        top extent:200@300.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   534
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   535
        panel := VerticalPanelView new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   536
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   537
        b := CheckBox on:value1. b label:'check1'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   538
        panel addSubView:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   539
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   540
        b := CheckBox on:value2. b label:'check2'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   541
        panel addSubView:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   542
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   543
        b := CheckBox on:value3. b label:'check3'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   544
        panel addSubView:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   545
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   546
        b := CheckBox on:value4. b label:'check4'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   547
        panel addSubView:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   548
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   549
        top addComponent:panel.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   550
        top addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   551
        top open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   552
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   553
        top accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   554
            Transcript show:'value1: '; showCr:value1 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   555
            Transcript show:'value2: '; showCr:value2 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   556
            Transcript show:'value3: '; showCr:value3 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   557
            Transcript show:'value4: '; showCr:value4 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   558
        ]
118
claus
parents: 112
diff changeset
   559
120
claus
parents: 118
diff changeset
   560
   same, using a more convenient interface:
claus
parents: 118
diff changeset
   561
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   562
        |box value1 value2 value3 value4|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   563
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   564
        value1 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   565
        value2 := false asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   566
        value3 := false asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   567
        value4 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   568
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   569
        box := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   570
        box extent:200@300.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   571
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   572
        box addCheckBox:'check1' on:value1.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   573
        box addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   574
        box addCheckBox:'check2' on:value2.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   575
        box addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   576
        box addCheckBox:'check3' on:value3.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   577
        box addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   578
        box addCheckBox:'check4' on:value4.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   579
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   580
        box addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   581
        box open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   582
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   583
        box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   584
            Transcript show:'value1: '; showCr:value1 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   585
            Transcript show:'value2: '; showCr:value2 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   586
            Transcript show:'value3: '; showCr:value3 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   587
            Transcript show:'value4: '; showCr:value4 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   588
        ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   589
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   590
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   591
    same, using an even better interface:
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   592
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   593
        |box values labels|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   594
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   595
        values := #(true false false true) collect:[:val | val asValue].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   596
        labels := #('check1' 'check2' 'check3' 'check4').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   597
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   598
        box := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   599
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   600
        box
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   601
           addColumn:(1 to:labels size)
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   602
           fromX:0.0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   603
           toX:1.0 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   604
           collect:[:index | CheckBox label:(labels at:index) model:(values at:index)]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   605
           tabable:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   606
        
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   607
        box addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   608
        box open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   609
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   610
        box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   611
           values with:labels do:[:val :lbl |
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   612
              Transcript show:(lbl , ': '); showCr:val value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   613
           ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   614
        ]
126
claus
parents: 125
diff changeset
   615
claus
parents: 125
diff changeset
   616
164
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   617
    adding two panels in a frame:
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   618
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   619
        |box frame vPanel1 vPanel2 m1 m2 m3 m4 chk ef|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   620
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   621
        box := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   622
        box label:'example'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   623
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   624
        frame := FramedBox label:'frame'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   625
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   626
        vPanel1 := VerticalPanelView origin:0.0@0.0 corner:0.5@1.0 in:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   627
        vPanel1 horizontalLayout:#leftSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   628
        vPanel1 verticalLayout:#top.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   629
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   630
        vPanel2 := VerticalPanelView origin:0.5@0.0 corner:1.0@1.0 in:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   631
        vPanel2 horizontalLayout:#leftSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   632
        vPanel2 verticalLayout:#top.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   633
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   634
        m1 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   635
        m2 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   636
        m3 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   637
        m4 := 'hello' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   638
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   639
        vPanel1 add:(Label label:'check1').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   640
        vPanel1 add:(Label label:'m2').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   641
        vPanel1 add:(Label label:'m3').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   642
        vPanel1 add:(Label label:'enter').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   643
        vPanel1 add:(Label label:'lbl1').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   644
        vPanel1 add:(Label label:'lbl2').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   645
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   646
        vPanel2 add:(chk := CheckToggle on:m1). 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   647
        box makeTabable:chk.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   648
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   649
        vPanel2 add:(chk := CheckToggle on:m2). 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   650
        box makeTabable:chk.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   651
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   652
        vPanel2 add:(chk := CheckToggle on:m3). 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   653
        box makeTabable:chk.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   654
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   655
        vPanel2 add:(chk := CheckToggle on:m3). 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   656
        box makeTabable:chk.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   657
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   658
        vPanel2 add:(chk := CheckToggle on:m3). 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   659
        box makeTabable:chk.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   660
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   661
        vPanel2 add:(ef := EditField on:m4). 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   662
        ef immediateAccept:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   663
        box makeTabable:ef.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   664
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   665
        box addComponent:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   666
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   667
        box addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   668
        box openModal.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   669
        box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   670
            Transcript showCr:'accepted with:'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   671
            Transcript showCr:'   m1: ' , m1 value printString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   672
            Transcript showCr:'   m2: ' , m2 value printString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   673
            Transcript showCr:'   m3: ' , m3 value printString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   674
            Transcript showCr:'   m4: ' , m4 value printString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   675
        ]
164
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   676
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   677
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   678
126
claus
parents: 125
diff changeset
   679
    a full example:
claus
parents: 125
diff changeset
   680
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   681
        |box warnSTX allowUnderscore immutableArrays logDoits
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   682
         listOfLanguages listOfStyles styleNames 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   683
         frame panel c resourceDir dir |
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   684
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   685
        warnSTX := Compiler warnSTXSpecials asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   686
        allowUnderscore := Compiler allowUnderscoreInIdentifier asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   687
        immutableArrays := Compiler arraysAreImmutable asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   688
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   689
        logDoits := Smalltalk logDoits asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   690
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   691
        listOfLanguages := SelectionInList with:#('english'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   692
                                                  'french'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   693
                                                  'german'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   694
                                                  'italian'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   695
                                                  'spanish'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   696
                                                 ).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   697
        listOfLanguages selection:(Language asString).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   698
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   699
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   700
        resourceDir := Smalltalk getSystemFileName:'resources'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   701
        dir := FileDirectory directoryNamed:resourceDir.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   702
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   703
        styleNames := dir select:[:aFileName | aFileName endsWith:'.style'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   704
        styleNames := styleNames collect:[:aFileName | aFileName copyWithoutLast:6].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   705
        listOfStyles := SelectionInList with:styleNames sort.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   706
        listOfStyles selection:(View defaultStyle asString).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   707
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   708
        box := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   709
        box label:'Settings'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   710
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   711
        frame := FramedBox label:'Compiler'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   712
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   713
        panel horizontalLayout:#leftSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   714
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   715
        panel add:((CheckBox on:warnSTX) label:'warn about ST/X language extensions'; resize).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   716
        panel add:((CheckBox on:allowUnderscore) label:'allow underscore in identifiers'; resize).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   717
        panel add:((CheckBox on:immutableArrays) label:'literal arrays are immutable'; resize).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   718
        box addComponent:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   719
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   720
        frame := FramedBox label:'Misc'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   721
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   722
        panel horizontalLayout:#leftSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   723
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   724
        panel add:((CheckBox on:logDoits) label:'log doIts in changes file'; resize).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   725
        box addComponent:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   726
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   727
        frame := FramedBox label:'Language'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   728
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   729
        panel horizontalLayout:#leftSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   730
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   731
        panel add:((PopUpList on:listOfLanguages) width:0.5).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   732
        box addComponent:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   733
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   734
        frame := FramedBox label:'Style'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   735
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   736
        panel horizontalLayout:#leftSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   737
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   738
        panel add:((PopUpList on:listOfStyles) width:0.5).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   739
        box addComponent:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   740
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   741
        box addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   742
        box showAtPointer.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   743
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   744
        box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   745
            Transcript topView withCursor:Cursor wait do:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   746
                Compiler warnSTXSpecials:warnSTX value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   747
                Compiler allowUnderscoreInIdentifier:allowUnderscore value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   748
                Compiler arraysAreImmutable:immutableArrays value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   749
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   750
                Smalltalk logDoits:logDoits value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   751
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   752
                Transcript showCr:'change language to ' , listOfLanguages selection , ' ...'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   753
                Smalltalk at:#Language put:listOfLanguages selection asSymbol.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   754
                Smalltalk changed:#Language.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   755
                ResourcePack flushCachedResourcePacks.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   756
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   757
                Transcript showCr:'change style to ' , listOfStyles selection , ' ...'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   758
                View defaultStyle:listOfStyles selection asSymbol.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   759
            ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   760
        ]
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   761
"
81e3409404d2 Initial revision
claus
parents:
diff changeset
   762
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
   763
128
claus
parents: 126
diff changeset
   764
!DialogBox class methodsFor:'common dialogs'!
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   765
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
   766
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
   767
    "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
   768
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   769
    (InfoBox title:aString) showAtPointer
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   770
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   771
    "
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
   772
     Dialog information:'help'
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   773
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   774
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   775
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
   776
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
   777
    "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
   778
d3fe810390cb 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
    (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
   780
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   781
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   782
     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
   783
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   784
! !
d3fe810390cb 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
d3fe810390cb 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
!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
   787
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   788
confirm:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   789
    "launch a Dialog, which allows user to enter yes or no.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   790
     return true for yes, false for no"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   791
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   792
    |box answer|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   793
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   794
    box := YesNoBox title:aString.
414
1435ecc200a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   795
    box label:(self classResources string:'Confirm').
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   796
    box yesAction:[answer := true] noAction:[answer := false].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   797
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   798
    box yesAction:nil noAction:nil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   799
    ^ answer
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   800
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   801
    " 
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
   802
     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
   803
d3fe810390cb 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
     Transcript showCr:(
414
1435ecc200a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   805
        Dialog confirm:'are you certain ?'
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
   806
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   807
    "
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
   808
414
1435ecc200a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   809
    "Modified: 27.2.1996 / 01:17:54 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   810
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   811
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   812
confirm:aString initialAnswer:what
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   813
    "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
   814
     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
   815
     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
   816
     the default (i.e. return-) button"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   817
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   818
    |box answer|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   819
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   820
    box := YesNoBox title:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   821
    box yesAction:[answer := true] noAction:[answer := false].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   822
    what == false ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   823
	box okButton isReturnButton:false.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   824
	box acceptReturnAsOK:false.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   825
	box noButton beReturnButton.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   826
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   827
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   828
    box yesAction:nil noAction:nil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   829
    ^ answer
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   830
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   831
    " 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   832
     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
   833
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   834
     Transcript showCr:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   835
	Dialog confirm:'are you certain ?' 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
   836
     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   837
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   838
     Transcript showCr:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   839
	Dialog confirm:'are you certain ?' initialAnswer:true 
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
   840
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   841
    "
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
   842
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   843
    "Modified: 27.1.1996 / 14:24:39 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   844
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   845
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   846
confirm:aString yesLabel:yesText noLabel:noText
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   847
    "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
   848
     return true for yes, false for no.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   849
     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
   850
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   851
    |box answer|
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   852
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   853
    box := YesNoBox title:aString.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   854
    box yesLabel:yesText; noLabel:noText.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   855
    box yesAction:[answer := true] noAction:[answer := false].
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   856
    box showAtPointer.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   857
    box yesAction:nil noAction:nil.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   858
    ^ answer
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   859
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   860
    " 
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   861
     Dialog confirm:'really ?' yesLabel:'oh well' noLabel:'nope'
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   862
    "
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   863
374
39a735c9a1c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   864
    "Created: 21.2.1996 / 01:10:14 / cg"
39a735c9a1c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   865
    "Modified: 21.2.1996 / 01:34:55 / cg"
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   866
!
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   867
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   868
confirmWithCancel:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   869
    "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
   870
     return true for 'yes', false for 'no', nil for 'cancel'"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   871
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   872
    |box answer|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   873
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   874
    box := OptionBox title:aString numberOfOptions:3. 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   875
    box buttonTitles:(self classResources array:
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   876
			#('cancel' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   877
			  'no' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   878
			  'yes')
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   879
		     )
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   880
	     actions:(Array with:[answer := nil]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   881
			    with:[answer := false] 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   882
			    with:[answer := true]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   883
		     ).
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   884
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   885
    box actions:nil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   886
    ^ answer
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   887
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   888
    "
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
   889
     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
   890
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   891
     Transcript showCr:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   892
	Dialog confirmWithCancel:'really ?'
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
   893
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   894
    "
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
   895
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   896
    "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
   897
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   898
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   899
!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
   900
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   901
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
   902
    "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
   903
     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
   904
     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
   905
     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
   906
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   907
    ^ self requestFileName:titleString 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   908
		   default:'file.ext' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   909
		   version:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   910
		    ifFail:''
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   911
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   912
    "
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
   913
     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
   914
     Dialog requestFileName:'enter a fileName:' 
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   915
    "
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
   916
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   917
    "Created: 27.1.1996 / 13:24:35 / cg"
118
claus
parents: 112
diff changeset
   918
!
claus
parents: 112
diff changeset
   919
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   920
requestFileName:titleString default:defaultName
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   921
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   922
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   923
     Return the pathname string consisting of the full pathname of the filename,
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   924
     or an empty string (if cancel was pressed)."
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   925
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   926
    ^ self requestFileName:titleString 
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   927
		   default:defaultName 
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   928
		   version:nil 
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   929
		    ifFail:''
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   930
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   931
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   932
     Dialog requestFileName:'enter a fileName:' default:''  
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   933
     Dialog requestFileName:'enter a fileName:' default:'Makefile.bak'  
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   934
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   935
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   936
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   937
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   938
    "launch a Dialog, which allows user to enter a filename.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   939
     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
   940
     The matchPattern is set to pattern initially.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   941
     Return the string or nil if cancel was pressed."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   942
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   943
    |box|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   944
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   945
    box := FileSelectionBox 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   946
	       title:titleString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   947
	       okText:okText 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   948
	       abortText:abortText
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   949
	       action:[:fileName | ^ fileName].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   950
    box pattern:pattern.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   951
    box initialText:defaultName.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   952
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   953
    box action:nil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   954
    ^ nil
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   955
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   956
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   957
     Dialog requestFileName:'enter a fileName:'
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   958
			default:''
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   959
			     ok:'yeah' 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   960
			  abort:'oh, no' 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   961
			pattern:'*.st'   
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   962
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   963
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   964
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   965
requestFileName:titleString default:defaultName version:versionSymbol
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   966
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   967
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   968
     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
   969
     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
   970
     it may be any of:
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   971
	#mustBeNew      - fail (return empty string) if the file exists
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   972
	#new            - confirm if the file exists
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   973
	#mustBeOld      - fail if the file does not exist
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   974
	#old            - confirm if the file does not exist
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   975
	#any (other)    - no validation
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
   976
    "
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   977
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   978
    ^ self requestFileName:titleString 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   979
		   default:defaultName 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   980
		   version:versionSymbol 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   981
		    ifFail:''
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   982
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   983
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   984
     Dialog requestFileName:'enter a fileName:'
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   985
			default:''
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   986
			version:nil   
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
d3fe810390cb 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
     Dialog requestFileName:'enter a fileName:'
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   989
			default:''
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   990
			version:#mustBeNew 
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
   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
     Dialog requestFileName:'enter a fileName:'
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   993
			default:''
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   994
			version:#new   
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   995
    "
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
   996
d3fe810390cb 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
    "Modified: 27.1.1996 / 13:42:16 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   998
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   999
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1000
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1001
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1002
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1003
     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
  1004
     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
  1005
     it may be any of:
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1006
	#mustBeNew      - fail (return empty string) if the file exists
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1007
	#new            - confirm if the file exists
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1008
	#mustBeOld      - fail if the file does not exist
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1009
	#old            - confirm if the file does not exist
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1010
	#any (other)    - no validation
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
  1011
    "
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1012
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1013
    |box|
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1014
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1015
    box := FileSelectionBox title:titleString.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1016
    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
  1017
    box action:[:name | 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1018
	versionSymbol == #mustBeNew ifTrue:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1019
	    "/ file may not exist
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1020
	    name asFilename exists ifTrue:[^ ''].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1021
	].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1022
	versionSymbol == #new ifTrue:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1023
	    "/ file may not exist
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1024
	    name asFilename exists ifTrue:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1025
		(self confirm:(ClassResources string:'''%1'' exists.\\Continue anyway ?' with:box fileName) withCRs)
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1026
		ifFalse:[^ ''].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1027
	    ].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1028
	].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1029
	versionSymbol == #mustBeOld ifTrue:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1030
	    name asFilename exists ifFalse:[^ ''].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1031
	].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1032
	versionSymbol == #old ifTrue:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1033
	    "/ file may not exist
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1034
	    name asFilename exists ifFalse:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1035
		(self confirm:(ClassResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:box fileName) withCRs)
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1036
		ifFalse:[^ ''].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1037
	    ].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1038
	].
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
  1039
        
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1040
	^ name
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
  1041
    ].
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1042
    box showAtPointer.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1043
    box action:nil.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1044
    ^ failBlock value
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1045
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1046
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1047
     Dialog requestFileName:'enter a fileName:'
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1048
			default:''
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1049
			version:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1050
			 ifFail:['none']   
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
  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
    "
d3fe810390cb 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
     Dialog requestFileName:'enter a fileName:'
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1054
			default:''
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1055
			version:#old 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1056
			 ifFail:['none']   
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
  1057
    "
d3fe810390cb 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
    "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
  1060
!
d3fe810390cb 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
d3fe810390cb 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
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
  1063
    "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
  1064
     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
  1065
     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
  1066
     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
  1067
     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
  1068
     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
  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
    ^ self requestFileName:titleString 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1071
		   default:defaultName 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1072
		   version:#new 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1073
		    ifFail:''
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
  1074
d3fe810390cb 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
    "
d3fe810390cb 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
     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
  1077
    "
d3fe810390cb 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
d3fe810390cb 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
    "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
  1080
! !
d3fe810390cb 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
d3fe810390cb 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
!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
  1083
d3fe810390cb 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
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
  1085
    "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
  1086
     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
  1087
     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
  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
    ^ self 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1090
	request:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1091
	displayAt:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1092
	centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1093
	action:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1094
	initialAnswer:''
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
  1095
d3fe810390cb 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
    "
d3fe810390cb 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
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1098
	 request:'enter a string:' 
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
  1099
    "
d3fe810390cb 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
    "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
  1102
!
d3fe810390cb 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
d3fe810390cb 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
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
  1105
    "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
  1106
     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
  1107
     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
  1108
     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
  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
    ^ self
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1111
	request:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1112
	displayAt:aPoint 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1113
	centered:centered 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1114
	action:resultAction 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1115
	initialAnswer:initial
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1116
	onCancel:''
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
  1117
d3fe810390cb 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
     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
  1120
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1121
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1122
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1123
	    displayAt:200@200
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1124
	    centered:true
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1125
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1126
	    initialAnswer:'the default'
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
  1127
d3fe810390cb 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
d3fe810390cb 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
     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
  1130
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1131
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1132
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1133
	    displayAt:200@200
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1134
	    centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1135
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1136
	    initialAnswer:'the default'
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
  1137
d3fe810390cb 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
     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
  1139
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1140
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1141
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1142
	    displayAt:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1143
	    centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1144
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1145
	    initialAnswer:'the default'
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
  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
     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
  1148
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1149
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1150
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1151
	    displayAt:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1152
	    centered:true 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1153
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1154
	    initialAnswer:'the default'
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
  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
d3fe810390cb 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
    "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
  1158
    "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
  1159
!
d3fe810390cb 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
d3fe810390cb 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: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
  1162
    "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
  1163
     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
  1164
     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
  1165
     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
  1166
d3fe810390cb 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
    |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
  1168
d3fe810390cb 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
    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
  1170
    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
  1171
    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
  1172
    resultAction isNil ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1173
	box action:[:val | ^ val]
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
  1174
    ] ifFalse:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1175
	box action:[:val | ^ resultAction value:val]
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
  1176
    ].
d3fe810390cb 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
    aPoint notNil ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1178
	box showAt:aPoint center:centered
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
  1179
    ] ifFalse:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1180
	centered ifTrue:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1181
	    box showAtCenter
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1182
	] ifFalse:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1183
	    box showAtPointer
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1184
	]
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
  1185
    ].
d3fe810390cb 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
    ^ 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
  1187
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1188
    "
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
  1189
     at topLeft (centering is suppressed, to make the box fully visible)    
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1190
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1191
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1192
	    displayAt:0@0
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1193
	    centered:true
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1194
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1195
	    initialAnswer:'the default'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1196
	    onCancel:#foo
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
  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 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
  1199
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1200
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1201
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1202
	    displayAt:200@200
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1203
	    centered:true
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1204
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1205
	    initialAnswer:'the default'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1206
	    onCancel:#foo
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
  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
     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
  1209
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1210
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1211
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1212
	    displayAt:200@200
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1213
	    centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1214
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1215
	    initialAnswer:'the default'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1216
	    onCancel:#foo
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
  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
     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
  1219
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1220
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1221
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1222
	    displayAt:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1223
	    centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1224
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1225
	    initialAnswer:'the default'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1226
	    onCancel:#foo
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
  1227
d3fe810390cb 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
     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
  1229
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1230
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1231
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1232
	    displayAt:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1233
	    centered:true 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1234
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1235
	    initialAnswer:'the default'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1236
	    onCancel:#foo
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
  1237
    "
d3fe810390cb 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
    "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
  1240
    "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
  1241
!
d3fe810390cb 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
d3fe810390cb 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
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
  1244
    "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
  1245
     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
  1246
     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
  1247
d3fe810390cb 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
    ^ self 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1249
	request:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1250
	displayAt:aPoint 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1251
	centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1252
	action:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1253
	initialAnswer:initial
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
  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
    "
d3fe810390cb 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
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1257
	 request:'enter a string:' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1258
	 displayAt:(250 @ 250) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1259
	 initialAnswer:'the default' 
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
  1260
    "
d3fe810390cb 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
d3fe810390cb 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
    "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
  1263
!
d3fe810390cb 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
d3fe810390cb 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
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
  1266
    "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
  1267
     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
  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
    ^ self 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1270
	request:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1271
	displayAt:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1272
	centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1273
	action:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1274
	initialAnswer:initial
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
  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
    "
d3fe810390cb 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
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1278
	 request:'enter a string:' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1279
	 initialAnswer:'the default'  
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
  1280
    "
d3fe810390cb 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
d3fe810390cb 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
    "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
  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
d3fe810390cb 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 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
  1286
    "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
  1287
     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
  1288
     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
  1289
d3fe810390cb 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
    self 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1291
	request:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1292
	displayAt:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1293
	centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1294
	action:[:result | ^ result] 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1295
	initialAnswer:initial.
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
  1296
d3fe810390cb 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
    ^ 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
  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
    "
d3fe810390cb 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
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1301
	 request:'enter a string:' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1302
	 initialAnswer:'the default'  
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1303
	 onCancel:['foooo']   
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
  1304
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1305
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1306
    "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
  1307
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1308
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1309
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
  1310
    "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
  1311
     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
  1312
     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
  1313
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1314
    self 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1315
	request:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1316
	displayAt:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1317
	centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1318
	action:[:result | ^ result] 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1319
	initialAnswer:''.
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
  1320
d3fe810390cb 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
    ^ 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
  1322
d3fe810390cb 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
    "
d3fe810390cb 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
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1325
	 request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1326
	 onCancel:nil       
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
  1327
    "
d3fe810390cb 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
d3fe810390cb 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
    "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
  1330
    "Modified: 27.1.1996 / 14:46:10 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1331
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1332
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1333
requestPassword:aString 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1334
    "launch a Dialog, which allows user to enter something invisibly.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1335
     Return the entered string (may be empty string) 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1336
     or nil (if cancel was pressed)"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1337
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1338
    ^ EnterBox requestPassword:aString 
133
claus
parents: 132
diff changeset
  1339
claus
parents: 132
diff changeset
  1340
    "
claus
parents: 132
diff changeset
  1341
     Dialog 
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1342
	 requestPassword:'enter secret:'
133
claus
parents: 132
diff changeset
  1343
    "
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1344
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1345
    "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
  1346
! !
d3fe810390cb 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
d3fe810390cb 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
!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
  1349
d3fe810390cb 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
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
  1351
    "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
  1352
     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
  1353
     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
  1354
     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
  1355
     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
  1356
     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
  1357
     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
  1358
     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
  1359
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1360
    |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
  1361
d3fe810390cb 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 := 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
  1363
    (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
  1364
d3fe810390cb 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
    list notNil ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1366
	listView := ScrollableView for:SelectionInListView.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1367
	listView list:list.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1368
	listView doubleClickAction:[:line | box hide. ^ listValues at:line].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1369
	box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines).
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1370
	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
  1371
    ].
d3fe810390cb 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
    buttonLabels notNil ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1374
	panel := HorizontalPanelView new.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1375
	panel horizontalLayout:#fitSpace.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1376
	buttonLabels keysAndValuesDo:[:index :label |
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1377
	    |b|
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1378
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1379
	    b := Button label:label.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1380
	    b action:[box hide. ^ buttonValues at:index].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1381
	    panel add:b.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1382
	    box makeTabable:b.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1383
	].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1384
	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
  1385
    ].
d3fe810390cb 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
    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
  1387
    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
  1388
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1389
    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
  1390
    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
  1391
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
  1392
    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
  1393
    box accepted ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1394
	(answer := listView selection) notNil ifTrue:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1395
	    ^ listValues at:answer
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1396
	]
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
  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
    ^ cancelBlock value
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1399
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1400
    "
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
  1401
     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
  1402
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1403
	 Transcript showCr:(
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1404
	     Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1405
		choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1406
		fromList:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1407
		values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1408
		buttons:#('five' 'six' 'seven')
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1409
		values:#(5 6 7)
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1410
		lines:10 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1411
		cancel:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1412
	 )
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
  1413
d3fe810390cb 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
     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
  1416
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1417
	 Transcript showCr:(
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1418
	     Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1419
		choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1420
		fromList:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1421
		values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1422
		buttons:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1423
		values:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1424
		lines:4
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1425
		cancel:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1426
	 )
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
  1427
d3fe810390cb 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
     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
  1430
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1431
	 Transcript showCr:(
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1432
	     Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1433
		choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1434
		fromList:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1435
		values:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1436
		buttons:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1437
		values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1438
		lines:4
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1439
		cancel:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1440
	 )
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
  1441
d3fe810390cb 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
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1443
      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
  1444
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1445
	 Transcript showCr:(
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1446
	     Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1447
		choose:'choose example' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1448
		fromList:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1449
		values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1450
		buttons:#('five' 'six' 'seven')
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1451
		values:#(5 6 7)
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1452
		lines:4
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1453
		cancel:[Transcript flash. #aborted]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1454
	 )
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
  1455
d3fe810390cb 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
d3fe810390cb 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
     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
  1458
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1459
	 Transcript showCr:(
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1460
	     Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1461
		choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1462
		fromList:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1463
		values:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1464
		buttons:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1465
		values:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1466
		lines:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1467
		cancel:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1468
	 )
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
  1469
d3fe810390cb 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
133
claus
parents: 132
diff changeset
  1471
    "
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
  1472
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1473
    "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
  1474
!
d3fe810390cb 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
d3fe810390cb 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
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
  1477
    "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
  1478
     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
  1479
     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
  1480
     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
  1481
     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
  1482
d3fe810390cb 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
    ^ self
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1484
	choose:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1485
	fromList:list 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1486
	values:listValues
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1487
	buttons:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1488
	values:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1489
	lines:maxLines
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1490
	cancel:cancelBlock
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
  1491
d3fe810390cb 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
     Transcript showCr:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1494
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1495
	    choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1496
	    fromList:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1497
	    values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1498
	    lines:4
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1499
	    cancel:nil
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
  1500
     )
d3fe810390cb 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
d3fe810390cb 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
     Transcript showCr:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1503
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1504
	    choose:'choose example' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1505
	    fromList:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1506
	    values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1507
	    lines:4
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1508
	    cancel:[Transcript flash. #aborted]
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
  1509
     )
d3fe810390cb 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
    "
d3fe810390cb 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
d3fe810390cb 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
    "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
  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
d3fe810390cb 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: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
  1516
    "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
  1517
     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
  1518
     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
  1519
     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
  1520
     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
  1521
     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
  1522
d3fe810390cb 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
    |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
  1524
d3fe810390cb 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
    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
  1526
    box buttonTitles:(self classResources array:buttonLabels)
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1527
	     actions:(values collect:[:val | [answer := val]]).
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
  1528
    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
  1529
    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
  1530
    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
  1531
    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
  1532
    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
  1533
    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
  1534
    ^ 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
  1535
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1536
    "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
  1537
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1538
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1539
	choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1540
	labels:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1541
	values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1542
	default:2 
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
  1543
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1544
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1545
	choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1546
	labels:#('cancel' 'foo' 'bar' 'baz') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1547
	values:#(nil foo bar baz) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1548
	default:#baz     
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
  1549
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1550
      Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1551
	choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1552
	labels:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1553
	values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1554
	default:nil 
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
  1555
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1556
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1557
    "Modified: 27.1.1996 / 13:48:17 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1558
! !
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1559
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1560
!DialogBox methodsFor:'accessing'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1561
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1562
abortText:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1563
    "define the label in the abort-button"
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
    |oldSize|
121
claus
parents: 120
diff changeset
  1566
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1567
    aString ~= abortButton label ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1568
	oldSize := abortButton extent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1569
	abortButton label:aString.
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
	abortButton extent ~= oldSize ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1572
	    shown ifTrue:[self resize]
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
    ]
121
claus
parents: 120
diff changeset
  1575
!
claus
parents: 120
diff changeset
  1576
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1577
okText:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1578
    "define the text in the ok-button"
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
    |oldSize|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1581
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1582
    aString ~= okButton label ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1583
	oldSize := okButton extent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1584
	okButton label:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1585
	okButton resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1586
	okButton extent ~= oldSize ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1587
	    shown ifTrue:[self resize]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1588
	]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1589
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1590
!
125
claus
parents: 122
diff changeset
  1591
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1592
okText:okString abortText:abortString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1593
    "set both texts displayed in the buttons"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1594
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1595
    (abortString ~= abortButton label 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1596
    or:[okString ~= okButton label]) ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1597
	okButton label:okString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1598
	abortButton label:abortString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1599
	okButton resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1600
	abortButton resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1601
	shown ifTrue:[self resize]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1602
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1603
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1604
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1605
!DialogBox methodsFor:'accessing-behavior'!
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
abortAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1608
    "define the action to be performed when abort is pressed"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1609
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1610
    abortAction := aBlock
125
claus
parents: 122
diff changeset
  1611
!
claus
parents: 122
diff changeset
  1612
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1613
acceptCheck:aBlock
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1614
    "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
  1615
     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
  1616
     otherwise not."
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1617
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1618
    acceptCheck := aBlock
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
acceptOnLeave:aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1622
    "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
  1623
     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
  1624
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1625
    acceptOnLeave := aBoolean.
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
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1628
acceptReturnAsOK:aBoolean
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1629
    "turn on/off interpretation of return-key as ok.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1630
     Default is on"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1631
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1632
    acceptReturnAsOK := aBoolean.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1633
    okButton notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1634
	okButton isReturnButton:aBoolean.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1635
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1636
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1637
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1638
action:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1639
    "set the action to be performed when user presses ok-button;
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1640
     aBlock must be nil or a block. This method simply
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1641
     reuses okAction: and has been added for a consistent action-setting
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1642
     protocol."
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1643
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1644
    self okAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1645
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1646
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1647
focusOnField:anInputField
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1648
    inputFieldGroup makeActive:anInputField
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1649
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1650
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1651
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1652
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1653
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1654
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1655
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1656
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1657
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1658
hideOnAccept:aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1659
    "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
  1660
     The default is true"
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1661
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1662
    hideOnAccept := aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1663
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1664
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1665
okAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1666
    "define the action to be performed when ok is pressed"
133
claus
parents: 132
diff changeset
  1667
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1668
    okAction := aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1669
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1670
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1671
!DialogBox methodsFor:'accessing-components'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1672
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1673
abortButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1674
    "return the abortButton - this access is provided to allow
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1675
     setting the buttons look (for example: colors or font)"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1676
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1677
    ^ abortButton
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1678
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1679
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1680
okButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1681
    "return the okButton - this access is provided to allow
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1682
     setting the buttons look (for example: colors or font)"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1683
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1684
    ^ okButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1685
! !
155
claus
parents: 146
diff changeset
  1686
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1687
!DialogBox methodsFor:'accessing-elements'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1688
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1689
componentAt:name
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1690
    bindings isNil ifTrue:[^ nil].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1691
    ^ bindings at:name ifAbsent:nil
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1692
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1693
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1694
inputFieldGroup
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1695
    ^ inputFieldGroup
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1696
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1697
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1698
name:element as:name
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1699
    bindings isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1700
	bindings := IdentityDictionary new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1701
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1702
    bindings at:name put:element
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1703
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1704
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1705
!DialogBox methodsFor:'accessing-models'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1706
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1707
accept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1708
    "return the valueHolder holding true when the box
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1709
     is accepted, false if closed via the windowManager or
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1710
     the cancel button.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1711
     This is confusing: this method was originally called #acceptValue,
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1712
     but renamed for compatibility with ST-80.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1713
     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
  1714
     is used to force an accept, not to return some valueHolder ...)."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1715
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1716
    ^ acceptValue
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1717
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1718
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1719
acceptChannel:aValueHolder
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1720
    "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
  1721
     is accepted"
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1722
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1723
    acceptValue := aValueHolder
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1724
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1725
120
claus
parents: 118
diff changeset
  1726
!DialogBox methodsFor:'construction-adding'!
claus
parents: 118
diff changeset
  1727
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1728
addAbortButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1729
    "create an abortButton - to be sent from redefined initialize
162
claus
parents: 157
diff changeset
  1730
     methods in subclasses or when creating a box programmatically.
claus
parents: 157
diff changeset
  1731
     Returns the button."
claus
parents: 157
diff changeset
  1732
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1733
    ^ self addAbortButtonLabelled:nil
122
claus
parents: 121
diff changeset
  1734
!
120
claus
parents: 118
diff changeset
  1735
162
claus
parents: 157
diff changeset
  1736
addAbortButton:aButton 
claus
parents: 157
diff changeset
  1737
    "add an already created abortButton - to be sent from redefined initialize
claus
parents: 157
diff changeset
  1738
     methods in subclasses or when creating a box programmatically.
claus
parents: 157
diff changeset
  1739
     Returns the button."
claus
parents: 157
diff changeset
  1740
claus
parents: 157
diff changeset
  1741
    abortButton := aButton.
claus
parents: 157
diff changeset
  1742
    aButton model:self; change:#abortPressed.
claus
parents: 157
diff changeset
  1743
    ^ self addButton:aButton.
claus
parents: 157
diff changeset
  1744
claus
parents: 157
diff changeset
  1745
    "Created: 17.9.1995 / 20:17:26 / claus"
claus
parents: 157
diff changeset
  1746
!
claus
parents: 157
diff changeset
  1747
122
claus
parents: 121
diff changeset
  1748
addAbortButtonLabelled:buttonLabel
claus
parents: 121
diff changeset
  1749
    "create an abortButton with a label - to be sent from redefined initialize
claus
parents: 121
diff changeset
  1750
     methods in subclasses or when creating a box programmatically.
claus
parents: 121
diff changeset
  1751
     A nil argument creates one with the default label.
claus
parents: 121
diff changeset
  1752
     Returns the button."
claus
parents: 121
diff changeset
  1753
162
claus
parents: 157
diff changeset
  1754
    |aButton|
claus
parents: 157
diff changeset
  1755
claus
parents: 157
diff changeset
  1756
    aButton := Button abortButton.
claus
parents: 157
diff changeset
  1757
    buttonLabel notNil ifTrue:[aButton label:buttonLabel].
claus
parents: 157
diff changeset
  1758
    ^ self addAbortButton:aButton
claus
parents: 157
diff changeset
  1759
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1760
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1761
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1762
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1763
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1764
     dialog addAbortButtonLabelled:'get out of here'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1765
     dialog addOkButtonLabelled:'yes thats ok'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1766
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1767
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1768
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1769
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1770
    "Modified: 9.2.1996 / 22:09:40 / cg"
120
claus
parents: 118
diff changeset
  1771
!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1772
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1773
addButton:aButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1774
    "add a button into the buttonPanel.
122
claus
parents: 121
diff changeset
  1775
     Returns the button."
120
claus
parents: 118
diff changeset
  1776
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1777
    ^ self addButton:aButton after:nil
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1778
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1779
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1780
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1781
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1782
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1783
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1784
     dialog addButton:(Button label:'foo' action:[Transcript showCr:'foo']).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1785
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1786
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1787
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1788
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1789
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1790
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1791
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1792
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1793
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1794
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1795
     dialog addButton:(Button label:'foo' action:[dialog hide. Transcript showCr:'foo']).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1796
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1797
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1798
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1799
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1800
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1801
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1802
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1803
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1804
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1805
     dialog addButton:(Button label:'foo' action:[dialog hide. Transcript showCr:'foo']).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1806
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1807
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1808
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1809
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1810
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1811
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1812
    "Modified: 9.2.1996 / 22:14:17 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1813
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1814
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1815
addButton:aButton after:someOtherButtonOrNil
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1816
    "add a button into the buttonPanel.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1817
     If the argument someOtherButtonOrNil is nil, the button is
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1818
     added at the end."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1819
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1820
    |h|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1821
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1822
    buttonPanel addSubView:aButton after:someOtherButtonOrNil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1823
    buttonPanel subViews size > 1 ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1824
        buttonPanel horizontalLayout:#fitSpace.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1825
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1826
    (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1827
         buttonPanel topInset:h negated
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1828
    ].
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1829
    needResize := true.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1830
    ^ aButton
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1831
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1832
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1833
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1834
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1835
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1836
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1837
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1838
     dialog addButton:(Button 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1839
                        label:'foo' 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1840
                        action:[dialog hide. Transcript showCr:'foo'])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1841
                after:(dialog okButton).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1842
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1843
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1844
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1845
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1846
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1847
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1848
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1849
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1850
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1851
     dialog addButton:(Button 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1852
                        label:'foo' 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1853
                        action:[dialog hide. Transcript showCr:'foo'])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1854
                after:(dialog abortButton).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1855
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1856
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1857
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1858
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1859
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1860
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1861
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1862
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1863
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1864
     dialog addButton:(Button 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1865
                        label:'foo' 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1866
                        action:[dialog hide. Transcript showCr:'foo'])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1867
                after:nil.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1868
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1869
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1870
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1871
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1872
    "Modified: 9.2.1996 / 22:13:51 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1873
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1874
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1875
addButton:aButton before:someOtherButtonOrNil
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1876
    "add a button into the buttonPanel.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1877
     If the argument someOtherButtonOrNil is nil, the button is
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1878
     added upFront."
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1879
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1880
    |h|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1881
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1882
    buttonPanel addSubView:aButton before:someOtherButtonOrNil.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1883
    buttonPanel subViews size > 1 ifTrue:[
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1884
        buttonPanel horizontalLayout:#fitSpace.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1885
    ].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1886
    (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1887
         buttonPanel topInset:h negated
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1888
    ].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1889
    needResize := true.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1890
    ^ aButton
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1891
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1892
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1893
     |dialog|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1894
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1895
     dialog := DialogBox new.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1896
     dialog addAbortButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1897
     dialog addOkButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1898
     dialog addButton:(Button 
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1899
                        label:'foo' 
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1900
                        action:[dialog hide. Transcript showCr:'foo'])
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1901
                before:(dialog okButton).
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1902
     dialog open.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1903
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1904
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1905
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1906
     |dialog|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1907
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1908
     dialog := DialogBox new.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1909
     dialog addAbortButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1910
     dialog addOkButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1911
     dialog addButton:(Button 
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1912
                        label:'foo' 
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1913
                        action:[dialog hide. Transcript showCr:'foo'])
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1914
                before:nil.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1915
     dialog open.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1916
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1917
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1918
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1919
    "Modified: 9.2.1996 / 22:13:51 / cg"
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1920
    "Created: 10.2.1996 / 16:04:35 / cg"
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1921
!
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  1922
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1923
addCheckBox:label on:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1924
    "create a checkBox with label on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1925
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1926
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1927
    ^ self addCheckBox:label on:aModel tabable:true
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1928
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1929
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1930
     |dialog check|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1931
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1932
     check := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1933
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1934
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1935
     dialog addCheckBox:'on or off' on:check.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1936
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1937
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1938
     dialog accepted ifTrue:[Transcript showCr:check value].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1939
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1940
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1941
    "Modified: 9.2.1996 / 22:15:38 / cg"
197
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
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1944
addCheckBox:label on:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1945
    "create a checkBox with label on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1946
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1947
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1948
    |b|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1949
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1950
    b := CheckBox on:aModel.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1951
    b label:label.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1952
    self addComponent:b tabable:tabable.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1953
    ^ b
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1954
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1955
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1956
     |dialog check1 check2 check3|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1957
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1958
     check1 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1959
     check2 := false asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1960
     check3 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1961
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1962
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1963
     dialog addCheckBox:'on or off' on:check1 tabable:false.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1964
     dialog addHorizontalLine.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1965
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1966
     dialog addCheckBox:'on or off' on:check2 tabable:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1967
     dialog addCheckBox:'on or off' on:check3 tabable:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1968
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1969
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1970
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1971
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1972
    "Modified: 9.2.1996 / 22:16:49 / cg"
120
claus
parents: 118
diff changeset
  1973
!
claus
parents: 118
diff changeset
  1974
130
claus
parents: 128
diff changeset
  1975
addColumn:aRow fromX:leftX toX:rightX collect:aBlock
claus
parents: 128
diff changeset
  1976
    "add some elements in a vertical column.
claus
parents: 128
diff changeset
  1977
     Equally space elements as returned from aBlock."
claus
parents: 128
diff changeset
  1978
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1979
    self 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1980
        addColumn:aRow 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1981
        fromX:leftX toX:rightX 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1982
        collect:aBlock 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1983
        tabable:false
130
claus
parents: 128
diff changeset
  1984
claus
parents: 128
diff changeset
  1985
    "
claus
parents: 128
diff changeset
  1986
     |dialog|
claus
parents: 128
diff changeset
  1987
claus
parents: 128
diff changeset
  1988
     dialog := Dialog new.
claus
parents: 128
diff changeset
  1989
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1990
        addColumn:#('label1' 'label2' 'lbl3' 'l4' 'label5')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1991
        fromX:0.0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1992
        toX:1.0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1993
        collect:[:label | Label label:label].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1994
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1995
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1996
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1997
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1998
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  1999
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2000
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2001
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2002
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2003
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2004
        addColumn:#('label1' 'label2' 'label3' 'label4' 'label5')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2005
        fromX:0.25 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2006
        toX:0.75
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2007
        collect:[:label | (Label label:label) adjust:#left].
130
claus
parents: 128
diff changeset
  2008
claus
parents: 128
diff changeset
  2009
     dialog addOkButton.
claus
parents: 128
diff changeset
  2010
     dialog open.
claus
parents: 128
diff changeset
  2011
    "
claus
parents: 128
diff changeset
  2012
claus
parents: 128
diff changeset
  2013
    "
claus
parents: 128
diff changeset
  2014
     |dialog y|
claus
parents: 128
diff changeset
  2015
claus
parents: 128
diff changeset
  2016
     dialog := Dialog new.
claus
parents: 128
diff changeset
  2017
     y := dialog yPosition.
claus
parents: 128
diff changeset
  2018
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2019
        addColumn:#('a1' 'b1' 'c1' 'd1')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2020
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2021
        toX:(1/3) 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2022
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  2023
claus
parents: 128
diff changeset
  2024
     dialog yPosition:y.
claus
parents: 128
diff changeset
  2025
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2026
        addColumn:#('a2' 'b2' 'c2' 'd2')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2027
        fromX:(1/3)
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2028
        toX:(2/3) 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2029
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  2030
claus
parents: 128
diff changeset
  2031
     dialog yPosition:y.
claus
parents: 128
diff changeset
  2032
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2033
        addColumn:#('a3' 'b3' 'c3' 'd3')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2034
        fromX:(2/3)
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2035
        toX:1 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2036
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  2037
claus
parents: 128
diff changeset
  2038
     dialog addOkButton.
claus
parents: 128
diff changeset
  2039
     dialog open.
claus
parents: 128
diff changeset
  2040
    "
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2041
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2042
    "Modified: 9.2.1996 / 22:22:12 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2043
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2044
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2045
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2046
    "add some elements in a vertical column.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2047
     Equally space elements as returned from aBlock."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2048
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2049
    self 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2050
        addColumn:aRow 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2051
        fromX:leftX toX:rightX 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2052
        collect:aBlock 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2053
        tabable:tabable 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2054
        horizontalLayout:#fitSpace 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2055
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2056
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2057
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2058
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2059
     values := (1 to:4) collect:[:dummy | '' asValue].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2060
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2061
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2062
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2063
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2064
        addColumn:#('one' 'two' 'three' 'four')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2065
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2066
        toX:0.3 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2067
        collect:[:label | Label label:label].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2068
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2069
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2070
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2071
        addColumn:values
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2072
        fromX:0.3
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2073
        toX:1.0 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2074
        collect:[:value | EditField on:value]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2075
        tabable:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2076
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2077
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2078
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2079
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2080
     dialog accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2081
        Transcript showCr:(values collect:[:holder | holder value])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2082
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2083
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2084
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2085
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2086
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2087
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2088
     values := #(true true false false false true false true) collect:[:val | val asValue].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2089
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2090
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2091
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2092
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2093
        addColumn:(1 to:4)
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2094
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2095
        toX:0.5 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2096
        collect:[:idx | CheckToggle on:(values at:idx)]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2097
        tabable:true
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2098
        horizontalLayout:#center.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2099
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2100
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2101
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2102
        addColumn:(5 to:8) 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2103
        fromX:0.5 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2104
        toX:1.0 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2105
        collect:[:idx | CheckToggle on:(values at:idx)]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2106
        tabable:true
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2107
        horizontalLayout:#center.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2108
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2109
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2110
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2111
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2112
     dialog accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2113
        Transcript showCr:(values collect:[:holder | holder value])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2114
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2115
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2116
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2117
    "Created: 9.2.1996 / 21:51:47 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2118
    "Modified: 9.2.1996 / 22:22:02 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2119
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2120
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2121
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable horizontalLayout:hLayout
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2122
    "add some elements in a vertical column.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2123
     Equally space elements as returned from aBlock."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2124
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2125
    |helper component|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2126
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2127
    helper := VerticalPanelView new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2128
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2129
    aRow do:[:el |
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2130
        component := aBlock value:el.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2131
        helper add:component.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2132
        component resize.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2133
        tabable ifTrue:[self makeTabable:component].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2134
    ].    
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2135
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2136
    helper resize.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2137
    self addComponent:helper.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2138
    width < helper preferredExtent x ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2139
        self width:helper preferredExtent x.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2140
        "/ Transcript show:'w now: '; showCr:helper preferredExtent x
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2141
    ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2142
    helper horizontalLayout:hLayout.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2143
    helper left:leftX asFloat;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2144
           right:rightX asFloat;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2145
           leftInset:leftIndent;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2146
           rightInset:rightIndent.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2147
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2148
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2149
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2150
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2151
     values := (1 to:4) collect:[:dummy | '' asValue].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2152
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2153
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2154
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2155
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2156
        addColumn:#('one' 'two' 'three' 'four')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2157
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2158
        toX:0.3 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2159
        collect:[:label | Label label:label].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2160
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2161
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2162
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2163
        addColumn:values
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2164
        fromX:0.3
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2165
        toX:1.0 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2166
        collect:[:value | EditField on:value]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2167
        tabable:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2168
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2169
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2170
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2171
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2172
     dialog accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2173
        Transcript showCr:(values collect:[:holder | holder value])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2174
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2175
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2176
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2177
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2178
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2179
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2180
     values := #(true true false false false true false true) collect:[:val | val asValue].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2181
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2182
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2183
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2184
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2185
        addColumn:(1 to:4)
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2186
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2187
        toX:0.5 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2188
        collect:[:idx | CheckToggle on:(values at:idx)].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2189
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2190
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2191
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2192
        addColumn:(5 to:8) 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2193
        fromX:0.5 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2194
        toX:1.0 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2195
        collect:[:idx | CheckToggle on:(values at:idx)]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2196
        tabable:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2197
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2198
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2199
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2200
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2201
     dialog accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2202
        Transcript showCr:(values collect:[:holder | holder value])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2203
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2204
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2205
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2206
    "Modified: 9.2.1996 / 22:02:22 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2207
    "Created: 9.2.1996 / 22:20:31 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2208
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2209
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2210
addComboBoxOn:aModel tabable:tabable
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2211
    "create a comboBox on aModel and add it.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2212
     Returns the box."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2213
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2214
    |f|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2215
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2216
    f := ComboBoxView new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2217
    f model:aModel.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2218
    self addComponent:f tabable:tabable.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2219
    tabable ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2220
        self addToInputFieldGroup:f editor.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2221
    ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2222
    ^ f
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2223
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2224
    "
423
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2225
     without a list, the comboBox is disabled:
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2226
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2227
     |box val|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2228
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2229
     val := 'some input' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2230
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2231
     box := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2232
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2233
     (box addTextLabel:'combo box example') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2234
     box addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2235
     (box addComboBoxOn:val tabable:true).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2236
     box addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2237
     box open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2238
     box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2239
        Transcript showCr:val value
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2240
     ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2241
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2242
423
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2243
    "with a list, it can be pulled:
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2244
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2245
     |box val|
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2246
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2247
     val := '' asValue.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2248
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2249
     box := Dialog new.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2250
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2251
     (box addTextLabel:'combo box example') adjust:#left.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2252
     box addVerticalSpace.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2253
     (box addComboBoxOn:val tabable:true) list:#('one' 'two' 'three' 'four').
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2254
     box addOkButton.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2255
     box open.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2256
     box accepted ifTrue:[
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2257
        Transcript showCr:val value
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2258
     ].
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2259
    "
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2260
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2261
    "Modified: 28.2.1996 / 15:17:39 / cg"
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2262
!
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2263
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2264
addComboListOn:aModel tabable:tabable
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2265
    "create a comboList on aModel and add it.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2266
     Returns the box."
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2267
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2268
    |f|
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2269
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2270
    f := ComboListView new.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2271
    f model:aModel.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2272
    self addComponent:f tabable:tabable.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2273
    ^ f
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2274
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2275
    "
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2276
     |box val|
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2277
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2278
     val := 'some input' asValue.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2279
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2280
     box := Dialog new.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2281
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2282
     (box addTextLabel:'combo list example') adjust:#left.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2283
     box addVerticalSpace.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2284
     (box addComboListOn:val tabable:true).
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2285
     box addOkButton.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2286
     box open.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2287
     box accepted ifTrue:[
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2288
        Transcript showCr:val value
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2289
     ].
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2290
    "
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2291
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2292
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2293
     |box val|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2294
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2295
     val := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2296
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2297
     box := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2298
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2299
     (box addTextLabel:'combo box example') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2300
     box addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2301
     (box addComboBoxOn:val tabable:true) list:#('one' 'two' 'three' 'four').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2302
     box addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2303
     box open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2304
     box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2305
        Transcript showCr:val value
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2306
     ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2307
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2308
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2309
    "Modified: 9.2.1996 / 22:46:40 / cg"
423
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2310
    "Created: 28.2.1996 / 15:16:34 / cg"
130
claus
parents: 128
diff changeset
  2311
!
claus
parents: 128
diff changeset
  2312
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2313
addComponent:aComponent
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2314
    "add any component with its preferred height and full width.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2315
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2316
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2317
    ^ self addComponent:aComponent indent:nil tabable:false
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2318
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2319
    "Modified: 9.2.1996 / 22:22:41 / cg"
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2320
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2321
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2322
addComponent:aComponent indent:indent
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2323
    "add any component with its preferred height and full width.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2324
     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
  2325
     Returns the component."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2326
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2327
    ^ self addComponent:aComponent indent:indent tabable:false
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2328
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2329
    "Modified: 9.2.1996 / 22:22:44 / cg"
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2330
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2331
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2332
addComponent:aComponent indent:indent tabable:tabable
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2333
    "add any component with its preferred height and full width.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2334
     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
  2335
     Returns the component."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2336
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2337
    |oldLeft oldRight result|
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2338
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2339
    oldLeft := leftIndent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2340
    oldRight := rightIndent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2341
    indent notNil ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2342
        leftIndent := rightIndent := indent.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2343
    ].
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2344
    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
  2345
    leftIndent := oldLeft.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2346
    rightIndent := oldRight.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2347
    ^ result
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2348
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2349
    "Modified: 9.2.1996 / 22:22:50 / cg"
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2350
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2351
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2352
addComponent:aComponent indent:indent withExtent:ext 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2353
    "add any component with some given extent.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2354
     Returns the component."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2355
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2356
    |fullSize lI rI|
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2357
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2358
    indent isNil ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2359
        lI := leftIndent.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2360
        rI := rightIndent.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2361
    ] ifFalse:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2362
        lI := rI := indent
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2363
    ].
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2364
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2365
    self basicAddComponent:aComponent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2366
    fullSize := ext + (lI + rI @ 0).
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2367
    aComponent extent:fullSize.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2368
    aComponent origin:0.0@yPosition; 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2369
               leftInset:lI; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2370
               rightInset:rI.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2371
    yPosition := yPosition + aComponent height + ViewSpacing.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2372
    width := fullSize x max:width.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2373
    needResize := true.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2374
    ^ aComponent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2375
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2376
    "Modified: 9.2.1996 / 22:22:54 / cg"
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2377
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2378
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2379
addComponent:aComponent indent:indent withHeight:height 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2380
    "add any component with some given height and full width.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2381
     Returns the component."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2382
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2383
    |lI rI|
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2384
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2385
    indent isNil ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2386
        lI := leftIndent.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2387
        rI := rightIndent.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2388
    ] ifFalse:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2389
        lI := rI := indent
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2390
    ].
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2391
    self basicAddComponent:aComponent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2392
    aComponent height:height.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2393
    aComponent origin:0.0@yPosition; 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2394
               width:1.0; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2395
               leftInset:lI;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2396
               rightInset:rI.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2397
    yPosition := yPosition + "aComponent" height + ViewSpacing.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2398
    needResize := true.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2399
    ^ aComponent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2400
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2401
    "Modified: 9.2.1996 / 22:22:58 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2402
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2403
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2404
addComponent:aComponent tabable:tabable
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2405
    "add any component with its preferred height and full width.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2406
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2407
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2408
    ^ self addComponent:aComponent tabable:tabable tabbedComponent:aComponent
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2409
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2410
    "Modified: 9.2.1996 / 22:23:04 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2411
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2412
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2413
addComponent:aComponent tabable:tabable tabbedComponent:subComponent
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2414
    "add any component with its preferred height and full width.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2415
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2416
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2417
    tabable ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2418
        tabableElements isNil ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2419
            tabableElements := OrderedCollection new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2420
        ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2421
        tabableElements add:subComponent
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2422
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2423
    ^ self addComponent:aComponent 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2424
           withHeight:(aComponent preferredExtent y).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2425
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2426
    "Modified: 9.2.1996 / 22:23:07 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2427
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2428
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2429
addComponent:aComponent withExtent:ext 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2430
    "add any component with some given extent.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2431
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2432
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2433
    ^ self addComponent:aComponent indent:nil withExtent:ext
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2434
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2435
    "Modified: 9.2.1996 / 22:23:11 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2436
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2437
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2438
addComponent:aComponent withHeight:height 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2439
    "add any component with some given height and full width.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2440
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2441
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2442
    ^ self addComponent:aComponent indent:nil withHeight:height
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2443
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2444
    "Modified: 9.2.1996 / 22:23:15 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2445
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2446
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2447
addFilenameInputFieldOn:aModel in:aDirectory tabable:tabable
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2448
    "create a fileName input field on aModel and add it.
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2449
     Returns the field. This is much like a normal input field,
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2450
     but supports filename completion."
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2451
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2452
    |f|
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2453
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2454
    f := FilenameEditField new.
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2455
    aDirectory notNil ifTrue:[f directory:aDirectory].
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2456
    f model:aModel.
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2457
    self addInputField:f tabable:tabable.
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2458
    ^ f
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2459
!
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2460
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2461
addHelpButtonFor:pathToHelpText 
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2462
    "add a help button to the buttonPanel.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2463
     The argument, pathToHelpText should specify the path to the help
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2464
     text under either the doc/online/<language> or the help/<language>
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2465
     directory."
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2466
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2467
    |helpButton|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2468
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2469
    helpButton := Button label:(resources string:'help').
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2470
    helpButton action:[
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2471
        self withWaitCursorDo:[XtHTML openFullOnHelpFile:pathToHelpText]].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2472
    ^ self addButton:helpButton before:nil.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2473
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2474
    "Created: 17.9.1995 / 20:17:26 / claus"
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2475
    "Modified: 10.2.1996 / 16:47:23 / cg"
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2476
!
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2477
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2478
addHorizontalLine
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2479
    "add a horizontal line as separator"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2480
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2481
    self addComponent:(Separator new extent:1.0 @ 5).
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2482
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2483
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2484
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2485
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2486
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2487
     dialog addTextLabel:'some title string'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2488
     dialog addHorizontalLine.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2489
     dialog addTextLabel:'more text'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2490
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2491
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2492
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2493
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2494
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2495
    "Modified: 9.2.1996 / 21:40:41 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2496
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2497
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2498
addInputField:aField
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2499
    "add an already created input field.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2500
     Returns the field."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2501
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2502
    ^ self addInputField:aField tabable:true
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2503
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2504
    "Modified: 9.2.1996 / 20:46:16 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2505
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2506
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2507
addInputField:aField tabable:tabable
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2508
    "add an already created input field.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2509
     If tabable is true, the field is put into a group, to allow
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2510
     stepping through the fields with #Cursor/#Return keys.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2511
     Returns the field."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2512
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2513
    self addComponent:aField tabable:tabable.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2514
    tabable ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2515
        self addToInputFieldGroup:aField.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2516
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2517
    ^ aField
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2518
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2519
    "Modified: 9.2.1996 / 20:47:28 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2520
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2521
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2522
addInputFieldOn:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2523
    "create an input field on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2524
     Returns the field."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2525
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2526
    ^ self addInputFieldOn:aModel tabable:true
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2527
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2528
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2529
     |dialog model field|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2530
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2531
     model := '' asValue.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2532
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2533
     dialog := DialogBox new.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2534
     (dialog addTextLabel:'enter a string') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2535
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2536
     field := dialog addInputFieldOn:model.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2537
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2538
     dialog addAbortButton; addOkButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2539
     dialog open.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2540
     dialog accepted ifTrue:[Transcript showCr:model value].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2541
    "
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2542
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2543
    "Modified: 9.2.1996 / 21:34:14 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2544
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2545
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2546
addInputFieldOn:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2547
    "create an input field on aModel and add it.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2548
     If tabable is false, the field cannot be tabbed into
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2549
     and return does not close the box.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2550
     (pointer must be moved into it).
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2551
     Returns the field."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2552
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2553
    |f|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2554
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2555
    f := EditField new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2556
    f model:aModel.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2557
    self addInputField:f tabable:tabable.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2558
    ^ f
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2559
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2560
    " a non-tabable field:
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2561
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2562
     |dialog model field|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2563
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2564
     model := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2565
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2566
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2567
     (dialog addTextLabel:'enter a string') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2568
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2569
     field := dialog addInputFieldOn:model tabable:false.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2570
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2571
     dialog addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2572
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2573
     dialog accepted ifTrue:[Transcript showCr:model value].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2574
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2575
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2576
    "Modified: 9.2.1996 / 21:36:16 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2577
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2578
381
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2579
addListBoxOn:aModel
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2580
    "add a selectionInListView to the box"
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2581
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2582
    ^ self addListBoxOn:aModel withNumberOfLines:nil
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2583
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2584
    "
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2585
     |dialog model listView|
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2586
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2587
     model := SelectionInList new.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2588
     model list:#('one' 'two' 'three' 'four').
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2589
     model selectionIndex:2.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2590
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2591
     dialog := DialogBox new.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2592
     (dialog addTextLabel:'select any') adjust:#left.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2593
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2594
     listView := dialog addListBoxOn:model.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2595
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2596
     dialog addAbortButton; addOkButton.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2597
     dialog open.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2598
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2599
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:model selection].
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2600
    "
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2601
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2602
    "Modified: 22.2.1996 / 15:40:54 / cg"
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2603
!
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2604
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2605
addListBoxOn:aModel withNumberOfLines:numLines
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2606
    "add a selectionInListView to the box.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2607
     The list has numLines (if nonNil) number of lines shown."
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2608
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2609
    |l scr h|
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2610
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2611
    l := SelectionInListView new.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2612
    l model:aModel.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2613
    l doubleClickAction:[:name | self okPressed].
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2614
    scr := ScrollableView forView:l.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2615
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2616
    numLines notNil ifTrue:[
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2617
        h := l heightForLines:numLines.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2618
    ] ifFalse:[
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2619
        h := l preferredExtent y
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2620
    ].
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2621
    self addComponent:scr withHeight:h.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2622
    ^ l
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2623
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2624
    "
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2625
     |dialog model listView|
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2626
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2627
     model := SelectionInList new.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2628
     model list:#('one' 'two' 'three' 'four').
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2629
     model selectionIndex:2.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2630
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2631
     dialog := DialogBox new.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2632
     (dialog addTextLabel:'select any') adjust:#left.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2633
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2634
     listView := dialog addListBoxOn:model withNumberOfLines:3.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2635
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2636
     dialog addAbortButton; addOkButton.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2637
     dialog open.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2638
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2639
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:model selection].
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2640
    "
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2641
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2642
    "Created: 22.2.1996 / 15:40:07 / cg"
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2643
    "Modified: 22.2.1996 / 15:41:25 / cg"
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2644
!
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  2645
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2646
addOkButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2647
    "create an okButton - to be sent from redefined initialize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2648
     methods in subclasses or when creating a box programmatically.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2649
     Returns the button."
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
    ^ self addOkButtonLabelled:nil
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2652
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2653
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2654
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2655
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2656
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2657
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2658
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2659
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2660
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2661
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2662
    "Modified: 9.2.1996 / 21:37:02 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2663
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2664
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2665
addOkButton:aButton 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2666
    "add an already created okButton - to be sent from redefined initialize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2667
     methods in subclasses or when creating a box programmatically.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2668
     Returns the button."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2669
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2670
    okButton := aButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2671
    aButton model:self; change:#okPressed.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2672
    ^ self addButton:aButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2673
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2674
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2675
     |dialog b|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2676
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2677
     b := Button label:((Image fromFile:'garfield.gif') magnifiedBy:0.5).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2678
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2679
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2680
     dialog addOkButton:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2681
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2682
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2683
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2684
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2685
    "Modified: 17.9.1995 / 20:20:41 / claus"
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2686
    "Modified: 9.2.1996 / 21:38:48 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2687
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2688
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2689
addOkButtonLabelled:buttonLabel 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2690
    "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
  2691
     methods in subclasses or when creating a box programmatically.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2692
     A nil argument creates one with the default text.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2693
     Returns the button."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2694
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2695
    |aButton|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2696
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2697
    aButton := Button okButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2698
    buttonLabel notNil ifTrue:[aButton label:buttonLabel].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2699
    aButton isReturnButton:acceptReturnAsOK.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2700
    ^ self addOkButton:aButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2701
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2702
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2703
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2704
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2705
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2706
     dialog addOkButtonLabelled:'get out of here'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2707
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2708
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2709
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2710
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2711
    "Modified: 9.2.1996 / 21:39:34 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2712
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2713
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2714
addPopUpList:labelString on:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2715
    "create a popUpList with a label on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2716
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2717
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2718
    ^ self addPopUpList:labelString on:aModel tabable:true
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2719
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2720
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2721
addPopUpList:labelString on:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2722
    "create a popUpList on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2723
     Returns the popUpList."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2724
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2725
    |p box l|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2726
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2727
    p := PopUpList on:aModel.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2728
    p resize; sizeFixed:true.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2729
    labelString notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2730
	box := HorizontalPanelView new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2731
	box borderWidth:0; horizontalLayout:#rightSpace.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2732
	box add:(l := Label label:labelString).
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2733
	l borderWidth:0.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2734
	box add:p.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2735
    ] ifFalse:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2736
	box := p.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2737
    ].        
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2738
    self addComponent:box tabable:tabable tabbedComponent:p.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2739
    ^ p
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2740
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2741
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2742
addPopUpListOn:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2743
    "create a popUpList on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2744
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2745
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2746
    ^ self addPopUpList:nil on:aModel tabable:true
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2747
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2748
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2749
addPopUpListOn:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2750
    "create a popUpList on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2751
     Returns the popUpList."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2752
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2753
    ^ self addPopUpList:nil on:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2754
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2755
130
claus
parents: 128
diff changeset
  2756
addRow:aCol fromX:leftX toX:rightX collect:aBlock
claus
parents: 128
diff changeset
  2757
    "add some elements in a horizontal row.
claus
parents: 128
diff changeset
  2758
     Equally space elements as returned from aBlock.
claus
parents: 128
diff changeset
  2759
     Advance y."
claus
parents: 128
diff changeset
  2760
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2761
    self 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2762
        addRow:aCol 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2763
        fromX:leftX toX:rightX 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2764
        collect:aBlock 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2765
        tabable:true 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2766
        horizontalLayout:#spread 
130
claus
parents: 128
diff changeset
  2767
claus
parents: 128
diff changeset
  2768
    "
claus
parents: 128
diff changeset
  2769
     |dialog|
claus
parents: 128
diff changeset
  2770
claus
parents: 128
diff changeset
  2771
     dialog := Dialog new.
claus
parents: 128
diff changeset
  2772
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2773
        addRow:#('a' 'b' 'c' 'd')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2774
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2775
        toX:1
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2776
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  2777
claus
parents: 128
diff changeset
  2778
     dialog addOkButton.
claus
parents: 128
diff changeset
  2779
     dialog open.
claus
parents: 128
diff changeset
  2780
    "
claus
parents: 128
diff changeset
  2781
claus
parents: 128
diff changeset
  2782
    "
claus
parents: 128
diff changeset
  2783
     |dialog|
claus
parents: 128
diff changeset
  2784
claus
parents: 128
diff changeset
  2785
     dialog := Dialog new.
claus
parents: 128
diff changeset
  2786
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2787
        addRow:#('a1' 'b1' 'c1' 'd1')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2788
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2789
        toX:1 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2790
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  2791
claus
parents: 128
diff changeset
  2792
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2793
        addRow:#('a2' 'b2' 'c2' 'd2')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2794
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2795
        toX:0.5 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2796
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  2797
claus
parents: 128
diff changeset
  2798
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2799
        addRow:#('a3' 'b3' 'c3' 'd3')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2800
        fromX:0.5
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2801
        toX:1 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2802
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  2803
claus
parents: 128
diff changeset
  2804
     dialog addOkButton.
claus
parents: 128
diff changeset
  2805
     dialog open.
claus
parents: 128
diff changeset
  2806
    "
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2807
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2808
    "Modified: 9.2.1996 / 22:25:16 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2809
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2810
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2811
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2812
    "add some elements in a horizontal row.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2813
     Equally space elements as returned from aBlock.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2814
     Advance y."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2815
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2816
    self 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2817
        addRow:aCol 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2818
        fromX:leftX toX:rightX 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2819
        collect:aBlock 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2820
        tabable:tabable 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2821
        horizontalLayout:#spread
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2822
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2823
    "Created: 9.2.1996 / 22:25:35 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2824
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2825
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2826
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable horizontalLayout:hLayout
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2827
    "add some elements in a horizontal row.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2828
     Equally space elements as returned from aBlock.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2829
     Advance y."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2830
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2831
    |helper component|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2832
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2833
    helper := HorizontalPanelView new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2834
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2835
    aCol do:[:el |
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2836
        component := aBlock value:el.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2837
        component resize.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2838
        helper add:component.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2839
        tabable ifTrue:[self makeTabable:component]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2840
    ].    
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2841
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2842
    helper resize.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2843
    self addComponent:helper.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2844
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2845
    width < helper preferredExtent x ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2846
        self width:helper preferredExtent x.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2847
        "/ Transcript show:'w now: '; showCr:helper preferredExtent x
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2848
    ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2849
    helper horizontalLayout:hLayout.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2850
    helper verticalLayout:#fit.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2851
    helper left:leftX asFloat;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2852
           right:rightX asFloat.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2853
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2854
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2855
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2856
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2857
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2858
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2859
        addRow:#('a' 'b' 'c' 'd')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2860
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2861
        toX:1
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2862
        collect:[:label | Label label:label]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2863
        tabable:false
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2864
        horizontalLayout:#fit.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2865
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2866
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2867
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2868
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2869
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2870
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2871
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2872
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2873
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2874
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2875
        addRow:#('one' 'two' 'three' 'four')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2876
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2877
        toX:1
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2878
        collect:[:label | Button label:label]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2879
        tabable:false
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2880
        horizontalLayout:#fit.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2881
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2882
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2883
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2884
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2885
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2886
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2887
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2888
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2889
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2890
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2891
        addRow:#('a1' 'b1' 'c1' 'd1')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2892
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2893
        toX:1 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2894
        collect:[:label | Label label:label].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2895
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2896
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2897
        addRow:#('a2' 'b2' 'c2' 'd2')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2898
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2899
        toX:0.5 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2900
        collect:[:label | Label label:label].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2901
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2902
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2903
        addRow:#('a3' 'b3' 'c3' 'd3')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2904
        fromX:0.5
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2905
        toX:1 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2906
        collect:[:label | Label label:label].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2907
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2908
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2909
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2910
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2911
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2912
    "Created: 9.2.1996 / 22:24:31 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2913
    "Modified: 9.2.1996 / 22:28:14 / cg"
130
claus
parents: 128
diff changeset
  2914
!
claus
parents: 128
diff changeset
  2915
120
claus
parents: 118
diff changeset
  2916
addTextLabel:aString
claus
parents: 118
diff changeset
  2917
    "create a text label - the name has been choosen for ST-80 compatibility;
122
claus
parents: 121
diff changeset
  2918
     however, ST/X labels allow image labels too.
claus
parents: 121
diff changeset
  2919
     Returns the label."
120
claus
parents: 118
diff changeset
  2920
claus
parents: 118
diff changeset
  2921
    |l|
claus
parents: 118
diff changeset
  2922
claus
parents: 118
diff changeset
  2923
    l := Label new label:aString.
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2924
    l borderWidth:0.
120
claus
parents: 118
diff changeset
  2925
    self addComponent:l.
claus
parents: 118
diff changeset
  2926
    ^ l
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2927
120
claus
parents: 118
diff changeset
  2928
    "
claus
parents: 118
diff changeset
  2929
     |b|
claus
parents: 118
diff changeset
  2930
claus
parents: 118
diff changeset
  2931
     b := DialogBox new.
claus
parents: 118
diff changeset
  2932
     b addTextLabel:'hello'.
claus
parents: 118
diff changeset
  2933
     b showAtPointer
claus
parents: 118
diff changeset
  2934
    "
claus
parents: 118
diff changeset
  2935
    "
claus
parents: 118
diff changeset
  2936
     |b|
claus
parents: 118
diff changeset
  2937
claus
parents: 118
diff changeset
  2938
     b := DialogBox new.
claus
parents: 118
diff changeset
  2939
     b leftIndent:100.
claus
parents: 118
diff changeset
  2940
     b addTextLabel:'hello'.
claus
parents: 118
diff changeset
  2941
     b leftIndent:0.
claus
parents: 118
diff changeset
  2942
     b addTextLabel:'world'.
claus
parents: 118
diff changeset
  2943
     b showAtPointer
claus
parents: 118
diff changeset
  2944
    "
claus
parents: 118
diff changeset
  2945
    "
claus
parents: 118
diff changeset
  2946
     |b|
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2947
120
claus
parents: 118
diff changeset
  2948
     b := DialogBox new.
claus
parents: 118
diff changeset
  2949
     b addTextLabel:'hello'.
claus
parents: 118
diff changeset
  2950
     b addTextLabel:'world'.
claus
parents: 118
diff changeset
  2951
     b addOkButton.
claus
parents: 118
diff changeset
  2952
     b showAtPointer
claus
parents: 118
diff changeset
  2953
    "
claus
parents: 118
diff changeset
  2954
    "
claus
parents: 118
diff changeset
  2955
     |b|
claus
parents: 118
diff changeset
  2956
claus
parents: 118
diff changeset
  2957
     b := DialogBox new.
claus
parents: 118
diff changeset
  2958
     b addTextLabel:'hello'.
claus
parents: 118
diff changeset
  2959
     (b addTextLabel:'world') foregroundColor:Color red.
claus
parents: 118
diff changeset
  2960
     b addOkButton.
claus
parents: 118
diff changeset
  2961
     b showAtPointer
claus
parents: 118
diff changeset
  2962
    "
claus
parents: 118
diff changeset
  2963
    "
claus
parents: 118
diff changeset
  2964
     |b|
claus
parents: 118
diff changeset
  2965
claus
parents: 118
diff changeset
  2966
     b := DialogBox new.
claus
parents: 118
diff changeset
  2967
     b addTextLabel:'hello world\\How about this ?' withCRs.
claus
parents: 118
diff changeset
  2968
     b addOkButton.
claus
parents: 118
diff changeset
  2969
     b showAtPointer
claus
parents: 118
diff changeset
  2970
    "
claus
parents: 118
diff changeset
  2971
    "
claus
parents: 118
diff changeset
  2972
     |b|
claus
parents: 118
diff changeset
  2973
claus
parents: 118
diff changeset
  2974
     b := DialogBox new.
claus
parents: 118
diff changeset
  2975
     b addTextLabel:'hello world\\How about this ?' withCRs.
claus
parents: 118
diff changeset
  2976
     b addTextLabel:'not bad'.
claus
parents: 118
diff changeset
  2977
     b addAbortButton.
claus
parents: 118
diff changeset
  2978
     b addOkButton.
claus
parents: 118
diff changeset
  2979
     b showAtPointer
claus
parents: 118
diff changeset
  2980
    "
claus
parents: 118
diff changeset
  2981
!
claus
parents: 118
diff changeset
  2982
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2983
addToInputFieldGroup:aComponentOrSubcomponent
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2984
    "add a component to the input group."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2985
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2986
    inputFieldGroup isNil ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2987
        inputFieldGroup := EnterFieldGroup new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2988
        inputFieldGroup leaveAction:[self lastFieldLeft].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2989
        aComponentOrSubcomponent hasKeyboardFocus:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2990
    ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2991
    inputFieldGroup add:aComponentOrSubcomponent.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2992
    self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2993
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2994
    "Created: 9.2.1996 / 20:23:04 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2995
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2996
122
claus
parents: 121
diff changeset
  2997
addVerticalSpace
claus
parents: 121
diff changeset
  2998
    "add a default vertical space (1 mm)"
claus
parents: 121
diff changeset
  2999
claus
parents: 121
diff changeset
  3000
    self addVerticalSpace:(ViewSpacing).
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3001
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3002
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3003
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3004
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3005
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3006
     dialog addTextLabel:'some title string'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3007
     dialog addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3008
     dialog addTextLabel:'more text'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3009
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3010
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3011
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3012
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3013
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3014
    "Modified: 9.2.1996 / 21:41:10 / cg"
122
claus
parents: 121
diff changeset
  3015
!
claus
parents: 121
diff changeset
  3016
claus
parents: 121
diff changeset
  3017
addVerticalSpace:nPixel
claus
parents: 121
diff changeset
  3018
    "add some pixels of space to the next component"
claus
parents: 121
diff changeset
  3019
claus
parents: 121
diff changeset
  3020
    yPosition := yPosition + nPixel.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3021
    needResize := true.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3022
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3023
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3024
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3025
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3026
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3027
     dialog addTextLabel:'some title string'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3028
     dialog addVerticalSpace:50.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3029
     dialog addTextLabel:'more text'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3030
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3031
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3032
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3033
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3034
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3035
    "Modified: 9.2.1996 / 21:41:23 / cg"
122
claus
parents: 121
diff changeset
  3036
!
claus
parents: 121
diff changeset
  3037
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3038
leftIndent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3039
    "return the current indent 
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3040
     (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
  3041
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3042
    ^ leftIndent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3043
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3044
    "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
  3045
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3046
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3047
leftIndent:aNumber 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3048
    "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
  3049
     will be located)."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3050
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3051
    leftIndent := aNumber.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3052
    needResize := true.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3053
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3054
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3055
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3056
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3057
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3058
     (dialog addTextLabel:'label1') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3059
     dialog leftIndent:20.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3060
     (dialog addTextLabel:'label2') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3061
     dialog leftIndent:40.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3062
     (dialog addTextLabel:'label3') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3063
     dialog leftIndent:60.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3064
     (dialog addTextLabel:'label4') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3065
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3066
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3067
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3068
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3069
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3070
    "Modified: 9.2.1996 / 21:42:20 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3071
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3072
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3073
makeTabable:aComponentOrSubcomponent
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3074
    "add a component (usually a subcomponent, of which the dialog
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3075
     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
  3076
     stepped through via FocusNext/FocusPrevious)"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3077
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3078
    tabableElements isNil ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3079
        tabableElements := OrderedCollection new
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3080
    ].
276
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  3081
    tabableElements add:aComponentOrSubcomponent.
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  3082
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  3083
    (aComponentOrSubcomponent isKindOf:EditField) ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3084
        self addToInputFieldGroup:aComponentOrSubcomponent
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3085
"/        inputFieldGroup isNil ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3086
"/            inputFieldGroup := EnterFieldGroup new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3087
"/            inputFieldGroup leaveAction:[self lastFieldLeft].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3088
"/            aComponentOrSubcomponent hasKeyboardFocus:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3089
"/        ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3090
"/        inputFieldGroup add:aComponentOrSubcomponent.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3091
"/        self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus).
276
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  3092
    ].
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  3093
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3094
    "Modified: 9.2.1996 / 22:03:02 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3095
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3096
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3097
rightIndent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3098
    "return the current right indent."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3099
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3100
    ^ rightIndent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3101
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3102
    "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
  3103
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3104
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3105
rightIndent:aNumber 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3106
    "set the right indent"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3107
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3108
    rightIndent := aNumber.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3109
    needResize := true.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3110
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3111
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3112
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3113
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3114
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3115
     (dialog addTextLabel:'label1') adjust:#right.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3116
     dialog rightIndent:20.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3117
     (dialog addTextLabel:'label2') adjust:#right.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3118
     dialog rightIndent:40.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3119
     (dialog addTextLabel:'label3') adjust:#right.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3120
     dialog rightIndent:60.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3121
     (dialog addTextLabel:'label4') adjust:#right.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3122
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3123
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3124
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3125
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3126
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3127
    "Modified: 9.2.1996 / 21:42:46 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3128
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3129
122
claus
parents: 121
diff changeset
  3130
yPosition 
claus
parents: 121
diff changeset
  3131
    "return the current y position (thats where the next component
claus
parents: 121
diff changeset
  3132
     will be located)."
claus
parents: 121
diff changeset
  3133
claus
parents: 121
diff changeset
  3134
    ^ yPosition 
claus
parents: 121
diff changeset
  3135
!
claus
parents: 121
diff changeset
  3136
claus
parents: 121
diff changeset
  3137
yPosition:aNumber 
claus
parents: 121
diff changeset
  3138
    "set the current y position (thats where the next component
claus
parents: 121
diff changeset
  3139
     will be located)."
claus
parents: 121
diff changeset
  3140
claus
parents: 121
diff changeset
  3141
    yPosition := aNumber.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3142
    needResize := true.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3143
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3144
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3145
     |dialog pos|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3146
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3147
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3148
     pos := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3149
     (dialog addTextLabel:'label1') width:0.5.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3150
     dialog yPosition:pos.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3151
     (dialog addTextLabel:'label2') width:0.5; left:0.5.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3152
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3153
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3154
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3155
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3156
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3157
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3158
     |dialog pos|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3159
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3160
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3161
     pos := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3162
     #('one' 'two' 'three' 'four') 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3163
     with:#(0.0 0.25 0.5 0.75) do:[:lbl :x |
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3164
         dialog yPosition:pos.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3165
        (dialog addComponent:(Button label:lbl) tabable:true)
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3166
                width:0.25; left:x.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3167
     ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3168
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3169
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3170
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3171
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3172
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3173
    "Modified: 9.2.1996 / 21:46:40 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3174
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3175
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3176
!DialogBox methodsFor:'initialization'!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3177
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3178
focusSequence
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3179
    "return the elements through which we can step via 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3180
     NextField/PreviousField keys.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3181
     Here we return all tabable fields followed by all buttons in
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3182
     the panel."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3183
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3184
    |fields buttons|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3185
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3186
    tabableElements isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3187
	fields := #()
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3188
    ] ifFalse:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3189
	fields := tabableElements
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3190
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3191
    buttonPanel notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3192
	buttons := buttonPanel subViews.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3193
	buttons notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3194
	    fields := fields , buttonPanel subViews
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3195
	]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3196
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3197
    ^ fields
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3198
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3199
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3200
initialize
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3201
    |mm|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3202
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3203
    super initialize.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3204
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3205
    label := 'Dialog'.
128
claus
parents: 126
diff changeset
  3206
    acceptValue := false asValue.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3207
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3208
    mm := ViewSpacing.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3209
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3210
    acceptReturnAsOK := true.
125
claus
parents: 122
diff changeset
  3211
    acceptOnLeave := true.
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3212
    hideOnAccept := true.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3213
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3214
    buttonPanel := HorizontalPanelView in:self.
118
claus
parents: 112
diff changeset
  3215
    buttonPanel 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3216
	origin:(0.0 @ 1.0) corner:(1.0 @ 1.0);
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3217
	bottomInset:mm; 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3218
	topInset:(font height + mm * 2) negated;
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3219
	borderWidth:0;
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3220
	horizontalLayout:#spread.
118
claus
parents: 112
diff changeset
  3221
122
claus
parents: 121
diff changeset
  3222
    yPosition := ViewSpacing.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3223
    leftIndent := rightIndent := (ViewSpacing // 2).
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3224
    needResize := true.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3225
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3226
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3227
     |b|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3228
     b := DialogBox new.
118
claus
parents: 112
diff changeset
  3229
     b addAbortButton; 
claus
parents: 112
diff changeset
  3230
       addOkButton; 
claus
parents: 112
diff changeset
  3231
       showAtPointer
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3232
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3233
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3234
     |b|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3235
     b := DialogBox new.
118
claus
parents: 112
diff changeset
  3236
     b addOkButton; 
claus
parents: 112
diff changeset
  3237
       showAtPointer
claus
parents: 112
diff changeset
  3238
    "
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3239
    "
118
claus
parents: 112
diff changeset
  3240
     |b|
claus
parents: 112
diff changeset
  3241
     b := DialogBox new.
claus
parents: 112
diff changeset
  3242
     b addTextLabel:'hello world';
claus
parents: 112
diff changeset
  3243
       addOkButton; 
claus
parents: 112
diff changeset
  3244
       showAtPointer
claus
parents: 112
diff changeset
  3245
    "
claus
parents: 112
diff changeset
  3246
    "
claus
parents: 112
diff changeset
  3247
     |b|
claus
parents: 112
diff changeset
  3248
     b := DialogBox new.
claus
parents: 112
diff changeset
  3249
     b addTextLabel:'hello world';
claus
parents: 112
diff changeset
  3250
       addVerticalSpace:50; 
claus
parents: 112
diff changeset
  3251
       addOkButton; 
claus
parents: 112
diff changeset
  3252
       showAtPointer
claus
parents: 112
diff changeset
  3253
    "
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3254
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3255
    "Modified: 27.1.1996 / 17:21:22 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3256
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3257
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3258
reAdjustGeometry
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3259
    "sent late in snapin processing - gives me a chance
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3260
     to resize for changed font dimensions."
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3261
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3262
    super reAdjustGeometry.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3263
    okButton notNil ifTrue:[okButton resize].
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3264
    abortButton notNil ifTrue:[abortButton resize].
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3265
    self resize
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3266
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3267
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3268
!DialogBox methodsFor:'private'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3269
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3270
basicAddComponent:aComponent 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3271
    "add a component, dont change its size"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3272
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3273
    addedComponents isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3274
	addedComponents := OrderedCollection new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3275
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3276
    addedComponents add:aComponent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3277
    self addSubView:aComponent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3278
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3279
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3280
hideAndEvaluate:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3281
    "if I am modal, make myself invisible and evaluate aBlock.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3282
     If nonModal, stay up, but also evaluate the block."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3283
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3284
    (windowGroup notNil and:[windowGroup isModal]) ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3285
	self hide.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3286
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3287
    aBlock notNil ifTrue:[aBlock value]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3288
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3289
    "Modified: 5.9.1995 / 19:06:33 / claus"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3290
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3291
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3292
realize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3293
    "if any inputFields where added, activate the first one"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3294
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3295
    inputFieldGroup notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3296
	inputFieldGroup activateFirst
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3297
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3298
    super realize
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3299
!
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3300
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3301
resize
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3302
    needResize ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3303
	needResize := false.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3304
	super resize
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3305
    ]
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3306
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3307
    "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
  3308
    "Modified: 27.1.1996 / 18:25:40 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3309
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3310
120
claus
parents: 118
diff changeset
  3311
!DialogBox methodsFor:'queries'!
118
claus
parents: 112
diff changeset
  3312
121
claus
parents: 120
diff changeset
  3313
accepted
128
claus
parents: 126
diff changeset
  3314
    "after the box has closed:
claus
parents: 126
diff changeset
  3315
	 return true if accepted, false if canceled"
125
claus
parents: 122
diff changeset
  3316
128
claus
parents: 126
diff changeset
  3317
    ^ acceptValue value
121
claus
parents: 120
diff changeset
  3318
!
claus
parents: 120
diff changeset
  3319
120
claus
parents: 118
diff changeset
  3320
positionOffset
claus
parents: 118
diff changeset
  3321
    "return the delta, by which the box should be displayed
claus
parents: 118
diff changeset
  3322
     from the mouse pointer. Value returned here makes center of
claus
parents: 118
diff changeset
  3323
     okButton appear under the cursor"
118
claus
parents: 112
diff changeset
  3324
120
claus
parents: 118
diff changeset
  3325
    okButton isNil ifTrue:[
claus
parents: 118
diff changeset
  3326
	^ super positionOffset
118
claus
parents: 112
diff changeset
  3327
    ].
120
claus
parents: 118
diff changeset
  3328
    buttonPanel setChildPositionsIfChanged.
claus
parents: 118
diff changeset
  3329
    ^ (okButton originRelativeTo:self) + (okButton extent // 2)
118
claus
parents: 112
diff changeset
  3330
!
claus
parents: 112
diff changeset
  3331
130
claus
parents: 128
diff changeset
  3332
preferredExtent 
132
claus
parents: 131
diff changeset
  3333
    "return my preferred extent.
claus
parents: 131
diff changeset
  3334
     That is the max component width, or my current width (default);
claus
parents: 131
diff changeset
  3335
     whichever is larger, by the sum of the components heights."
118
claus
parents: 112
diff changeset
  3336
120
claus
parents: 118
diff changeset
  3337
    |w h p|
118
claus
parents: 112
diff changeset
  3338
120
claus
parents: 118
diff changeset
  3339
    addedComponents notNil ifTrue:[
354
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3340
        w := addedComponents 
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3341
                inject:0 
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3342
                into:[:max :element |
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3343
                        |eExt prefX scale rel relX|
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3344
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3345
                        prefX := element preferredExtent x.
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3346
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3347
                        "/ special (for your convenience)
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3348
                        "/ if the element has been added with a relative width,
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3349
                        "/ scale it to get at least its preferred width
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3350
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3351
                        (rel := element relativeExtent) notNil ifTrue:[
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3352
                            relX := rel x.
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3353
                            (relX isNil or:[relX isInteger]) ifFalse:[
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3354
                                prefX := (prefX * (1 / relX)) rounded
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3355
                            ].
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3356
                        ].
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3357
                        eExt := prefX + (element borderWidth * 2). "/ max:element extent x.
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3358
                        max max:(eExt + element leftInset + element rightInset)].
120
claus
parents: 118
diff changeset
  3359
    ] ifFalse:[
354
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3360
        w := super preferredExtent x.
120
claus
parents: 118
diff changeset
  3361
    ].
132
claus
parents: 131
diff changeset
  3362
    w := w max:width.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3363
    h := yPosition + ViewSpacing.
118
claus
parents: 112
diff changeset
  3364
130
claus
parents: 128
diff changeset
  3365
    buttonPanel subViews size ~~ 0 ifTrue:[
354
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3366
        p := buttonPanel preferredExtent.
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3367
        w := w max:p x.
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3368
        h := h
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3369
             + p y
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3370
             + ViewSpacing.
120
claus
parents: 118
diff changeset
  3371
    ].
118
claus
parents: 112
diff changeset
  3372
120
claus
parents: 118
diff changeset
  3373
"/    okButton isNil ifTrue:[
130
claus
parents: 128
diff changeset
  3374
"/        ^ super preferredExtent
120
claus
parents: 118
diff changeset
  3375
"/    ].
130
claus
parents: 128
diff changeset
  3376
"/    p := buttonPanel preferredExtent.
120
claus
parents: 118
diff changeset
  3377
"/    w := p x.
claus
parents: 118
diff changeset
  3378
"/    h := ViewSpacing
claus
parents: 118
diff changeset
  3379
"/         + p y
claus
parents: 118
diff changeset
  3380
"/         + ViewSpacing.
claus
parents: 118
diff changeset
  3381
"/
claus
parents: 118
diff changeset
  3382
    ^ w @ h
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3383
354
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  3384
    "Modified: 9.2.1996 / 19:44:46 / cg"
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3385
! !
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3386
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3387
!DialogBox methodsFor:'special geometry settings'!
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3388
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3389
stickAtBottomWithFixHeight:aComponent
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3390
    "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
  3391
     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
  3392
     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
  3393
     (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
  3394
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3395
    self resize.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3396
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3397
    aComponent
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3398
	topInset:(self height - aComponent top) negated;
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3399
	bottomInset:(self height - aComponent bottom); 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3400
	origin:0.0 @ 1.0; corner:1.0 @ 1.0.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3401
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3402
    "
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3403
     compare the resizing behavior of:
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3404
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3405
	|box|
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3406
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3407
	box := Dialog new.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3408
	box addTextLabel:'hello'.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3409
	box addTextLabel:'hello2'.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3410
	box addOkButton.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3411
	box show
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3412
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3413
     with:
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3414
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3415
	|box l2|
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3416
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3417
	box := Dialog new.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3418
	box addTextLabel:'hello'.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3419
	l2 := box addTextLabel:'hello2'.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3420
	box addOkButton.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3421
	box stickAtBottomWithFixHeight:l2.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3422
	box show
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3423
   "
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3424
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3425
    "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
  3426
    "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
  3427
!
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3428
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3429
stickAtBottomWithVariableHeight:aComponent
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3430
    "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
  3431
     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
  3432
     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
  3433
     and the bottom.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3434
     (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
  3435
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3436
    self resize.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3437
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3438
    aComponent
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3439
	bottomInset:(self height - aComponent bottom); 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3440
	corner:1.0@1.0.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3441
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3442
    "
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3443
     compare the resizing behavior of:
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3444
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3445
	|box|
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3446
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3447
	box := Dialog new.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3448
	box addTextLabel:'hello'.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3449
	(box addComponent:(SelectionInListView new)) level:-1.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3450
	box addOkButton.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3451
	box show
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3452
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3453
     with:
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3454
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3455
	|box list|
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3456
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3457
	box := Dialog new.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3458
	box addTextLabel:'hello'.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3459
	list := (box addComponent:(SelectionInListView new)) level:-1.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3460
	box addOkButton.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3461
	box stickAtBottomWithVariableHeight:list.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3462
	box show
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3463
   "
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3464
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3465
    "Modified: 27.1.1996 / 18:27:36 / cg"
118
claus
parents: 112
diff changeset
  3466
! !
claus
parents: 112
diff changeset
  3467
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3468
!DialogBox methodsFor:'user actions'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3469
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3470
abortPressed
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3471
    "sent by the cancel button; user pressed abort button
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3472
     - hide myself and evaluate okAction"
121
claus
parents: 120
diff changeset
  3473
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3474
    abortButton turnOffWithoutRedraw.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3475
    acceptValue value:false.
121
claus
parents: 120
diff changeset
  3476
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3477
    "/ actually, only hides if I have been opened modal
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3478
    self hideAndEvaluate:abortAction
121
claus
parents: 120
diff changeset
  3479
!
claus
parents: 120
diff changeset
  3480
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3481
doAccept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3482
    "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
  3483
     then set my accept value to true.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3484
     This is confusing: this method was originally called #accept,
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3485
     but renamed for compatibility with ST-80, where #accept returns the
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3486
     accept-valueHolder (which looks like a bad name to me ...)."
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3487
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3488
    addedComponents notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3489
	addedComponents do:[:aComponent |
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3490
	    (aComponent respondsTo:#accept) ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3491
		 aComponent accept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3492
	    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3493
	].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3494
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3495
    acceptValue value:true.
128
claus
parents: 126
diff changeset
  3496
!
claus
parents: 126
diff changeset
  3497
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3498
keyPress:aKey x:x y:y
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3499
    "return-key dublicates ok-function if acceptReturnAsOK is true"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3500
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
  3501
    (aKey == #Return) ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3502
	(okButton notNil and:[okButton isReturnButton]) ifTrue:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3503
	    ^ self okPressed
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3504
	].
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3505
	(abortButton notNil and:[abortButton isReturnButton]) ifTrue:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3506
	    ^ self abortPressed
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3507
	].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3508
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3509
    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
  3510
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  3511
    "Modified: 27.1.1996 / 14:23:16 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3512
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3513
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3514
lastFieldLeft
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3515
    "if the dialog involves input fields, this is called
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3516
     when the last field is left by Return-key or NextField-key"
120
claus
parents: 118
diff changeset
  3517
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3518
    acceptOnLeave ifTrue:[
357
732f59def851 care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
  3519
        acceptReturnAsOK ifTrue:[
732f59def851 care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
  3520
            acceptValue value:true. 
732f59def851 care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
  3521
            self okPressed
732f59def851 care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
  3522
        ]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3523
    ].
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3524
    inputFieldGroup activateFirst
357
732f59def851 care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
  3525
732f59def851 care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
  3526
    "Modified: 11.2.1996 / 11:17:56 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3527
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3528
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3529
okPressed
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3530
    "sent by the okButton; user pressed ok-button
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3531
     - make myself invisible and if an action was specified do it"
128
claus
parents: 126
diff changeset
  3532
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3533
    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
  3534
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3535
    self doAccept.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3536
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3537
    acceptCheck notNil ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  3538
	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
  3539
    ].
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3540
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3541
    hideOnAccept ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  3542
	"/ actually, only hides if I have been opened modal
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  3543
	self hideAndEvaluate:okAction.
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3544
    ] ifFalse:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  3545
	okAction value
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3546
    ]
128
claus
parents: 126
diff changeset
  3547
! !
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  3548
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  3549
!DialogBox class methodsFor:'documentation'!
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  3550
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  3551
version
423
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  3552
    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.48 1996-02-28 14:20:07 cg Exp $'
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  3553
! !