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