DialogBox.st
author Claus Gittinger <cg@exept.de>
Fri, 19 Apr 1996 19:01:08 +0200
changeset 557 1fbfacd0fed1
parent 552 0e9be94135ab
child 558 907a0365d06a
permissions -rw-r--r--
suppress scrollBar in choose if there is nothing to scroll
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
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
    17
		tabableElements hideOnAccept acceptCheck needResize autoAccept
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
    18
		focusToOKOnLeave'
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    19
	classVariableNames:''
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    20
	poolDictionaries:''
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    21
	category:'Views-DialogBoxes'
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
    22
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
    23
81e3409404d2 Initial revision
claus
parents:
diff changeset
    24
!DialogBox class methodsFor:'documentation'!
81e3409404d2 Initial revision
claus
parents:
diff changeset
    25
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    26
copyright
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    27
"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    28
 COPYRIGHT (c) 1994 by Claus Gittinger
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    29
	      All Rights Reserved
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    30
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    31
 This software is furnished under a license and may be used
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    32
 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
    33
 inclusion of the above copyright notice.   This software may not
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    34
 be provided or otherwise made available to, or used by, any
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    35
 other person.  No title to or ownership of the software is
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    36
 hereby transferred.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
    37
"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
    38
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
    39
81e3409404d2 Initial revision
claus
parents:
diff changeset
    40
documentation
81e3409404d2 Initial revision
claus
parents:
diff changeset
    41
"
81e3409404d2 Initial revision
claus
parents:
diff changeset
    42
    this class implements the common behavior of dialogboxes.
81e3409404d2 Initial revision
claus
parents:
diff changeset
    43
81e3409404d2 Initial revision
claus
parents:
diff changeset
    44
    DialogBox is an (abstract) superclass of many other boxes - see InfoBox,
81e3409404d2 Initial revision
claus
parents:
diff changeset
    45
    WarningBox, YesNoBox etc. for concrete examples.
81e3409404d2 Initial revision
claus
parents:
diff changeset
    46
    Most of them simply add buttons or other elements.
81e3409404d2 Initial revision
claus
parents:
diff changeset
    47
121
claus
parents: 120
diff changeset
    48
    For programmatically created boxes, instances support adding of components
claus
parents: 120
diff changeset
    49
    in a top-to-bottom fashion, and also keep track of added text-fields and,
claus
parents: 120
diff changeset
    50
    since they are most common, automatically create an EnterFieldGroup for
claus
parents: 120
diff changeset
    51
    them.
122
claus
parents: 121
diff changeset
    52
    Caveat: more adding support is required - especially for row-wise
claus
parents: 121
diff changeset
    53
    construction.
claus
parents: 121
diff changeset
    54
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    55
    Historic note:
356
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    56
        originally, ST/X had separate classes for the various entry methods;
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    57
        there were YesNoBox, EnterBox, InfoBox and so on.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    58
        ST-80 has all this defined in the common Dialog.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    59
        Therefore, for compatibility, many ST/X methods defined here in Dialogs 
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    60
        class protocol simply dispatch to some other boxes class method.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    61
        In the future, those existing subclasses' functionality is going to
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    62
        be moved full into Dialog, and the subclasses will be replaced by dummy
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    63
        delegators. (They will be kept for backward compatibility, though).
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    64
121
claus
parents: 120
diff changeset
    65
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
    66
    instance variables:
81e3409404d2 Initial revision
claus
parents:
diff changeset
    67
356
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    68
        buttonPanel      <PanelView>    contains the button(s)
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    69
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    70
        okButton         <Button>       the ok-Button
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    71
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    72
        okAction         <Block>        the action to be performed when ok is pressed,
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    73
                                        or return is pressed.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    74
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    75
        acceptReturnAsOK <Boolean>      if true, pressing the return-key counts
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    76
                                        as if ok was pressed. Default is true.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    77
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    78
        abortButton      <Button>       the cancel-Button
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    79
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    80
        abortAction      <Block>        the action to be performed when cancel is
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    81
                                        pressed.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    82
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    83
        yPosisition      <Integer>      current y position when adding components
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    84
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    85
        leftIndent       <Integer>      left inset to use when adding components
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    86
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    87
        rightIndent      <Integer>      right inset to use when adding components
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    88
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    89
        addedComponents  <Collection>   programmatically added components
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    90
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    91
        inputFieldGroup  <EnterFieldGroup>   
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    92
                                        for added input fields
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    93
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    94
        acceptOnLeave    <Boolean>      if true (the default) and there are 
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    95
                                        tabable inputFields, accept and close when
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    96
                                        the last field is left. If false, the ok
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    97
                                        button must be pressed to close the box.
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    98
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
    99
        acceptedValue    v(<Boolean>)   valueHolder on a boolean
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   100
                                        after close: holds true if box was accepted
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   101
                                        (i.e. ok-Button was pressed), false if box was
5f20a808ff76 commentary
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   102
                                        closed via cancel or window manager.
121
claus
parents: 120
diff changeset
   103
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
   104
        autoAccept       Boolean        if true, pressing ok (or return)
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
   105
                                        sends #accept to all subcomponents.
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
   106
                                        I.e. all subfields update their models
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
   107
                                        first. The default is true.
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
   108
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   109
    For compatibility with ST-80, this class is also available under
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   110
    the global names DialogView and Dialog (see patches file).
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   111
"
81e3409404d2 Initial revision
claus
parents:
diff changeset
   112
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
   113
81e3409404d2 Initial revision
claus
parents:
diff changeset
   114
examples
81e3409404d2 Initial revision
claus
parents:
diff changeset
   115
"
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   116
    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
   117
    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
   118
    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
   119
    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
   120
125
claus
parents: 122
diff changeset
   121
    For most simple standard dialogs, there are ready to use
claus
parents: 122
diff changeset
   122
    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
   123
125
claus
parents: 122
diff changeset
   124
    For example:
claus
parents: 122
diff changeset
   125
claus
parents: 122
diff changeset
   126
      info & warnings:
claus
parents: 122
diff changeset
   127
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   128
        Dialog information:'hi there'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   129
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   130
        Dialog warn:'oops'
125
claus
parents: 122
diff changeset
   131
claus
parents: 122
diff changeset
   132
claus
parents: 122
diff changeset
   133
      yes/no questions:
claus
parents: 122
diff changeset
   134
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   135
        (Dialog confirm:'is this simple ?')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   136
        ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   137
            Transcript showCr:'thats what I expected'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   138
        ] ifFalse:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   139
            Transcript showCr:'read more examples and documentation'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   140
        ]
125
claus
parents: 122
diff changeset
   141
claus
parents: 122
diff changeset
   142
claus
parents: 122
diff changeset
   143
      yes/no question with cancel option:
claus
parents: 122
diff changeset
   144
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   145
        |answer|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   146
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   147
        answer := Dialog confirmWithCancel:'is this simple ?'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   148
        answer isNil ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   149
            Transcript showCr:'no easy decision'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   150
        ] ifFalse:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   151
            answer ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   152
                Transcript showCr:'thats what I expected'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   153
            ] ifFalse:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   154
                Transcript showCr:'read more examples and documentation'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   155
            ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   156
        ]
125
claus
parents: 122
diff changeset
   157
claus
parents: 122
diff changeset
   158
claus
parents: 122
diff changeset
   159
      asking for a string:
claus
parents: 122
diff changeset
   160
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   161
        |s|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   162
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   163
        s := Dialog request:'enter your name, please:'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   164
        s notEmpty ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   165
            Transcript showCr:'you entered: ' , s.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   166
        ]
125
claus
parents: 122
diff changeset
   167
claus
parents: 122
diff changeset
   168
claus
parents: 122
diff changeset
   169
      asking for a string with given default:
claus
parents: 122
diff changeset
   170
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   171
        |s|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   172
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   173
        s := Dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   174
                request:'enter your name, please:'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   175
                initialAnswer:(OperatingSystem getLoginName).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   176
        s notEmpty ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   177
            Transcript showCr:'you entered: ' , s.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   178
        ]
125
claus
parents: 122
diff changeset
   179
claus
parents: 122
diff changeset
   180
claus
parents: 122
diff changeset
   181
      asking for a filename:
claus
parents: 122
diff changeset
   182
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   183
        |s|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   184
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   185
        s := Dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   186
                requestFileName:'select a file, please:'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   187
                default:''.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   188
        Transcript show:'you entered: '; showCr:s.
125
claus
parents: 122
diff changeset
   189
claus
parents: 122
diff changeset
   190
claus
parents: 122
diff changeset
   191
      with changed button label and pattern:
claus
parents: 122
diff changeset
   192
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   193
        |s|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   194
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   195
        s := Dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   196
                requestFileName:'select a file, please:'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   197
                default:''
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   198
                ok:'show'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   199
                abort:'cancel'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   200
                pattern:'*.rc'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   201
        Transcript show:'you entered: '; showCr:s.
125
claus
parents: 122
diff changeset
   202
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   203
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   204
      asking for a password:
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   205
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   206
        |s|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   207
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   208
        s := Dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   209
                requestPassword:'enter your secret, please:'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   210
        Transcript show:'you entered: '; showCr:s.
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   211
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   212
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   213
118
claus
parents: 112
diff changeset
   214
    However, you can construct dialogs programmatically, as shown in
claus
parents: 112
diff changeset
   215
    the following examples:
91
e8db16616e97 *** empty log message ***
claus
parents: 76
diff changeset
   216
121
claus
parents: 120
diff changeset
   217
    basic (unusable) example:
claus
parents: 120
diff changeset
   218
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   219
        DialogBox new open
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   220
121
claus
parents: 120
diff changeset
   221
    still unusable - only an ok-button:
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   222
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   223
        DialogBox new addOkButton; open
121
claus
parents: 120
diff changeset
   224
claus
parents: 120
diff changeset
   225
    both ok- and abortButtons:
118
claus
parents: 112
diff changeset
   226
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   227
        DialogBox new addAbortButton; addOkButton; open
121
claus
parents: 120
diff changeset
   228
122
claus
parents: 121
diff changeset
   229
    with different ok-label:
claus
parents: 121
diff changeset
   230
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   231
        DialogBox new addAbortButton; addOkButtonLabelled:'yeah'; open
122
claus
parents: 121
diff changeset
   232
121
claus
parents: 120
diff changeset
   233
    adding a textlabel gives an infoBox:
120
claus
parents: 118
diff changeset
   234
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   235
        DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   236
            addTextLabel:'hello';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   237
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   238
            open
121
claus
parents: 120
diff changeset
   239
claus
parents: 120
diff changeset
   240
    a textlabel with abort- and okButton gives a yesNoBox:
118
claus
parents: 112
diff changeset
   241
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   242
        DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   243
            addTextLabel:'hello';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   244
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   245
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   246
            open
121
claus
parents: 120
diff changeset
   247
claus
parents: 120
diff changeset
   248
    the same, adjusting the labels contents to the left:
claus
parents: 120
diff changeset
   249
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   250
        |box|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   251
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   252
        box := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   253
        (box addTextLabel:'hello') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   254
        box addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   255
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   256
            open
121
claus
parents: 120
diff changeset
   257
122
claus
parents: 121
diff changeset
   258
    with modified buttons:
claus
parents: 121
diff changeset
   259
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   260
        |box|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   261
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   262
        box := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   263
        (box addTextLabel:'are you certain ?') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   264
        box addAbortButtonLabelled:'not really'. 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   265
        (box addOkButtonLabelled:'yes, absolutely') 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   266
                activeBackgroundColor:Color red. 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   267
        box open
122
claus
parents: 121
diff changeset
   268
claus
parents: 121
diff changeset
   269
162
claus
parents: 157
diff changeset
   270
    mswindows style:
claus
parents: 157
diff changeset
   271
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   272
        |b box|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   273
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   274
        box := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   275
        (box addTextLabel:'are you certain ?') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   276
        b := Button new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   277
        b activeLogo:(Image fromFile:'bitmaps/cancel_down.bmp').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   278
        b passiveLogo:(Image fromFile:'bitmaps/cancel_up.bmp').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   279
        b focusLogo:(Image fromFile:'bitmaps/cancel_focus.bmp').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   280
        b beImageButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   281
        box addAbortButton:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   282
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   283
        b := Button new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   284
        b activeLogo:(Image fromFile:'bitmaps/ok_down.bmp').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   285
        b passiveLogo:(Image fromFile:'bitmaps/ok_up.bmp').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   286
        b focusLogo:(Image fromFile:'bitmaps/ok_focus.bmp').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   287
        b beImageButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   288
        box addOkButton:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   289
        box open
162
claus
parents: 157
diff changeset
   290
claus
parents: 157
diff changeset
   291
121
claus
parents: 120
diff changeset
   292
    two textlabels:
118
claus
parents: 112
diff changeset
   293
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   294
        DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   295
            addTextLabel:'hello';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   296
            addTextLabel:'world';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   297
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   298
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   299
            open
118
claus
parents: 112
diff changeset
   300
121
claus
parents: 120
diff changeset
   301
    fixing the dialogs size (suppres it calculating its size from the
130
claus
parents: 128
diff changeset
   302
    preferredExtents of its components):
118
claus
parents: 112
diff changeset
   303
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   304
        DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   305
            label:'a simple dialog';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   306
            addTextLabel:'hello';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   307
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   308
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   309
            extent:200@200;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   310
            sizeFixed:true;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   311
            open
118
claus
parents: 112
diff changeset
   312
121
claus
parents: 120
diff changeset
   313
    asking the box if it was closed via ok:
118
claus
parents: 112
diff changeset
   314
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   315
        (DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   316
            label:'a simple dialog';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   317
            addTextLabel:'hello';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   318
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   319
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   320
            extent:200@200;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   321
            sizeFixed:true;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   322
            open
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   323
        ) accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   324
            Transcript showCr:'yes'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   325
        ] ifFalse:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   326
            Transcript showCr:'no'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   327
        ]
118
claus
parents: 112
diff changeset
   328
121
claus
parents: 120
diff changeset
   329
    textLabels are not limited to strings (although, the name which is
claus
parents: 120
diff changeset
   330
    used for ST-80 compatibility, suggests it):
118
claus
parents: 112
diff changeset
   331
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   332
        DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   333
            addTextLabel:(Image fromFile:'bitmaps/garfield.gif');
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   334
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   335
            open
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   336
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   337
        DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   338
            addTextLabel:'hello';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   339
            addTextLabel:((Image fromFile:'bitmaps/garfield.gif')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   340
                                magnifiedTo:200@150);
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   341
            addTextLabel:'world';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   342
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   343
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   344
            open
120
claus
parents: 118
diff changeset
   345
121
claus
parents: 120
diff changeset
   346
    adding an input field (on a string model):
claus
parents: 120
diff changeset
   347
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   348
        |stringModel|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   349
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   350
        stringModel := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   351
        (DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   352
            addTextLabel:'Please enter a string:';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   353
            addInputFieldOn:stringModel; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   354
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   355
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   356
            open
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   357
        ) accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   358
            Transcript showCr:'entered: ', stringModel value
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   359
        ]
120
claus
parents: 118
diff changeset
   360
claus
parents: 118
diff changeset
   361
121
claus
parents: 120
diff changeset
   362
    multiple input fields (notice, that the dialog connects the fields
claus
parents: 120
diff changeset
   363
    in a group, so stepping is allowed via Cursor and Return keys):
claus
parents: 120
diff changeset
   364
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   365
        |firstName lastName|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   366
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   367
        firstName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   368
        lastName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   369
        (DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   370
            addTextLabel:'Please enter your name:';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   371
            addInputFieldOn:firstName; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   372
            addVerticalSpace;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   373
            addInputFieldOn:lastName; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   374
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   375
            addOkButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   376
            open
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   377
        ) accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   378
            Transcript showCr:'entered: ', firstName value , ' ' , lastName value
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   379
        ]
121
claus
parents: 120
diff changeset
   380
claus
parents: 120
diff changeset
   381
claus
parents: 120
diff changeset
   382
    of course, the model may contain a value initially:
claus
parents: 120
diff changeset
   383
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   384
        |firstName lastName p line i name|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   385
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   386
        firstName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   387
        lastName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   388
        p := PipeStream readingFrom:'finger ' , OperatingSystem getLoginName.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   389
        p notNil ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   390
            line := p nextLine.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   391
            (i := line findString:'Name:') ~~ 0 ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   392
                name := line copyFrom:(i + 'Name:' size).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   393
            ] ifFalse:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   394
                (i := line findString:'real life:') == 0 ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   395
                    line := p nextLine.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   396
                ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   397
                (i := line findString:'real life:') ~~ 0 ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   398
                    name := line copyFrom:(i + 'real life:' size).
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
            ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   401
            name notNil ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   402
                firstName value: name asCollectionOfWords first.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   403
                lastName  value: name asCollectionOfWords last.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   404
                Transcript showCr:'initially ' , firstName value , ' ' , lastName value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   405
            ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   406
            p close.
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
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   409
        (DialogBox new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   410
            addTextLabel:'Please enter your name:';
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   411
            addInputFieldOn:firstName; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   412
            addVerticalSpace;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   413
            addInputFieldOn:lastName; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   414
            addAbortButton; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   415
            addOkButton;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   416
            open
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   417
        ) accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   418
            Transcript showCr:'entered: ', firstName value , ' ' , lastName value
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   419
        ]
121
claus
parents: 120
diff changeset
   420
120
claus
parents: 118
diff changeset
   421
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   422
    validated password entry:
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   423
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   424
        |box firstEntry secondEntry|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   425
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   426
        firstEntry := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   427
        secondEntry := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   428
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   429
        box := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   430
        (box addTextLabel:'Please enter your secret:') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   431
        (box addInputFieldOn:firstEntry) passwordCharacter:$*. 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   432
        box addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   433
        (box addInputFieldOn:secondEntry) passwordCharacter:$*. 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   434
        box addAbortButton. 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   435
        box addOkButton. 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   436
        box open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   437
        box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   438
            firstEntry value ~= secondEntry value ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   439
                Transcript showCr:'wrong input - try again'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   440
            ] ifFalse:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   441
                Transcript showCr:'entered: ', firstEntry value
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   442
            ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   443
        ]
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   444
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   445
121
claus
parents: 120
diff changeset
   446
   constructing a dialog from other elements:
claus
parents: 120
diff changeset
   447
claus
parents: 120
diff changeset
   448
     adding a fileSelectionList:
claus
parents: 120
diff changeset
   449
     (since the dialog adds the component with its preferred extent,
claus
parents: 120
diff changeset
   450
      ignoring the 300-height, this looks ugly ... 
claus
parents: 120
diff changeset
   451
      ... especially when resized vertically)
claus
parents: 120
diff changeset
   452
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   453
        |top l scr fileName|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   454
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   455
        fileName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   456
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   457
        top := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   458
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   459
        l := FileSelectionList new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   460
        l useIndex:false.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   461
        l doubleClickAction:[:name | top okPressed].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   462
        l action:[:name | fileName value:name].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   463
        scr := ScrollableView forView:l.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   464
        scr extent:(1.0 @ 300).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   465
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   466
        top addComponent:scr.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   467
        top addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   468
        top openModal.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   469
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   470
        top accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   471
            Transcript show:'fileName: '; showCr:fileName value storeString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   472
        ]
121
claus
parents: 120
diff changeset
   473
claus
parents: 120
diff changeset
   474
    same, looks better, since the height is made larger (not using 
claus
parents: 120
diff changeset
   475
    fileLists preferredExtent):
claus
parents: 120
diff changeset
   476
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   477
        |top l scr fileName|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   478
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   479
        fileName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   480
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   481
        top := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   482
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   483
        l := FileSelectionList new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   484
        l useIndex:false.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   485
        l doubleClickAction:[:name | top okPressed].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   486
        l action:[:name | fileName value:name].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   487
        scr := ScrollableView forView:l.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   488
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   489
        top addComponent:scr withExtent:300@300.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   490
        top addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   491
        top openModal.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   492
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   493
        top accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   494
            Transcript show:'fileName: '; showCr:fileName value storeString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   495
        ]
121
claus
parents: 120
diff changeset
   496
claus
parents: 120
diff changeset
   497
claus
parents: 120
diff changeset
   498
    again, setting the boxes initial size and fixing it
130
claus
parents: 128
diff changeset
   499
    (let it ignore the components' preferredExtent):
121
claus
parents: 120
diff changeset
   500
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   501
        |top fixFrame l scr fileName|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   502
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   503
        fileName := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   504
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   505
        top := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   506
        top extent:300@300.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   507
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   508
        fixFrame := View new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   509
        fixFrame extent:(1.0 @ 300).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   510
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   511
        l := FileSelectionList new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   512
        l useIndex:false.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   513
        l doubleClickAction:[:name | top okPressed].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   514
        l action:[:name | fileName value:name].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   515
        scr := ScrollableView forView:l.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   516
        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
   517
        fixFrame add:scr.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   518
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   519
        top addComponent:fixFrame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   520
        top addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   521
        top openModal.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   522
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   523
        top accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   524
            Transcript show:'fileName: '; showCr:fileName value storeString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   525
        ]
118
claus
parents: 112
diff changeset
   526
claus
parents: 112
diff changeset
   527
claus
parents: 112
diff changeset
   528
   adding a panel with checkBoxes:
claus
parents: 112
diff changeset
   529
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   530
        |top panel b value1 value2 value3 value4|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   531
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   532
        value1 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   533
        value2 := false asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   534
        value3 := false asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   535
        value4 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   536
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   537
        top := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   538
        top extent:200@300.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   539
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   540
        panel := VerticalPanelView new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   541
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   542
        b := CheckBox on:value1. b label:'check1'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   543
        panel addSubView:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   544
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   545
        b := CheckBox on:value2. b label:'check2'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   546
        panel addSubView:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   547
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   548
        b := CheckBox on:value3. b label:'check3'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   549
        panel addSubView:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   550
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   551
        b := CheckBox on:value4. b label:'check4'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   552
        panel addSubView:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   553
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   554
        top addComponent:panel.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   555
        top addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   556
        top open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   557
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   558
        top accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   559
            Transcript show:'value1: '; showCr:value1 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   560
            Transcript show:'value2: '; showCr:value2 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   561
            Transcript show:'value3: '; showCr:value3 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   562
            Transcript show:'value4: '; showCr:value4 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   563
        ]
118
claus
parents: 112
diff changeset
   564
120
claus
parents: 118
diff changeset
   565
   same, using a more convenient interface:
claus
parents: 118
diff changeset
   566
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   567
        |box value1 value2 value3 value4|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   568
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   569
        value1 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   570
        value2 := false asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   571
        value3 := false asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   572
        value4 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   573
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   574
        box := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   575
        box extent:200@300.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   576
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   577
        box addCheckBox:'check1' on:value1.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   578
        box addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   579
        box addCheckBox:'check2' on:value2.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   580
        box addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   581
        box addCheckBox:'check3' on:value3.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   582
        box addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   583
        box addCheckBox:'check4' on:value4.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   584
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   585
        box addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   586
        box open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   587
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   588
        box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   589
            Transcript show:'value1: '; showCr:value1 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   590
            Transcript show:'value2: '; showCr:value2 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   591
            Transcript show:'value3: '; showCr:value3 value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   592
            Transcript show:'value4: '; showCr:value4 value.
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
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   596
    same, using an even better interface:
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   597
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   598
        |box values labels|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   599
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   600
        values := #(true false false true) collect:[:val | val asValue].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   601
        labels := #('check1' 'check2' 'check3' 'check4').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   602
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   603
        box := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   604
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   605
        box
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   606
           addColumn:(1 to:labels size)
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   607
           fromX:0.0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   608
           toX:1.0 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   609
           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
   610
           tabable:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   611
        
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   612
        box addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   613
        box open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   614
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   615
        box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   616
           values with:labels do:[:val :lbl |
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   617
              Transcript show:(lbl , ': '); showCr:val value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   618
           ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   619
        ]
126
claus
parents: 125
diff changeset
   620
claus
parents: 125
diff changeset
   621
164
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   622
    adding two panels in a frame:
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   623
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   624
        |box frame vPanel1 vPanel2 m1 m2 m3 m4 chk ef|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   625
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   626
        box := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   627
        box label:'example'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   628
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   629
        frame := FramedBox label:'frame'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   630
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   631
        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
   632
        vPanel1 horizontalLayout:#leftSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   633
        vPanel1 verticalLayout:#top.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   634
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   635
        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
   636
        vPanel2 horizontalLayout:#leftSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   637
        vPanel2 verticalLayout:#top.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   638
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   639
        m1 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   640
        m2 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   641
        m3 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   642
        m4 := 'hello' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   643
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   644
        vPanel1 add:(Label label:'check1').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   645
        vPanel1 add:(Label label:'m2').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   646
        vPanel1 add:(Label label:'m3').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   647
        vPanel1 add:(Label label:'enter').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   648
        vPanel1 add:(Label label:'lbl1').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   649
        vPanel1 add:(Label label:'lbl2').
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   650
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   651
        vPanel2 add:(chk := CheckToggle on:m1). 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   652
        box makeTabable:chk.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   653
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   654
        vPanel2 add:(chk := CheckToggle on:m2). 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   655
        box makeTabable:chk.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   656
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   657
        vPanel2 add:(chk := CheckToggle on:m3). 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   658
        box makeTabable:chk.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   659
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   660
        vPanel2 add:(chk := CheckToggle on:m3). 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   661
        box makeTabable:chk.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   662
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   663
        vPanel2 add:(chk := CheckToggle on:m3). 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   664
        box makeTabable:chk.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   665
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   666
        vPanel2 add:(ef := EditField on:m4). 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   667
        ef immediateAccept:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   668
        box makeTabable:ef.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   669
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   670
        box addComponent:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   671
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   672
        box addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   673
        box openModal.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   674
        box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   675
            Transcript showCr:'accepted with:'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   676
            Transcript showCr:'   m1: ' , m1 value printString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   677
            Transcript showCr:'   m2: ' , m2 value printString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   678
            Transcript showCr:'   m3: ' , m3 value printString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   679
            Transcript showCr:'   m4: ' , m4 value printString.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   680
        ]
164
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   681
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   682
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   683
126
claus
parents: 125
diff changeset
   684
    a full example:
claus
parents: 125
diff changeset
   685
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   686
        |box warnSTX allowUnderscore immutableArrays logDoits
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   687
         listOfLanguages listOfStyles styleNames 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   688
         frame panel c resourceDir dir |
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   689
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   690
        warnSTX := Compiler warnSTXSpecials asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   691
        allowUnderscore := Compiler allowUnderscoreInIdentifier asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   692
        immutableArrays := Compiler arraysAreImmutable asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   693
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   694
        logDoits := Smalltalk logDoits asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   695
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   696
        listOfLanguages := SelectionInList with:#('english'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   697
                                                  'french'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   698
                                                  'german'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   699
                                                  'italian'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   700
                                                  'spanish'
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   701
                                                 ).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   702
        listOfLanguages selection:(Language asString).
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
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   705
        resourceDir := Smalltalk getSystemFileName:'resources'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   706
        dir := FileDirectory directoryNamed:resourceDir.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   707
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   708
        styleNames := dir select:[:aFileName | aFileName endsWith:'.style'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   709
        styleNames := styleNames collect:[:aFileName | aFileName copyWithoutLast:6].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   710
        listOfStyles := SelectionInList with:styleNames sort.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   711
        listOfStyles selection:(View defaultStyle asString).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   712
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   713
        box := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   714
        box label:'Settings'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   715
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   716
        frame := FramedBox label:'Compiler'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   717
        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
   718
        panel horizontalLayout:#leftSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   719
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   720
        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
   721
        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
   722
        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
   723
        box addComponent:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   724
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   725
        frame := FramedBox label:'Misc'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   726
        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
   727
        panel horizontalLayout:#leftSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   728
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   729
        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
   730
        box addComponent:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   731
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   732
        frame := FramedBox label:'Language'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   733
        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
   734
        panel horizontalLayout:#leftSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   735
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   736
        panel add:((PopUpList on:listOfLanguages) width:0.5).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   737
        box addComponent:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   738
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   739
        frame := FramedBox label:'Style'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   740
        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
   741
        panel horizontalLayout:#leftSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   742
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   743
        panel add:((PopUpList on:listOfStyles) width:0.5).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   744
        box addComponent:frame.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   745
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   746
        box addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   747
        box showAtPointer.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   748
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   749
        box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   750
            Transcript topView withCursor:Cursor wait do:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   751
                Compiler warnSTXSpecials:warnSTX value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   752
                Compiler allowUnderscoreInIdentifier:allowUnderscore value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   753
                Compiler arraysAreImmutable:immutableArrays value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   754
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   755
                Smalltalk logDoits:logDoits value.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   756
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   757
                Transcript showCr:'change language to ' , listOfLanguages selection , ' ...'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   758
                Smalltalk at:#Language put:listOfLanguages selection asSymbol.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   759
                Smalltalk changed:#Language.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   760
                ResourcePack flushCachedResourcePacks.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   761
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   762
                Transcript showCr:'change style to ' , listOfStyles selection , ' ...'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   763
                View defaultStyle:listOfStyles selection asSymbol.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   764
            ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   765
        ]
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   766
"
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   767
!
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   768
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   769
inputFocus
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   770
"
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   771
    a DialogBox with multiple input fields can be configured on how it
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   772
    shall behave if the RETURN key is pressed. 
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   773
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   774
    The default is to shift the focus to the ok-button.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   775
    This can be changed to automatic OK with:
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   776
        aBox focusToOKOnLeave:false
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   777
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   778
    Then, leaving the last field automatically accepts as if ok was pressed.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   779
    (useful for simple - single entry dialogs).
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   780
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   781
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   782
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   783
    With: 
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   784
        aBox acceptReturnAsOK:false
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   785
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   786
    this any focusSHift or automatic OK is turned off, and the input group 
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   787
    switches its focus back to the topMost field. 
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   788
    The default for this is true.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   789
    (useful, if you want an explicit ok from the user, or need all fields
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   790
     to be handled somehow).
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   791
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   792
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   793
    Simply leaving the group with a cursor movement may also be either
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   794
    interpreted as a return (the default),
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   795
    or again wrap back to the top of the group.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   796
    with:
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   797
        aBox acceptOnLeave:false
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   798
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   799
    this is turned off and again, the focus is moved back to the topMost
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   800
    entry field. The default is true.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   801
"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   802
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
   803
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   804
!DialogBox class methodsFor:'class initialization'!
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   805
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   806
initialize
528
3ed1f0b5a0bb oops - dont clobber Dialog global if subclasses #initialize
Claus Gittinger <cg@exept.de>
parents: 498
diff changeset
   807
    self == DialogBox ifTrue:[
3ed1f0b5a0bb oops - dont clobber Dialog global if subclasses #initialize
Claus Gittinger <cg@exept.de>
parents: 498
diff changeset
   808
        Dialog := self
3ed1f0b5a0bb oops - dont clobber Dialog global if subclasses #initialize
Claus Gittinger <cg@exept.de>
parents: 498
diff changeset
   809
    ]
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   810
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   811
    "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
   812
    "Modified: 10.4.1996 / 08:16:18 / cg"
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   813
! !
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   814
128
claus
parents: 126
diff changeset
   815
!DialogBox class methodsFor:'common dialogs'!
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   816
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
   817
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
   818
    "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
   819
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   820
    (InfoBox title:aString) showAtPointer
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 information:'help'
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   824
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   825
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   826
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
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
   828
    "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
   829
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   830
    (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
   831
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   832
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   833
     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
   834
    "
d3fe810390cb 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
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   836
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   837
!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
   838
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   839
confirm:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   840
    "launch a Dialog, which allows user to enter yes or no.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   841
     return true for yes, false for no"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   842
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   843
    ^ self 
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   844
        confirm:aString
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   845
        title:nil
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   846
        yesLabel:nil
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   847
        noLabel:nil
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   848
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   849
"/    |box answer|
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   850
"/
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   851
"/    box := YesNoBox title:aString.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   852
"/    box label:(self classResources string:'Confirm').
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   853
"/    box yesAction:[answer := true] noAction:[answer := false].
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   854
"/    box showAtPointer.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   855
"/    box yesAction:nil noAction:nil.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   856
"/    ^ answer
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   857
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   858
    " 
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   859
     Dialog 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
   860
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   861
     Transcript showCr:(
414
1435ecc200a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   862
        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
   863
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   864
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   865
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   866
    "Modified: 8.3.1996 / 21:16:54 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   867
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   868
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   869
confirm:aString initialAnswer:what
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   870
    "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
   871
     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
   872
     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
   873
     the default (i.e. return-) button"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   874
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   875
    |box answer|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   876
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   877
    box := YesNoBox title:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   878
    box yesAction:[answer := true] noAction:[answer := false].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   879
    what == false ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   880
	box okButton isReturnButton:false.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   881
	box acceptReturnAsOK:false.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   882
	box noButton beReturnButton.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   883
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   884
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   885
    box yesAction:nil noAction:nil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   886
    ^ answer
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   887
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   888
    " 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   889
     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
   890
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   891
     Transcript showCr:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   892
	Dialog 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
   893
     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   894
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   895
     Transcript showCr:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   896
	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
   897
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   898
    "
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
   899
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   900
    "Modified: 27.1.1996 / 14:24:39 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   901
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   902
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   903
confirm:aString title:title yesLabel:yesText noLabel:noText
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   904
    "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
   905
     return true for yes, false for no.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   906
     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
   907
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   908
    |box answer|
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   909
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   910
    box := YesNoBox title:aString.
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   911
    yesText notNil ifTrue:[
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   912
        box yesLabel:yesText.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   913
    ].
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   914
    noText notNil ifTrue:[
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   915
        box noLabel:noText.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   916
    ].
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   917
    box yesAction:[answer := true] noAction:[answer := false].
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   918
    title notNil ifTrue:[
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   919
        box label:title
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   920
    ].
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   921
    box showAtPointer.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   922
    box yesAction:nil noAction:nil.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   923
    ^ answer
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   924
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   925
    " 
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   926
     Dialog 
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   927
        confirm:'really ?' 
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   928
        title:'fooBar'
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   929
        yesLabel:'oh well' 
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   930
        noLabel:'nope'
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   931
    "
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   932
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   933
    "Created: 21.2.1996 / 01:10:14 / cg"
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   934
    "Modified: 8.3.1996 / 21:15:56 / cg"
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   935
!
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   936
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   937
confirm:aString yesLabel:yesText noLabel:noText
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   938
    "launch a Dialog, which allows user to enter yes or no.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   939
     return true for yes, false for no.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   940
     The yes/no buttons labels are defined by yesText/noText."
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   941
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   942
    ^ self confirm:aString title:nil yesLabel:yesText noLabel:noText
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   943
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   944
    " 
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   945
     Dialog confirm:'really ?' yesLabel:'oh well' noLabel:'nope'
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   946
    "
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   947
374
39a735c9a1c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   948
    "Created: 21.2.1996 / 01:10:14 / cg"
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   949
    "Modified: 8.3.1996 / 21:15:06 / cg"
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   950
!
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   951
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   952
confirmWithCancel:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   953
    "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
   954
     return true for 'yes', false for 'no', nil for 'cancel'"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   955
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   956
    |box answer|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   957
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   958
    box := OptionBox title:aString numberOfOptions:3. 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   959
    box buttonTitles:(self classResources array:
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   960
			#('cancel' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   961
			  'no' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   962
			  'yes')
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   963
		     )
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   964
	     actions:(Array with:[answer := nil]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   965
			    with:[answer := false] 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   966
			    with:[answer := true]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   967
		     ).
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   968
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   969
    box actions:nil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   970
    ^ answer
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   971
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   972
    "
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
   973
     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
   974
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   975
     Transcript showCr:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
   976
	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
   977
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   978
    "
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
   979
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   980
    "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
   981
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   982
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   983
!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
   984
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   985
requestDirectoryName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   986
    "same as requestFileName, but only show directories."
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   987
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   988
    ^ self
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   989
        requestDirectoryName:'directory ?' 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   990
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   991
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   992
     Dialog requestDirectoryName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   993
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   994
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   995
    "Created: 19.4.1996 / 14:29:48 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   996
    "Modified: 19.4.1996 / 14:32:42 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   997
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   998
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
   999
requestDirectoryName:title
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1000
    "same as requestFileName, but only show directories."
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1001
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1002
    ^ self
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1003
        requestDirectoryName:title 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1004
        default:nil
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1005
        ifFail:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1006
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1007
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1008
     Dialog
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1009
        requestDirectoryName:'which directory ?' 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1010
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1011
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1012
    "Created: 19.4.1996 / 14:29:48 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1013
    "Modified: 19.4.1996 / 14:32:02 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1014
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1015
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1016
requestDirectoryName:title default:aFileName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1017
    "same as requestFileName, but only show directories"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1018
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1019
    ^ self
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1020
        requestDirectoryName:title 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1021
        default:nil
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1022
        ifFail:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1023
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1024
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1025
     Dialog
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1026
        requestDirectoryName:'which directory ?' 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1027
        default:'/etc'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1028
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1029
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1030
    "Created: 19.4.1996 / 14:29:10 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1031
    "Modified: 19.4.1996 / 14:31:52 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1032
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1033
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1034
requestDirectoryName:title default:aFileName ifFail:failBlock
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1035
    "same as requestFileName, but only show directories"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1036
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1037
    |fileBox|
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1038
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1039
    fileBox := FileSelectionBox
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1040
                    title:title
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1041
                    okText:'ok'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1042
                    abortText:'cancel'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1043
                    action:[:fileName | ^ fileName].
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1044
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1045
    fileBox initialText:aFileName.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1046
    fileBox selectingDirectory:true.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1047
    fileBox showAtPointer.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1048
    ^ failBlock value
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1049
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1050
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1051
     Dialog
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1052
        requestDirectoryName:'which directory ?' 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1053
        default:'/etc'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1054
        ifFail:'none'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1055
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1056
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1057
    "Created: 19.4.1996 / 14:31:04 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1058
    "Modified: 19.4.1996 / 14:31:26 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1059
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1060
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1061
requestFileName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1062
    "launch a Dialog, which allows the user to enter a filename.
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1063
     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
  1064
     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
  1065
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1066
    ^ self 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1067
        requestFileName:'filename:' 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1068
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1069
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1070
     Dialog requestFileName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1071
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1072
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1073
    "Created: 27.1.1996 / 13:24:35 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1074
    "Modified: 19.4.1996 / 13:49:28 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1075
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1076
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1077
requestFileName:titleString
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1078
    "launch a Dialog, which allows user to enter a filename.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1079
     Return the pathname string consisting of the full pathname of the filename,
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1080
     or an empty string (if cancel was pressed)."
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1081
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1082
    ^ self 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1083
        requestFileName:titleString 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1084
        default:'file.ext' 
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1085
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
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
     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
  1088
     Dialog requestFileName:'enter a fileName:' 
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1089
    "
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
  1090
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1091
    "Created: 27.1.1996 / 13:24:35 / cg"
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1092
    "Modified: 19.4.1996 / 13:53:17 / cg"
118
claus
parents: 112
diff changeset
  1093
!
claus
parents: 112
diff changeset
  1094
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1095
requestFileName:titleString default:defaultName
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1096
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1097
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1098
     Return the pathname string consisting of the full pathname of the filename,
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1099
     or an empty string (if cancel was pressed)."
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1100
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1101
    ^ self 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1102
        requestFileName:titleString 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1103
        default:defaultName 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1104
        version:nil 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1105
        ifFail:''
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1106
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1107
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1108
     Dialog requestFileName:'enter a fileName:' default:''  
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1109
     Dialog requestFileName:'enter a fileName:' default:'Makefile.bak'  
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1110
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1111
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1112
    "Modified: 19.4.1996 / 13:47:44 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1113
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1114
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1115
requestFileName:titleString default:defaultName fromDirectory:aDirectoryPath
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1116
    "launch a Dialog, which allows user to enter a filename.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1117
     The box will not allow pressing 'ok' without an entered string.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1118
     Return the pathname string consisting of the full pathname of the filename,
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1119
     or an empty string (if cancel was pressed)."
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1120
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1121
    ^ self 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1122
        requestFileName:titleString 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1123
        default:defaultName 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1124
        version:nil 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1125
        ifFail:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1126
        fromDirectory:aDirectoryPath
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1127
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1128
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1129
     Dialog 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1130
        requestFileName:'enter a fileName:' 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1131
        default:'Makefile.bak'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1132
        fromDirectory:'..'      
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1133
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1134
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1135
    "Modified: 19.4.1996 / 14:27:31 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1136
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1137
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1138
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1139
    "launch a Dialog, which allows user to enter a filename.
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1140
     The files presented initially are those from the current directory.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1141
     The box will show okText in its okButton, abortText in the abortButton.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1142
     The matchPattern is set to pattern initially.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1143
     Return the string or nil if cancel was pressed."
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1144
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1145
    ^ self 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1146
        requestFileName:titleString 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1147
        default:defaultName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1148
        ok:okText 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1149
        abort:abortText 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1150
        pattern:pattern
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1151
        fromDirectory:nil
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1152
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1153
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1154
     Dialog 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1155
        requestFileName:'enter a fileName:'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1156
        default:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1157
        ok:'yeah' 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1158
        abort:'oh, no' 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1159
        pattern:'*.st'   
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1160
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1161
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1162
    "Modified: 19.4.1996 / 14:06:22 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1163
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1164
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1165
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPath
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1166
    "launch a Dialog, which allows user to enter a filename.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1167
     The files presented initially are those in aDirectoryPath, or the
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1168
     current directory (if a nil path is given).
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1169
     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
  1170
     The matchPattern is set to pattern initially.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1171
     Return the string or nil if cancel was pressed."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1172
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1173
    |box|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1174
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1175
    box := FileSelectionBox 
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1176
               title:titleString
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1177
               okText:okText 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1178
               abortText:abortText
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1179
               action:[:fileName | ^fileName].
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1180
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1181
    aDirectoryPath notNil ifTrue:[box directory:aDirectoryPath].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1182
    box pattern:pattern.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1183
    box initialText:defaultName.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1184
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1185
    box action:nil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1186
    ^ nil
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1187
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1188
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1189
     Dialog 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1190
        requestFileName:'enter a fileName:'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1191
        default:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1192
        ok:'yeah' 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1193
        abort:'oh, no' 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1194
        pattern:'rc*'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1195
        fromDirectory:'/etc'
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1196
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1197
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1198
    "Modified: 19.4.1996 / 14:07:32 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1199
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1200
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1201
requestFileName:titleString default:defaultName version:versionSymbol
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1202
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1203
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1204
     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
  1205
     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
  1206
     it may be any of:
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1207
        #mustBeNew      - fail (return empty string) if the file exists
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1208
        #new            - confirm if the file exists
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1209
        #mustBeOld      - fail if the file does not exist
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1210
        #old            - confirm if the file does not exist
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1211
        #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
  1212
    "
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1213
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1214
    ^ self 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1215
        requestFileName:titleString 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1216
        default:defaultName 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1217
        version:versionSymbol 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1218
        ifFail:''
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1219
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1220
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1221
     Dialog requestFileName:'enter a fileName:'
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1222
                        default:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1223
                        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
  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
     Dialog requestFileName:'enter a fileName:'
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1226
                        default:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1227
                        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
  1228
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1229
     Dialog requestFileName:'enter a fileName:'
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1230
                        default:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1231
                        version:#new   
100
25778412f2b0 *** empty log message ***
claus
parents: 97
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
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1234
    "Modified: 19.4.1996 / 13:53:58 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1235
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1236
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1237
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1238
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1239
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1240
     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
  1241
     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
  1242
     it may be any of:
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1243
        #mustBeNew      - fail (return empty string) if the file exists
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1244
        #new            - confirm if the file exists
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1245
        #mustBeOld      - fail if the file does not exist
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1246
        #old            - confirm if the file does not exist
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1247
        #any (other)    - no validation
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1248
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1249
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1250
    ^ self
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1251
        requestFileName:titleString 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1252
        default:defaultName 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1253
        version:versionSymbol 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1254
        ifFail:failBlock
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1255
        fromDirectory:nil
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1256
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1257
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1258
     Dialog 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1259
        requestFileName:'enter a fileName:'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1260
        default:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1261
        version:nil
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1262
        ifFail:['none']   
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1263
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1264
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1265
     Dialog 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1266
        requestFileName:'enter a fileName:'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1267
        default:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1268
        version:#old 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1269
        ifFail:['none']   
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1270
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1271
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1272
    "Modified: 19.4.1996 / 14:26:36 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1273
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1274
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1275
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock fromDirectory:aDirectoryPath
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1276
    "launch a Dialog, which allows user to enter a filename.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1277
     Return the string or the value of failBlock if cancel was pressed.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1278
     The version argument allows validation of the files existance;
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1279
     it may be any of:
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1280
        #mustBeNew      - fail (return empty string) if the file exists
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1281
        #new            - confirm if the file exists
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1282
        #mustBeOld      - fail if the file does not exist
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1283
        #old            - confirm if the file does not exist
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1284
        #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
  1285
    "
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1286
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1287
    |box|
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1288
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1289
    box := FileSelectionBox title:titleString.
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1290
    aDirectoryPath notNil ifTrue:[box directory:aDirectoryPath].
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1291
    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
  1292
    box action:[:name | 
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1293
        versionSymbol == #mustBeNew ifTrue:[
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1294
            "/ file may not exist
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1295
            name asFilename exists ifTrue:[^ ''].
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1296
        ].
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1297
        versionSymbol == #new ifTrue:[
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1298
            "/ file may not exist
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1299
            name asFilename exists ifTrue:[
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1300
                (self confirm:(ClassResources string:'''%1'' exists.\\Continue anyway ?' with:box fileName) withCRs)
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1301
                ifFalse:[^ ''].
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1302
            ].
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1303
        ].
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1304
        versionSymbol == #mustBeOld ifTrue:[
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1305
            name asFilename exists ifFalse:[^ ''].
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1306
        ].
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1307
        versionSymbol == #old ifTrue:[
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1308
            "/ file may not exist
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1309
            name asFilename exists ifFalse:[
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1310
                (self confirm:(ClassResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:box fileName) withCRs)
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1311
                ifFalse:[^ ''].
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1312
            ].
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1313
        ].
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
  1314
        
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1315
        ^ 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
  1316
    ].
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1317
    box showAtPointer.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1318
    box action:nil.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1319
    ^ failBlock value
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1320
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1321
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1322
     Dialog 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1323
        requestFileName:'enter a fileName:'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1324
        default:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1325
        version:nil
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1326
        ifFail:['none']
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1327
        fromDirectory:'/etc'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1328
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1329
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1330
     Dialog 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1331
        requestFileName:'enter a fileName:'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1332
        default:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1333
        version:#old 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1334
        ifFail:['none']   
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1335
        fromDirectory:'/etc'
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
  1336
    "
d3fe810390cb 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
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1338
     Dialog 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1339
        requestFileName:'enter a fileName:'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1340
        default:''
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1341
        version:#mustBeNew 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1342
        ifFail:['none']   
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1343
        fromDirectory:'/etc'
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
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1346
    "Modified: 19.4.1996 / 14:25:15 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1347
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1348
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1349
requestFileName:titleString ifFail:cancelBlock
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1350
    "launch a Dialog, which allows user to enter a filename.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1351
     Return the pathname string consisting of the full pathname of the filename,
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1352
     or the value from evaluating cancelBlock (if cancel was pressed)."
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1353
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1354
    ^ self 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1355
        requestFileName:titleString 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1356
        default:'file.ext'
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1357
        version:nil
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1358
        ifFail:cancelBlock
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1359
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1360
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1361
     Dialog requestFileName:'enter a fileName:' ifFail:['foo']
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1362
     Dialog requestFileName:'enter a fileName:' ifFail:[nil] 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1363
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1364
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1365
    "Modified: 19.4.1996 / 13:53:17 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1366
    "Created: 19.4.1996 / 13:56:28 / 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
  1367
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1368
d3fe810390cb 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
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
  1370
    "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
  1371
     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
  1372
     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
  1373
     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
  1374
     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
  1375
     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
  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
    ^ self requestFileName:titleString 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1378
		   default:defaultName 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1379
		   version:#new 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1380
		    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
  1381
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1382
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1383
     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
  1384
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1385
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1386
    "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
  1387
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1388
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1389
!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
  1390
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1391
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
  1392
    "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
  1393
     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
  1394
     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
  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
    ^ self 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1397
	request:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1398
	displayAt:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1399
	centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1400
	action:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1401
	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
  1402
d3fe810390cb 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
    "
d3fe810390cb 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
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1405
	 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
  1406
    "
d3fe810390cb 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
    "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
  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
d3fe810390cb 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
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
  1412
    "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
  1413
     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
  1414
     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
  1415
     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
  1416
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1417
    ^ self
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1418
	request:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1419
	displayAt:aPoint 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1420
	centered:centered 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1421
	action:resultAction 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1422
	initialAnswer:initial
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1423
	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
  1424
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1425
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1426
     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
  1427
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1428
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1429
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1430
	    displayAt:200@200
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1431
	    centered:true
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1432
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1433
	    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
  1434
d3fe810390cb 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
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1436
     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
  1437
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1438
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1439
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1440
	    displayAt:200@200
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1441
	    centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1442
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1443
	    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
  1444
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1445
     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
  1446
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1447
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1448
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1449
	    displayAt:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1450
	    centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1451
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1452
	    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
  1453
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1454
     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
  1455
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1456
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1457
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1458
	    displayAt:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1459
	    centered:true 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1460
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1461
	    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
  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
d3fe810390cb 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
    "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
  1465
    "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
  1466
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1467
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1468
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
  1469
    "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
  1470
     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
  1471
     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
  1472
     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
  1473
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1474
    |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
  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
    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
  1477
    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
  1478
    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
  1479
    resultAction isNil ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1480
	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
  1481
    ] ifFalse:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1482
	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
  1483
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1484
    aPoint notNil ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1485
	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
  1486
    ] ifFalse:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1487
	centered ifTrue:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1488
	    box showAtCenter
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1489
	] ifFalse:[
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1490
	    box showAtPointer
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1491
	]
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
  1492
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1493
    ^ 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
  1494
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1495
    "
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
  1496
     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
  1497
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1498
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1499
	    displayAt:0@0
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1500
	    centered:true
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1501
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1502
	    initialAnswer:'the default'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1503
	    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
  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
     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
  1506
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1507
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1508
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1509
	    displayAt:200@200
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1510
	    centered:true
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1511
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1512
	    initialAnswer:'the default'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1513
	    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
  1514
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1515
     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
  1516
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1517
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1518
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1519
	    displayAt:200@200
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1520
	    centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1521
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1522
	    initialAnswer:'the default'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1523
	    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
  1524
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1525
     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
  1526
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1527
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1528
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1529
	    displayAt:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1530
	    centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1531
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1532
	    initialAnswer:'the default'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1533
	    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
  1534
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1535
     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
  1536
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1537
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1538
	    request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1539
	    displayAt:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1540
	    centered:true 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1541
	    action:[:result | result printNewline]
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1542
	    initialAnswer:'the default'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1543
	    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
  1544
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1545
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1546
    "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
  1547
    "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
  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
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
  1551
    "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
  1552
     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
  1553
     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
  1554
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1555
    ^ self 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1556
	request:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1557
	displayAt:aPoint 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1558
	centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1559
	action:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1560
	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
  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
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1564
	 request:'enter a string:' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1565
	 displayAt:(250 @ 250) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1566
	 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
  1567
    "
d3fe810390cb 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
d3fe810390cb 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
    "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
  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
d3fe810390cb 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
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
  1573
    "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
  1574
     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
  1575
d3fe810390cb 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
    ^ self 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1577
	request:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1578
	displayAt:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1579
	centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1580
	action:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1581
	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
  1582
d3fe810390cb 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
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1585
	 request:'enter a string:' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1586
	 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
  1587
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1588
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1589
    "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
  1590
!
d3fe810390cb 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
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
  1593
    "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
  1594
     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
  1595
     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
  1596
d3fe810390cb 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
    self 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1598
	request:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1599
	displayAt:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1600
	centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1601
	action:[:result | ^ result] 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1602
	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
  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
    ^ 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
  1605
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1606
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1607
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1608
	 request:'enter a string:' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1609
	 initialAnswer:'the default'  
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1610
	 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
  1611
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1612
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1613
    "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
  1614
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1615
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1616
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
  1617
    "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
  1618
     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
  1619
     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
  1620
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1621
    self 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1622
	request:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1623
	displayAt:nil 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1624
	centered:false 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1625
	action:[:result | ^ result] 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1626
	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
  1627
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1628
    ^ 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
  1629
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1630
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1631
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1632
	 request:'enter a string:'
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1633
	 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
  1634
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1635
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1636
    "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
  1637
    "Modified: 27.1.1996 / 14:46:10 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1638
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1639
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1640
requestPassword:aString 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1641
    "launch a Dialog, which allows user to enter something invisibly.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1642
     Return the entered string (may be empty string) 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1643
     or nil (if cancel was pressed)"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1644
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1645
    ^ EnterBox requestPassword:aString 
133
claus
parents: 132
diff changeset
  1646
claus
parents: 132
diff changeset
  1647
    "
claus
parents: 132
diff changeset
  1648
     Dialog 
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1649
	 requestPassword:'enter secret:'
133
claus
parents: 132
diff changeset
  1650
    "
197
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
    "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
  1653
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1654
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1655
!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
  1656
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1657
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
  1658
    "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
  1659
     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
  1660
     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
  1661
     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
  1662
     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
  1663
     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
  1664
     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
  1665
     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
  1666
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1667
    |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
  1668
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1669
    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
  1670
    (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
  1671
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1672
    list notNil ifTrue:[
557
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1673
        maxLines > list size ifTrue:[
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1674
            listView := ScrollableView for:SelectionInListView.
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1675
        ] ifFalse:[
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1676
            listView := SelectionInListView new.
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1677
            listView level:-1.
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1678
        ].
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1679
        listView list:list.
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1680
        listView doubleClickAction:[:line | box hide. ^ listValues at:line].
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1681
        box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines).
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1682
        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
  1683
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1684
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1685
    buttonLabels notNil ifTrue:[
557
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1686
        panel := HorizontalPanelView new.
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1687
        panel horizontalLayout:#fitSpace.
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1688
        buttonLabels keysAndValuesDo:[:index :label |
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1689
            |b|
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1690
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1691
            b := Button label:label.
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1692
            b action:[box hide. ^ buttonValues at:index].
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1693
            panel add:b.
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1694
            box makeTabable:b.
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1695
        ].
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1696
        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
  1697
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1698
    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
  1699
    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
  1700
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  1701
    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
  1702
    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
  1703
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
  1704
    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
  1705
    box accepted ifTrue:[
557
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1706
        (answer := listView selection) notNil ifTrue:[
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1707
            ^ listValues at:answer
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1708
        ]
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
  1709
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1710
    ^ cancelBlock value
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1711
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1712
    "
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
  1713
     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
  1714
557
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1715
         Transcript showCr:(
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1716
             Dialog 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1717
                choose:'choose any' 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1718
                fromList:#('one' 'two' 'three' 'four') 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1719
                values:#(1 2 3 4) 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1720
                buttons:#('five' 'six' 'seven')
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1721
                values:#(5 6 7)
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1722
                lines:10 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1723
                cancel:nil
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1724
         )
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
  1725
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1726
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1727
     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
  1728
557
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1729
         Transcript showCr:(
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1730
             Dialog 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1731
                choose:'choose any' 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1732
                fromList:#('one' 'two' 'three' 'four') 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1733
                values:#(1 2 3 4) 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1734
                buttons:nil
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1735
                values:nil
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1736
                lines:4
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1737
                cancel:nil
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1738
         )
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
  1739
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1740
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1741
     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
  1742
557
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1743
         Transcript showCr:(
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1744
             Dialog 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1745
                choose:'choose any' 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1746
                fromList:nil
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1747
                values:nil
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1748
                buttons:#('one' 'two' 'three' 'four') 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1749
                values:#(1 2 3 4) 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1750
                lines:4
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1751
                cancel:nil
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1752
         )
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
  1753
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1754
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1755
      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
  1756
557
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1757
         Transcript showCr:(
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1758
             Dialog 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1759
                choose:'choose example' 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1760
                fromList:#('one' 'two' 'three' 'four') 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1761
                values:#(1 2 3 4) 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1762
                buttons:#('five' 'six' 'seven')
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1763
                values:#(5 6 7)
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1764
                lines:4
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1765
                cancel:[Transcript flash. #aborted]
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1766
         )
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
  1767
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1768
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1769
     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
  1770
557
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1771
         Transcript showCr:(
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1772
             Dialog 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1773
                choose:'choose any' 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1774
                fromList:nil
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1775
                values:nil
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1776
                buttons:nil
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1777
                values:nil
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1778
                lines:nil 
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1779
                cancel:nil
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1780
         )
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
  1781
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1782
133
claus
parents: 132
diff changeset
  1783
    "
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
  1784
557
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  1785
    "Modified: 19.4.1996 / 19:00:05 / 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
  1786
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1787
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1788
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
  1789
    "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
  1790
     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
  1791
     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
  1792
     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
  1793
     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
  1794
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1795
    ^ self
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1796
	choose:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1797
	fromList:list 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1798
	values:listValues
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1799
	buttons:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1800
	values:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1801
	lines:maxLines
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1802
	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
  1803
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1804
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1805
     Transcript showCr:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1806
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1807
	    choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1808
	    fromList:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1809
	    values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1810
	    lines:4
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1811
	    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
  1812
     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1813
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1814
     Transcript showCr:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1815
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1816
	    choose:'choose example' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1817
	    fromList:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1818
	    values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1819
	    lines:4
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1820
	    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
  1821
     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1822
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1823
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1824
    "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
  1825
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1826
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1827
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
  1828
    "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
  1829
     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
  1830
     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
  1831
     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
  1832
     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
  1833
     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
  1834
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1835
    |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
  1836
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1837
    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
  1838
    box buttonTitles:(self classResources array:buttonLabels)
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1839
	     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
  1840
    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
  1841
    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
  1842
    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
  1843
    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
  1844
    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
  1845
    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
  1846
    ^ 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
  1847
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1848
    "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
  1849
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1850
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1851
	choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1852
	labels:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1853
	values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1854
	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
  1855
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1856
     Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1857
	choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1858
	labels:#('cancel' 'foo' 'bar' 'baz') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1859
	values:#(nil foo bar baz) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1860
	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
  1861
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1862
      Dialog 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1863
	choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1864
	labels:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1865
	values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1866
	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
  1867
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1868
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1869
    "Modified: 27.1.1996 / 13:48:17 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1870
! !
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1871
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1872
!DialogBox methodsFor:'accessing'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1873
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1874
abortText:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1875
    "define the label in the abort-button"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1876
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1877
    |oldSize|
121
claus
parents: 120
diff changeset
  1878
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1879
    aString ~= abortButton label ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1880
	oldSize := abortButton extent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1881
	abortButton label:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1882
	abortButton resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1883
	abortButton extent ~= oldSize ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1884
	    shown ifTrue:[self resize]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1885
	]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1886
    ]
121
claus
parents: 120
diff changeset
  1887
!
claus
parents: 120
diff changeset
  1888
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1889
okText:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1890
    "define the text in the ok-button"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1891
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1892
    |oldSize|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1893
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1894
    aString ~= okButton label ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1895
	oldSize := okButton extent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1896
	okButton label:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1897
	okButton resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1898
	okButton extent ~= oldSize ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1899
	    shown ifTrue:[self resize]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1900
	]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1901
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1902
!
125
claus
parents: 122
diff changeset
  1903
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1904
okText:okString abortText:abortString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1905
    "set both texts displayed in the buttons"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1906
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1907
    (abortString ~= abortButton label 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1908
    or:[okString ~= okButton label]) ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1909
	okButton label:okString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1910
	abortButton label:abortString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1911
	okButton resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1912
	abortButton resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1913
	shown ifTrue:[self resize]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1914
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1915
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1916
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1917
!DialogBox methodsFor:'accessing-behavior'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1918
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1919
abortAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1920
    "define the action to be performed when abort is pressed"
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
    abortAction := aBlock
125
claus
parents: 122
diff changeset
  1923
!
claus
parents: 122
diff changeset
  1924
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1925
acceptCheck:aBlock
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1926
    "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
  1927
     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
  1928
     otherwise not."
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1929
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1930
    acceptCheck := aBlock
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1931
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1932
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1933
acceptOnLeave:aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1934
    "define the behavior when the last input field is left via cursor keys.
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1935
     The default is to accept & close the dialog (i.e. true)."
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1936
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1937
    acceptOnLeave := aBoolean.
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1938
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1939
    "Modified: 19.4.1996 / 17:05:12 / cg"
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1940
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1941
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1942
acceptReturnAsOK:aBoolean
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1943
    "turn on/off interpretation of return-key as ok.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1944
     Default is on"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1945
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1946
    acceptReturnAsOK := aBoolean.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1947
    okButton notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1948
	okButton isReturnButton:aBoolean.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1949
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1950
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1951
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1952
action:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1953
    "set the action to be performed when user presses ok-button;
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1954
     aBlock must be nil or a block. This method simply
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1955
     reuses okAction: and has been added for a consistent action-setting
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1956
     protocol."
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  1957
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1958
    self okAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1959
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1960
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1961
focusOnField:anInputField
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1962
    inputFieldGroup makeActive:anInputField
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1963
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1964
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1965
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1966
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1967
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1968
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1969
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1970
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1971
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1972
focusToOKOnLeave:aBoolean
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1973
    "define the behavior when the last input field is left via a return
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1974
     or cursor key.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1975
     The default is to shift the focus to the OK button (i.e. true).
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1976
     If turned off, the OK is immediately performed, i.e.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1977
     the dialog is accepted & closed."
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1978
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1979
    focusToOKOnLeave := aBoolean.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1980
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1981
    "Modified: 19.4.1996 / 17:05:12 / cg"
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1982
    "Created: 19.4.1996 / 17:13:36 / cg"
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1983
!
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  1984
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1985
hideOnAccept:aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1986
    "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
  1987
     The default is true"
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1988
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1989
    hideOnAccept := aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1990
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  1991
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1992
okAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1993
    "define the action to be performed when ok is pressed"
133
claus
parents: 132
diff changeset
  1994
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1995
    okAction := aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1996
! !
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
!DialogBox methodsFor:'accessing-components'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1999
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2000
abortButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2001
    "return the abortButton - this access is provided to allow
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2002
     setting the buttons look (for example: colors or font)"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2003
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2004
    ^ abortButton
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2005
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2006
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2007
okButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2008
    "return the okButton - this access is provided to allow
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2009
     setting the buttons look (for example: colors or font)"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2010
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2011
    ^ okButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2012
! !
155
claus
parents: 146
diff changeset
  2013
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2014
!DialogBox methodsFor:'accessing-elements'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2015
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2016
componentAt:name
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2017
    bindings isNil ifTrue:[^ nil].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2018
    ^ bindings at:name ifAbsent:nil
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2019
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2020
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2021
inputFieldGroup
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2022
    ^ inputFieldGroup
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2023
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2024
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2025
name:element as:name
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2026
    bindings isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2027
	bindings := IdentityDictionary new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2028
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2029
    bindings at:name put:element
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2030
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2031
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2032
!DialogBox methodsFor:'accessing-models'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2033
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2034
accept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2035
    "return the valueHolder holding true when the box
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2036
     is accepted, false if closed via the windowManager or
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2037
     the cancel button.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2038
     This is confusing: this method was originally called #acceptValue,
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2039
     but renamed for compatibility with ST-80.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2040
     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
  2041
     is used to force an accept, not to return some valueHolder ...)."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2042
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2043
    ^ acceptValue
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2044
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2045
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2046
acceptChannel:aValueHolder
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2047
    "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
  2048
     is accepted"
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2049
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2050
    acceptValue := aValueHolder
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2051
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2052
120
claus
parents: 118
diff changeset
  2053
!DialogBox methodsFor:'construction-adding'!
claus
parents: 118
diff changeset
  2054
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2055
addAbortButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2056
    "create an abortButton - to be sent from redefined initialize
162
claus
parents: 157
diff changeset
  2057
     methods in subclasses or when creating a box programmatically.
claus
parents: 157
diff changeset
  2058
     Returns the button."
claus
parents: 157
diff changeset
  2059
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2060
    ^ self addAbortButtonLabelled:nil
122
claus
parents: 121
diff changeset
  2061
!
120
claus
parents: 118
diff changeset
  2062
162
claus
parents: 157
diff changeset
  2063
addAbortButton:aButton 
claus
parents: 157
diff changeset
  2064
    "add an already created abortButton - to be sent from redefined initialize
claus
parents: 157
diff changeset
  2065
     methods in subclasses or when creating a box programmatically.
claus
parents: 157
diff changeset
  2066
     Returns the button."
claus
parents: 157
diff changeset
  2067
claus
parents: 157
diff changeset
  2068
    abortButton := aButton.
claus
parents: 157
diff changeset
  2069
    aButton model:self; change:#abortPressed.
claus
parents: 157
diff changeset
  2070
    ^ self addButton:aButton.
claus
parents: 157
diff changeset
  2071
claus
parents: 157
diff changeset
  2072
    "Created: 17.9.1995 / 20:17:26 / claus"
claus
parents: 157
diff changeset
  2073
!
claus
parents: 157
diff changeset
  2074
122
claus
parents: 121
diff changeset
  2075
addAbortButtonLabelled:buttonLabel
claus
parents: 121
diff changeset
  2076
    "create an abortButton with a label - to be sent from redefined initialize
claus
parents: 121
diff changeset
  2077
     methods in subclasses or when creating a box programmatically.
claus
parents: 121
diff changeset
  2078
     A nil argument creates one with the default label.
claus
parents: 121
diff changeset
  2079
     Returns the button."
claus
parents: 121
diff changeset
  2080
162
claus
parents: 157
diff changeset
  2081
    |aButton|
claus
parents: 157
diff changeset
  2082
claus
parents: 157
diff changeset
  2083
    aButton := Button abortButton.
claus
parents: 157
diff changeset
  2084
    buttonLabel notNil ifTrue:[aButton label:buttonLabel].
claus
parents: 157
diff changeset
  2085
    ^ self addAbortButton:aButton
claus
parents: 157
diff changeset
  2086
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2087
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2088
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2089
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2090
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2091
     dialog addAbortButtonLabelled:'get out of here'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2092
     dialog addOkButtonLabelled:'yes thats ok'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2093
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2094
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2095
    "
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
    "Modified: 9.2.1996 / 22:09:40 / cg"
120
claus
parents: 118
diff changeset
  2098
!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2099
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2100
addButton:aButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2101
    "add a button into the buttonPanel.
122
claus
parents: 121
diff changeset
  2102
     Returns the button."
120
claus
parents: 118
diff changeset
  2103
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2104
    ^ self addButton:aButton after:nil
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2105
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
     |dialog|
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 := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2110
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2111
     dialog addButton:(Button label:'foo' action:[Transcript showCr:'foo']).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2112
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2113
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2114
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2115
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2116
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2117
    "
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
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2120
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2121
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2122
     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
  2123
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2124
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2125
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2126
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2127
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2128
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2129
     |dialog|
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
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2132
     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
  2133
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2134
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2135
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2136
     dialog accepted ifTrue:[Transcript showCr:'yes'].
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
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2139
    "Modified: 9.2.1996 / 22:14:17 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2140
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2141
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2142
addButton:aButton after:someOtherButtonOrNil
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2143
    "add a button into the buttonPanel.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2144
     If the argument someOtherButtonOrNil is nil, the button is
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2145
     added at the end."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2146
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2147
    |h|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2148
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2149
    buttonPanel addSubView:aButton after:someOtherButtonOrNil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2150
    buttonPanel subViews size > 1 ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2151
        buttonPanel horizontalLayout:#fitSpace.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2152
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2153
    (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2154
         buttonPanel topInset:h negated
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2155
    ].
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2156
    needResize := true.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2157
    ^ aButton
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2158
344
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|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2161
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2162
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2163
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2164
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2165
     dialog addButton:(Button 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2166
                        label:'foo' 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2167
                        action:[dialog hide. Transcript showCr:'foo'])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2168
                after:(dialog okButton).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2169
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2170
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2171
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2172
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2173
     |dialog|
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
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2176
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2177
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2178
     dialog addButton:(Button 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2179
                        label:'foo' 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2180
                        action:[dialog hide. Transcript showCr:'foo'])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2181
                after:(dialog abortButton).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2182
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2183
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2184
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2185
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2186
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2187
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2188
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2189
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2190
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2191
     dialog addButton:(Button 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2192
                        label:'foo' 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2193
                        action:[dialog hide. Transcript showCr:'foo'])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2194
                after:nil.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2195
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2196
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2197
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2198
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2199
    "Modified: 9.2.1996 / 22:13:51 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2200
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2201
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2202
addButton:aButton before:someOtherButtonOrNil
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2203
    "add a button into the buttonPanel.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2204
     If the argument someOtherButtonOrNil is nil, the button is
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2205
     added upFront."
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2206
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2207
    |h|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2208
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2209
    buttonPanel addSubView:aButton before:someOtherButtonOrNil.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2210
    buttonPanel subViews size > 1 ifTrue:[
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2211
        buttonPanel horizontalLayout:#fitSpace.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2212
    ].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2213
    (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2214
         buttonPanel topInset:h negated
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2215
    ].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2216
    needResize := true.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2217
    ^ aButton
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2218
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2219
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2220
     |dialog|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2221
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2222
     dialog := DialogBox new.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2223
     dialog addAbortButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2224
     dialog addOkButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2225
     dialog addButton:(Button 
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2226
                        label:'foo' 
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2227
                        action:[dialog hide. Transcript showCr:'foo'])
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2228
                before:(dialog okButton).
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2229
     dialog open.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2230
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2231
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2232
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2233
     |dialog|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2234
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2235
     dialog := DialogBox new.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2236
     dialog addAbortButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2237
     dialog addOkButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2238
     dialog addButton:(Button 
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2239
                        label:'foo' 
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2240
                        action:[dialog hide. Transcript showCr:'foo'])
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2241
                before:nil.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2242
     dialog open.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2243
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2244
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2245
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2246
    "Modified: 9.2.1996 / 22:13:51 / cg"
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2247
    "Created: 10.2.1996 / 16:04:35 / cg"
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2248
!
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2249
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2250
addCheckBox:label on:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2251
    "create a checkBox with label on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2252
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2253
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2254
    ^ self addCheckBox:label on:aModel tabable:true
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2255
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
     |dialog check|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2258
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2259
     check := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2260
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2261
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2262
     dialog addCheckBox:'on or off' on:check.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2263
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2264
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2265
     dialog accepted ifTrue:[Transcript showCr:check value].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2266
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2267
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2268
    "Modified: 9.2.1996 / 22:15:38 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2269
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2270
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2271
addCheckBox:label on:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2272
    "create a checkBox with label on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2273
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2274
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2275
    |b|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2276
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2277
    b := CheckBox on:aModel.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2278
    b label:label.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2279
    self addComponent:b tabable:tabable.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2280
    ^ b
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2281
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2282
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2283
     |dialog check1 check2 check3|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2284
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2285
     check1 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2286
     check2 := false asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2287
     check3 := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2288
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2289
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2290
     dialog addCheckBox:'on or off' on:check1 tabable:false.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2291
     dialog addHorizontalLine.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2292
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2293
     dialog addCheckBox:'on or off' on:check2 tabable:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2294
     dialog addCheckBox:'on or off' on:check3 tabable:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2295
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2296
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2297
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2298
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2299
    "Modified: 9.2.1996 / 22:16:49 / cg"
120
claus
parents: 118
diff changeset
  2300
!
claus
parents: 118
diff changeset
  2301
130
claus
parents: 128
diff changeset
  2302
addColumn:aRow fromX:leftX toX:rightX collect:aBlock
claus
parents: 128
diff changeset
  2303
    "add some elements in a vertical column.
claus
parents: 128
diff changeset
  2304
     Equally space elements as returned from aBlock."
claus
parents: 128
diff changeset
  2305
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2306
    self 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2307
        addColumn:aRow 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2308
        fromX:leftX toX:rightX 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2309
        collect:aBlock 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2310
        tabable:false
130
claus
parents: 128
diff changeset
  2311
claus
parents: 128
diff changeset
  2312
    "
claus
parents: 128
diff changeset
  2313
     |dialog|
claus
parents: 128
diff changeset
  2314
claus
parents: 128
diff changeset
  2315
     dialog := Dialog new.
claus
parents: 128
diff changeset
  2316
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2317
        addColumn:#('label1' 'label2' 'lbl3' 'l4' 'label5')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2318
        fromX:0.0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2319
        toX:1.0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2320
        collect:[:label | Label label:label].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2321
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2322
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2323
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2324
    "
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
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2327
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2328
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2329
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2330
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2331
        addColumn:#('label1' 'label2' 'label3' 'label4' 'label5')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2332
        fromX:0.25 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2333
        toX:0.75
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2334
        collect:[:label | (Label label:label) adjust:#left].
130
claus
parents: 128
diff changeset
  2335
claus
parents: 128
diff changeset
  2336
     dialog addOkButton.
claus
parents: 128
diff changeset
  2337
     dialog open.
claus
parents: 128
diff changeset
  2338
    "
claus
parents: 128
diff changeset
  2339
claus
parents: 128
diff changeset
  2340
    "
claus
parents: 128
diff changeset
  2341
     |dialog y|
claus
parents: 128
diff changeset
  2342
claus
parents: 128
diff changeset
  2343
     dialog := Dialog new.
claus
parents: 128
diff changeset
  2344
     y := dialog yPosition.
claus
parents: 128
diff changeset
  2345
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2346
        addColumn:#('a1' 'b1' 'c1' 'd1')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2347
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2348
        toX:(1/3) 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2349
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  2350
claus
parents: 128
diff changeset
  2351
     dialog yPosition:y.
claus
parents: 128
diff changeset
  2352
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2353
        addColumn:#('a2' 'b2' 'c2' 'd2')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2354
        fromX:(1/3)
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2355
        toX:(2/3) 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2356
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  2357
claus
parents: 128
diff changeset
  2358
     dialog yPosition:y.
claus
parents: 128
diff changeset
  2359
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2360
        addColumn:#('a3' 'b3' 'c3' 'd3')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2361
        fromX:(2/3)
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2362
        toX:1 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2363
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  2364
claus
parents: 128
diff changeset
  2365
     dialog addOkButton.
claus
parents: 128
diff changeset
  2366
     dialog open.
claus
parents: 128
diff changeset
  2367
    "
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2368
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2369
    "Modified: 9.2.1996 / 22:22:12 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2370
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2371
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2372
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2373
    "add some elements in a vertical column.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2374
     Equally space elements as returned from aBlock."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2375
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2376
    self 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2377
        addColumn:aRow 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2378
        fromX:leftX toX:rightX 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2379
        collect:aBlock 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2380
        tabable:tabable 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2381
        horizontalLayout:#fitSpace 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2382
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2383
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2384
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2385
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2386
     values := (1 to:4) collect:[:dummy | '' asValue].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2387
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2388
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2389
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2390
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2391
        addColumn:#('one' 'two' 'three' 'four')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2392
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2393
        toX:0.3 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2394
        collect:[:label | Label label:label].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2395
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2396
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2397
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2398
        addColumn:values
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2399
        fromX:0.3
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2400
        toX:1.0 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2401
        collect:[:value | EditField on:value]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2402
        tabable:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2403
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2404
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2405
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2406
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2407
     dialog accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2408
        Transcript showCr:(values collect:[:holder | holder value])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2409
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2410
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2411
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2412
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2413
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2414
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2415
     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
  2416
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2417
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2418
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2419
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2420
        addColumn:(1 to:4)
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2421
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2422
        toX:0.5 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2423
        collect:[:idx | CheckToggle on:(values at:idx)]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2424
        tabable:true
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2425
        horizontalLayout:#center.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2426
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2427
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2428
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2429
        addColumn:(5 to:8) 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2430
        fromX:0.5 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2431
        toX:1.0 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2432
        collect:[:idx | CheckToggle on:(values at:idx)]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2433
        tabable:true
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2434
        horizontalLayout:#center.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2435
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2436
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2437
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2438
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2439
     dialog accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2440
        Transcript showCr:(values collect:[:holder | holder value])
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
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2443
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2444
    "Created: 9.2.1996 / 21:51:47 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2445
    "Modified: 9.2.1996 / 22:22:02 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2446
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2447
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2448
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
  2449
    "add some elements in a vertical column.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2450
     Equally space elements as returned from aBlock."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2451
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2452
    |helper component|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2453
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2454
    helper := VerticalPanelView new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2455
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2456
    aRow do:[:el |
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2457
        component := aBlock value:el.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2458
        helper add:component.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2459
        component resize.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2460
        tabable ifTrue:[self makeTabable:component].
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
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2463
    helper resize.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2464
    self addComponent:helper.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2465
    width < helper preferredExtent x ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2466
        self width:helper preferredExtent x.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2467
        "/ Transcript show:'w now: '; showCr:helper preferredExtent x
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2468
    ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2469
    helper horizontalLayout:hLayout.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2470
    helper left:leftX asFloat;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2471
           right:rightX asFloat;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2472
           leftInset:leftIndent;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2473
           rightInset:rightIndent.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2474
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2475
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2476
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2477
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2478
     values := (1 to:4) collect:[:dummy | '' asValue].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2479
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2480
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2481
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2482
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2483
        addColumn:#('one' 'two' 'three' 'four')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2484
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2485
        toX:0.3 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2486
        collect:[:label | Label label:label].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2487
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2488
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2489
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2490
        addColumn:values
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2491
        fromX:0.3
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2492
        toX:1.0 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2493
        collect:[:value | EditField on:value]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2494
        tabable:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2495
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2496
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2497
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2498
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2499
     dialog accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2500
        Transcript showCr:(values collect:[:holder | holder value])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2501
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2502
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2503
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2504
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2505
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2506
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2507
     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
  2508
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2509
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2510
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2511
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2512
        addColumn:(1 to:4)
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2513
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2514
        toX:0.5 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2515
        collect:[:idx | CheckToggle on:(values at:idx)].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2516
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2517
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2518
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2519
        addColumn:(5 to:8) 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2520
        fromX:0.5 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2521
        toX:1.0 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2522
        collect:[:idx | CheckToggle on:(values at:idx)]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2523
        tabable:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2524
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2525
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2526
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2527
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2528
     dialog accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2529
        Transcript showCr:(values collect:[:holder | holder value])
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2530
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2531
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2532
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2533
    "Modified: 9.2.1996 / 22:02:22 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2534
    "Created: 9.2.1996 / 22:20:31 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2535
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2536
471
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2537
addComboBoxOn:aModel
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2538
    "create a comboBoxView on aModel and add it.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2539
     Returns the comboBoxView."
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2540
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2541
    ^ self addComboBoxOn:aModel tabable:true
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2542
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2543
    "
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2544
     without a list, the comboBox is disabled:
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2545
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2546
     |box val|
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2547
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2548
     val := 'some input' asValue.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2549
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2550
     box := Dialog new.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2551
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2552
     (box addTextLabel:'combo box example') adjust:#left.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2553
     box addVerticalSpace.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2554
     (box addComboBoxOn:val).
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2555
     box addOkButton.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2556
     box open.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2557
     box accepted ifTrue:[
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2558
        Transcript showCr:val value
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2559
     ].
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2560
    "
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2561
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2562
    "with a list, it can be pulled:
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2563
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2564
     |box val|
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2565
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2566
     val := '' asValue.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2567
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2568
     box := Dialog new.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2569
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2570
     (box addTextLabel:'combo box example') adjust:#left.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2571
     box addVerticalSpace.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2572
     (box addComboBoxOn:val) list:#('one' 'two' 'three' 'four').
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2573
     box addOkButton.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2574
     box open.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2575
     box accepted ifTrue:[
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2576
        Transcript showCr:val value
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2577
     ].
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2578
    "
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2579
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2580
    "Modified: 28.2.1996 / 15:17:39 / cg"
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2581
    "Created: 4.3.1996 / 17:21:45 / cg"
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2582
!
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2583
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2584
addComboBoxOn:aModel tabable:tabable
471
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2585
    "create a comboBoxView on aModel and add it.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2586
     Returns the comboBoxView."
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2587
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2588
    |f|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2589
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2590
    f := ComboBoxView new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2591
    f model:aModel.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2592
    self addComponent:f tabable:tabable.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2593
    tabable ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2594
        self addToInputFieldGroup:f editor.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2595
    ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2596
    ^ f
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2597
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2598
    "
423
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2599
     without a list, the comboBox is disabled:
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2600
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2601
     |box val|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2602
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2603
     val := 'some input' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2604
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2605
     box := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2606
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2607
     (box addTextLabel:'combo box example') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2608
     box addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2609
     (box addComboBoxOn:val tabable:true).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2610
     box addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2611
     box open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2612
     box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2613
        Transcript showCr:val value
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2614
     ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2615
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2616
423
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2617
    "with a list, it can be pulled:
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2618
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2619
     |box val|
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2620
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2621
     val := '' asValue.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2622
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2623
     box := Dialog new.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2624
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2625
     (box addTextLabel:'combo box example') adjust:#left.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2626
     box addVerticalSpace.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2627
     (box addComboBoxOn:val tabable:true) list:#('one' 'two' 'three' 'four').
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2628
     box addOkButton.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2629
     box open.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2630
     box accepted ifTrue:[
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2631
        Transcript showCr:val value
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2632
     ].
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2633
    "
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2634
471
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2635
    "Modified: 4.3.1996 / 17:21:57 / cg"
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2636
!
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2637
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2638
addComboListOn:aModel
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2639
    "create a comboListView on aModel and add it.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2640
     Returns the comboListView."
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2641
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2642
    ^ self addComboListOn:aModel tabable:true 
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2643
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2644
    "without a list, the comboList is disabled:
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2645
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2646
     |box val|
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2647
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2648
     val := 'some input' asValue.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2649
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2650
     box := Dialog new.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2651
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2652
     (box addTextLabel:'combo list example') adjust:#left.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2653
     box addVerticalSpace.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2654
     (box addComboListOn:val).
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2655
     box addOkButton.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2656
     box open.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2657
     box accepted ifTrue:[
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2658
        Transcript showCr:val value
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2659
     ].
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2660
    "
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2661
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2662
    "with a list, it can be pulled:
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2663
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2664
     |box val|
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2665
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2666
     val := '' asValue.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2667
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2668
     box := Dialog new.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2669
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2670
     (box addTextLabel:'combo box example') adjust:#left.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2671
     box addVerticalSpace.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2672
     (box addComboListOn:val) list:#('one' 'two' 'three' 'four').
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2673
     box addOkButton.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2674
     box open.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2675
     box accepted ifTrue:[
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2676
        Transcript showCr:val value
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2677
     ].
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2678
    "
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2679
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2680
    "Created: 28.2.1996 / 15:16:34 / cg"
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2681
    "Modified: 4.3.1996 / 17:22:59 / cg"
423
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2682
!
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2683
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2684
addComboListOn:aModel tabable:tabable
471
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2685
    "create a comboListView on aModel and add it.
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2686
     Returns the comboListView."
423
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2687
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2688
    |f|
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2689
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2690
    f := ComboListView new.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2691
    f model:aModel.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2692
    self addComponent:f tabable:tabable.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2693
    ^ f
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2694
424
1468956c1680 commentary
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  2695
    "without a list, the comboList is disabled:
1468956c1680 commentary
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  2696
423
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2697
     |box val|
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2698
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2699
     val := 'some input' asValue.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2700
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2701
     box := Dialog new.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2702
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2703
     (box addTextLabel:'combo list example') adjust:#left.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2704
     box addVerticalSpace.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2705
     (box addComboListOn:val tabable:true).
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2706
     box addOkButton.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2707
     box open.
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2708
     box accepted ifTrue:[
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2709
        Transcript showCr:val value
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2710
     ].
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2711
    "
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2712
424
1468956c1680 commentary
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  2713
    "with a list, it can be pulled:
1468956c1680 commentary
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  2714
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2715
     |box val|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2716
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2717
     val := '' asValue.
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
     box := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2720
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2721
     (box addTextLabel:'combo box example') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2722
     box addVerticalSpace.
471
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2723
     (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
  2724
     box addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2725
     box open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2726
     box accepted ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2727
        Transcript showCr:val value
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2728
     ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2729
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2730
423
17f68f3dbeb6 added #addComboList
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
  2731
    "Created: 28.2.1996 / 15:16:34 / cg"
471
9dcbc67366ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
  2732
    "Modified: 4.3.1996 / 17:23:38 / cg"
130
claus
parents: 128
diff changeset
  2733
!
claus
parents: 128
diff changeset
  2734
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2735
addComponent:aComponent
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2736
    "add any component with its preferred height and full width.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2737
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2738
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2739
    ^ self addComponent:aComponent indent:nil tabable:false
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2740
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2741
    "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
  2742
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2743
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2744
addComponent:aComponent indent:indent
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2745
    "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
  2746
     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
  2747
     Returns the component."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2748
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2749
    ^ self addComponent:aComponent indent:indent tabable:false
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2750
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2751
    "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
  2752
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2753
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2754
addComponent:aComponent indent:indent tabable:tabable
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2755
    "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
  2756
     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
  2757
     Returns the component."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2758
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2759
    |oldLeft oldRight result|
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2760
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2761
    oldLeft := leftIndent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2762
    oldRight := rightIndent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2763
    indent notNil ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2764
        leftIndent := rightIndent := indent.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2765
    ].
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2766
    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
  2767
    leftIndent := oldLeft.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2768
    rightIndent := oldRight.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2769
    ^ result
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2770
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2771
    "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
  2772
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2773
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2774
addComponent:aComponent indent:indent withExtent:ext 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2775
    "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
  2776
     Returns the component."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2777
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2778
    |fullSize lI rI|
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2779
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2780
    indent isNil ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2781
        lI := leftIndent.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2782
        rI := rightIndent.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2783
    ] ifFalse:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2784
        lI := rI := indent
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2785
    ].
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2786
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2787
    self basicAddComponent:aComponent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2788
    fullSize := ext + (lI + rI @ 0).
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2789
    aComponent extent:fullSize.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2790
    aComponent origin:0.0@yPosition; 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2791
               leftInset:lI; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2792
               rightInset:rI.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2793
    yPosition := yPosition + aComponent height + ViewSpacing.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2794
    width := fullSize x max:width.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2795
    needResize := true.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2796
    ^ aComponent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2797
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2798
    "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
  2799
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2800
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2801
addComponent:aComponent indent:indent withHeight:height 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2802
    "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
  2803
     Returns the component."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2804
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2805
    |lI rI|
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2806
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2807
    indent isNil ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2808
        lI := leftIndent.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2809
        rI := rightIndent.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2810
    ] ifFalse:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2811
        lI := rI := indent
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2812
    ].
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2813
    self basicAddComponent:aComponent.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2814
    aComponent height:height.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2815
    aComponent origin:0.0@yPosition; 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2816
               width:1.0; 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2817
               leftInset:lI;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2818
               rightInset:rI.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2819
    yPosition := yPosition + "aComponent" height + ViewSpacing.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2820
    needResize := true.
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2821
    ^ aComponent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2822
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2823
    "Modified: 9.2.1996 / 22:22:58 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2824
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2825
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2826
addComponent:aComponent tabable:tabable
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2827
    "add any component with its preferred height and full width.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2828
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2829
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2830
    ^ self addComponent:aComponent tabable:tabable tabbedComponent:aComponent
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2831
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2832
    "Modified: 9.2.1996 / 22:23:04 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2833
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2834
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2835
addComponent:aComponent tabable:tabable tabbedComponent:subComponent
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2836
    "add any component with its preferred height and full width.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2837
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2838
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2839
    tabable ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2840
        tabableElements isNil ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2841
            tabableElements := OrderedCollection new
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2842
        ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2843
        tabableElements add:subComponent
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2844
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2845
    ^ self addComponent:aComponent 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2846
           withHeight:(aComponent preferredExtent y).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2847
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2848
    "Modified: 9.2.1996 / 22:23:07 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2849
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2850
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2851
addComponent:aComponent withExtent:ext 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2852
    "add any component with some given extent.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2853
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2854
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2855
    ^ self addComponent:aComponent indent:nil withExtent:ext
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2856
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2857
    "Modified: 9.2.1996 / 22:23:11 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2858
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2859
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2860
addComponent:aComponent withHeight:height 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2861
    "add any component with some given height and full width.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2862
     Returns the component."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2863
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2864
    ^ self addComponent:aComponent indent:nil withHeight:height
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2865
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2866
    "Modified: 9.2.1996 / 22:23:15 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2867
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2868
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2869
addFilenameInputFieldOn:aModel in:aDirectory tabable:tabable
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2870
    "create a fileName input field on aModel and add it.
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2871
     Returns the field. This is much like a normal input field,
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2872
     but supports filename completion."
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2873
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2874
    |f|
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2875
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2876
    f := FilenameEditField new.
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2877
    aDirectory notNil ifTrue:[f directory:aDirectory].
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2878
    f model:aModel.
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2879
    self addInputField:f tabable:tabable.
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2880
    ^ f
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2881
!
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  2882
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2883
addHelpButtonFor:pathToHelpText 
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2884
    "add a help button to the buttonPanel.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2885
     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
  2886
     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
  2887
     directory."
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2888
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2889
    |helpButton|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2890
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2891
    helpButton := Button label:(resources string:'help').
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2892
    helpButton action:[
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2893
        self withWaitCursorDo:[XtHTML openFullOnHelpFile:pathToHelpText]].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2894
    ^ self addButton:helpButton before:nil.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2895
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2896
    "Created: 17.9.1995 / 20:17:26 / claus"
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2897
    "Modified: 10.2.1996 / 16:47:23 / cg"
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2898
!
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  2899
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2900
addHorizontalLine
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2901
    "add a horizontal line as separator"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2902
550
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2903
    ^ self addComponent:(Separator new extent:1.0 @ 5).
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2904
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2905
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2906
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2907
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2908
     dialog := DialogBox new.
550
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2909
     dialog 
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2910
        addTextLabel:'some title string';
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2911
        addHorizontalLine;
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2912
        addTextLabel:'more text';
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2913
        addOkButton;
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2914
        open.
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2915
    "
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2916
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2917
    "
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2918
     |dialog|
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2919
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2920
     dialog := DialogBox new.
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2921
     dialog 
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2922
        addTextLabel:'some title string';
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2923
        addHorizontalLine;
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2924
        addTextLabel:'more text'.
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2925
     (dialog addHorizontalLine) width:20.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2926
     dialog addTextLabel:'more text'.
550
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2927
     (dialog addHorizontalLine) width:20.
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2928
     dialog 
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2929
        addTextLabel:'more text';
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2930
        addHorizontalLine;
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2931
        addOkButton;
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2932
        open.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2933
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2934
550
c1612175d83e addHorizontalLine returns the added component
Claus Gittinger <cg@exept.de>
parents: 549
diff changeset
  2935
    "Modified: 19.4.1996 / 15:11:30 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2936
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2937
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2938
addInputField:aField
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2939
    "add an already created input field.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2940
     Returns the field."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2941
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2942
    ^ self addInputField:aField tabable:true
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2943
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2944
    "Modified: 9.2.1996 / 20:46:16 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2945
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2946
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2947
addInputField:aField tabable:tabable
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2948
    "add an already created input field.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2949
     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
  2950
     stepping through the fields with #Cursor/#Return keys.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2951
     Returns the field."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2952
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2953
    self addComponent:aField tabable:tabable.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2954
    tabable ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2955
        self addToInputFieldGroup:aField.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2956
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2957
    ^ aField
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2958
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2959
    "Modified: 9.2.1996 / 20:47:28 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2960
!
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
addInputFieldOn:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2963
    "create an input field on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2964
     Returns the field."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2965
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2966
    ^ self addInputFieldOn:aModel tabable:true
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2967
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2968
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2969
     |dialog model field|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2970
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2971
     model := '' asValue.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2972
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2973
     dialog := DialogBox new.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2974
     (dialog addTextLabel:'enter a string') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2975
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2976
     field := dialog addInputFieldOn:model.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2977
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2978
     dialog addAbortButton; addOkButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2979
     dialog open.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2980
     dialog accepted ifTrue:[Transcript showCr:model value].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2981
    "
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2982
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2983
    "Modified: 9.2.1996 / 21:34:14 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2984
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2985
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2986
addInputFieldOn:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2987
    "create an input field on aModel and add it.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2988
     If tabable is false, the field cannot be tabbed into
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2989
     and return does not close the box.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2990
     (pointer must be moved into it).
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2991
     Returns the field."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2992
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2993
    |f|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2994
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2995
    f := EditField new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2996
    f model:aModel.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2997
    self addInputField:f tabable:tabable.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2998
    ^ f
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  2999
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3000
    " a non-tabable field:
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3001
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3002
     |dialog model field|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3003
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3004
     model := '' asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3005
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3006
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3007
     (dialog addTextLabel:'enter a string') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3008
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3009
     field := dialog addInputFieldOn:model tabable:false.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3010
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3011
     dialog addAbortButton; addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3012
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3013
     dialog accepted ifTrue:[Transcript showCr:model value].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3014
    "
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
    "Modified: 9.2.1996 / 21:36:16 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3017
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3018
535
84282b53f2a7 renamed #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 534
diff changeset
  3019
addLabelledInputField:labelString adjust:labelAdjust on:model tabable:tabable separateAtX:relativeX
534
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3020
    "add a label and an inputField side-by-side.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3021
     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
  3022
     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
  3023
     The inputField gets model as its model.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3024
     Return the inputField."
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3025
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3026
    |y lbl field|
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3027
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3028
    y := self yPosition.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3029
    lbl := self addTextLabel:labelString.
552
0e9be94135ab oops - labelled inputFields with left-inset being non-0
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3030
    lbl rightInset:0.
534
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3031
    lbl width:relativeX; adjust:labelAdjust; borderWidth:0.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3032
    self yPosition:y.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3033
    field := self addInputFieldOn:model tabable:tabable.
552
0e9be94135ab oops - labelled inputFields with left-inset being non-0
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3034
    field leftInset:0.
534
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3035
    field width:(1.0 - relativeX); left:relativeX.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3036
    ^ field
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3037
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3038
    "
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3039
     |dialog model field|
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3040
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3041
     model := '' asValue.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3042
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3043
     dialog := DialogBox new.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3044
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3045
     field := dialog 
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3046
                addLabelledInputField:'enter a string' 
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3047
                adjust:#left 
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3048
                on:model 
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3049
                tabable:true 
535
84282b53f2a7 renamed #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 534
diff changeset
  3050
                separateAtX:0.3.
534
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3051
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3052
     dialog addAbortButton; addOkButton.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3053
     dialog open.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3054
     dialog accepted ifTrue:[Transcript showCr:model value].
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3055
    "
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3056
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3057
    "
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3058
     |dialog model1 model2 field|
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3059
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3060
     model1 := '' asValue.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3061
     model2 := '' asValue.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3062
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3063
     dialog := DialogBox new.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3064
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3065
     dialog addTextLabel:'a two-input box'.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3066
     dialog addHorizontalLine.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3067
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3068
     field := dialog 
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3069
                addLabelledInputField:'string1:' 
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3070
                adjust:#right 
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3071
                on:model1 
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3072
                tabable:true 
535
84282b53f2a7 renamed #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 534
diff changeset
  3073
                separateAtX:0.4.
534
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3074
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3075
     field := dialog 
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3076
                addLabelledInputField:'string2:' 
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3077
                adjust:#right 
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3078
                on:model2 
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3079
                tabable:true 
535
84282b53f2a7 renamed #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 534
diff changeset
  3080
                separateAtX:0.4.
534
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3081
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3082
     dialog addAbortButton; addOkButton.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3083
     dialog open.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3084
     dialog accepted ifTrue:[
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3085
        Transcript showCr:model1 value.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3086
        Transcript showCr:model2 value.
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3087
     ].
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3088
    "
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3089
535
84282b53f2a7 renamed #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 534
diff changeset
  3090
    "Created: 13.4.1996 / 13:41:31 / cg"
552
0e9be94135ab oops - labelled inputFields with left-inset being non-0
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3091
    "Modified: 19.4.1996 / 17:39:46 / cg"
534
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3092
!
26871bcd9473 added #addLabelledInputField... method
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3093
381
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3094
addListBoxOn:aModel
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3095
    "add a selectionInListView to the box"
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3096
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3097
    ^ self 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3098
        addListBoxOn:aModel 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3099
        withNumberOfLines:nil 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3100
        hScrollable:false 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3101
        vScrollable:true. 
381
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3102
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3103
    "
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3104
     |dialog model listView|
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3105
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3106
     model := SelectionInList new.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3107
     model list:#('one' 'two' 'three' 'four').
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3108
     model selectionIndex:2.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3109
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3110
     dialog := DialogBox new.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3111
     (dialog addTextLabel:'select any') adjust:#left.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3112
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3113
     listView := dialog addListBoxOn:model.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3114
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3115
     dialog addAbortButton; addOkButton.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3116
     dialog open.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3117
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3118
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:model selection].
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3119
    "
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3120
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3121
    "Modified: 19.4.1996 / 13:05:42 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3122
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3123
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3124
addListBoxOn:aModel class:aListViewClass
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3125
    "create & add an instance of aListViewClass to the box"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3126
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3127
    ^ self 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3128
        addListBoxOn:aModel
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3129
        class:aListViewClass
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3130
        withNumberOfLines:nil 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3131
        hScrollable:false 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3132
        vScrollable:true.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3133
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3134
    "Created: 19.4.1996 / 13:06:14 / cg"
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3135
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3136
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3137
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3138
    "create and add an instance of aListViewClass to the box.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3139
     The list has numLines (if nonNil) number of lines shown."
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3140
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3141
    ^ self 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3142
        addListBoxOn:aModel
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3143
        class:aListViewClass
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3144
        withNumberOfLines:numLines 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3145
        hScrollable:false 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3146
        vScrollable:true.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3147
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3148
    "Created: 19.4.1996 / 13:05:05 / cg"
381
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3149
!
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3150
436
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3151
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3152
    "add an instance ofaListViewClass selectionInListView to the box.
381
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3153
     The list has numLines (if nonNil) number of lines shown."
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3154
436
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3155
    |l scr h dH|
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3156
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3157
    l := aListViewClass new.
381
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3158
    l model:aModel.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3159
    l doubleClickAction:[:name | self okPressed].
436
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3160
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3161
    vs ifTrue:[
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3162
        hs ifTrue:[
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3163
            scr := HVScrollableView forView:l miniScrollerH:true .
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3164
        ] ifFalse:[
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3165
            scr := ScrollableView forView:l
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3166
        ].
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3167
        scr resize.
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3168
        "/ Transcript show:scr height; show:' '; showCr:l height.
436
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3169
        dH := scr height - l height.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3170
    ] ifFalse:[
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3171
        l level:-1.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3172
        scr := l.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3173
        dH := 0.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3174
    ].
381
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3175
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3176
    numLines notNil ifTrue:[
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3177
        h := l heightForLines:numLines.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3178
    ] ifFalse:[
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3179
        h := l preferredExtent y
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3180
    ].
436
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3181
    self addComponent:scr withHeight:(h + dH).
381
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3182
    ^ l
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3183
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3184
    "
436
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3185
     |dialog listView|
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3186
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3187
     dialog := DialogBox new.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3188
     (dialog addTextLabel:'select any') adjust:#left.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3189
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3190
     listView := dialog 
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3191
                        addListBoxOn:nil 
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3192
                        class:FileSelectionList
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3193
                        withNumberOfLines:10 
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3194
                        hScrollable:false 
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3195
                        vScrollable:false.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3196
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3197
     listView directory:'/etc'.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3198
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3199
     dialog addAbortButton; addOkButton.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3200
     dialog open.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3201
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3202
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:listView selectionValue].
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3203
    "
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3204
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3205
    "Created: 22.2.1996 / 15:40:07 / cg"
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3206
    "Modified: 19.4.1996 / 13:08:55 / cg"
436
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3207
!
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3208
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3209
addListBoxOn:aModel withNumberOfLines:numLines
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3210
    "add a selectionInListView to the box.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3211
     The list has numLines (if nonNil) number of lines shown."
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3212
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3213
    ^ self 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3214
        addListBoxOn:aModel 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3215
        withNumberOfLines:numLines 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3216
        hScrollable:false 
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3217
        vScrollable:true. 
436
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3218
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3219
    "
381
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3220
     |dialog model listView|
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3221
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3222
     model := SelectionInList new.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3223
     model list:#('one' 'two' 'three' 'four').
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3224
     model selectionIndex:2.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3225
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3226
     dialog := DialogBox new.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3227
     (dialog addTextLabel:'select any') adjust:#left.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3228
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3229
     listView := dialog addListBoxOn:model withNumberOfLines:3.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3230
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3231
     dialog addAbortButton; addOkButton.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3232
     dialog open.
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3233
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3234
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:model selection].
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3235
    "
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3236
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3237
    "Created: 22.2.1996 / 15:40:07 / cg"
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  3238
    "Modified: 19.4.1996 / 13:04:34 / cg"
381
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3239
!
49fc4e7d81b7 added #addListBoxOn:
Claus Gittinger <cg@exept.de>
parents: 374
diff changeset
  3240
436
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3241
addListBoxOn:aModel withNumberOfLines:numLines hScrollable:hs vScrollable:vs
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3242
    "add a selectionInListView to the box.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3243
     The list has numLines (if nonNil) number of lines shown."
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3244
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3245
    ^ self 
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3246
        addListBoxOn:aModel 
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3247
        class:SelectionInListView
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3248
        withNumberOfLines:numLines 
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3249
        hScrollable:hs 
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3250
        vScrollable:vs
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3251
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3252
    "
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3253
     |dialog model listView|
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3254
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3255
     model := SelectionInList new.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3256
     model list:#('one' 'two' 'three' 'four').
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3257
     model selectionIndex:2.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3258
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3259
     dialog := DialogBox new.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3260
     (dialog addTextLabel:'select any') adjust:#left.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3261
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3262
     listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:true vScrollable:true.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3263
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3264
     dialog addAbortButton; addOkButton.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3265
     dialog open.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3266
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3267
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:model selection].
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3268
    "
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3269
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3270
    "
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3271
     |dialog model listView|
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3272
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3273
     model := SelectionInList new.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3274
     model list:#('one' 'two' 'three' 'four').
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3275
     model selectionIndex:2.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3276
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3277
     dialog := DialogBox new.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3278
     (dialog addTextLabel:'select any') adjust:#left.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3279
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3280
     listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:false vScrollable:false.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3281
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3282
     dialog addAbortButton; addOkButton.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3283
     dialog open.
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3284
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3285
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:model selection].
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3286
    "
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3287
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3288
    "Created: 22.2.1996 / 15:40:07 / cg"
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3289
    "Modified: 22.2.1996 / 15:41:25 / cg"
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3290
!
c4530ec88b16 more addListBox protocol
ca
parents: 424
diff changeset
  3291
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3292
addOkButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3293
    "create an okButton - to be sent from redefined initialize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3294
     methods in subclasses or when creating a box programmatically.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3295
     Returns the button."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3296
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3297
    ^ self addOkButtonLabelled:nil
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3298
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3299
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3300
     |dialog|
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
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3303
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3304
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3305
     dialog accepted ifTrue:[Transcript showCr:'yes'].
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
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3308
    "Modified: 9.2.1996 / 21:37:02 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3309
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3310
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3311
addOkButton:aButton 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3312
    "add an already created okButton - to be sent from redefined initialize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3313
     methods in subclasses or when creating a box programmatically.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3314
     Returns the button."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3315
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3316
    okButton := aButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3317
    aButton model:self; change:#okPressed.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3318
    ^ self addButton:aButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3319
344
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 b|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3322
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3323
     b := Button label:((Image fromFile:'garfield.gif') magnifiedBy:0.5).
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
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3326
     dialog addOkButton:b.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3327
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3328
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3329
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3330
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3331
    "Modified: 17.9.1995 / 20:20:41 / claus"
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3332
    "Modified: 9.2.1996 / 21:38:48 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3333
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3334
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3335
addOkButtonLabelled:buttonLabel 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3336
    "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
  3337
     methods in subclasses or when creating a box programmatically.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3338
     A nil argument creates one with the default text.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3339
     Returns the button."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3340
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3341
    |aButton|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3342
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3343
    aButton := Button okButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3344
    buttonLabel notNil ifTrue:[aButton label:buttonLabel].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3345
    aButton isReturnButton:acceptReturnAsOK.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3346
    ^ self addOkButton:aButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3347
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3348
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3349
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3350
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3351
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3352
     dialog addOkButtonLabelled:'get out of here'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3353
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3354
     dialog accepted ifTrue:[Transcript showCr:'yes'].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3355
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3356
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3357
    "Modified: 9.2.1996 / 21:39:34 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3358
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3359
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3360
addPopUpList:labelString on:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3361
    "create a popUpList with a label on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3362
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3363
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3364
    ^ self addPopUpList:labelString on:aModel tabable:true
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3365
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3366
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3367
addPopUpList:labelString on:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3368
    "create a popUpList on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3369
     Returns the popUpList."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3370
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3371
    |p box l|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3372
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3373
    p := PopUpList on:aModel.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3374
    p resize; sizeFixed:true.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3375
    labelString notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3376
	box := HorizontalPanelView new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3377
	box borderWidth:0; horizontalLayout:#rightSpace.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3378
	box add:(l := Label label:labelString).
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3379
	l borderWidth:0.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3380
	box add:p.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3381
    ] ifFalse:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3382
	box := p.
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
    self addComponent:box tabable:tabable tabbedComponent:p.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3385
    ^ p
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3386
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3387
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3388
addPopUpListOn:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3389
    "create a popUpList on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3390
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3391
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3392
    ^ self addPopUpList:nil on:aModel tabable:true
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3393
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3394
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3395
addPopUpListOn:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3396
    "create a popUpList on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3397
     Returns the popUpList."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3398
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3399
    ^ self addPopUpList:nil on:aModel tabable:tabable
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3400
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3401
130
claus
parents: 128
diff changeset
  3402
addRow:aCol fromX:leftX toX:rightX collect:aBlock
claus
parents: 128
diff changeset
  3403
    "add some elements in a horizontal row.
claus
parents: 128
diff changeset
  3404
     Equally space elements as returned from aBlock.
claus
parents: 128
diff changeset
  3405
     Advance y."
claus
parents: 128
diff changeset
  3406
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3407
    self 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3408
        addRow:aCol 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3409
        fromX:leftX toX:rightX 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3410
        collect:aBlock 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3411
        tabable:true 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3412
        horizontalLayout:#spread 
130
claus
parents: 128
diff changeset
  3413
claus
parents: 128
diff changeset
  3414
    "
claus
parents: 128
diff changeset
  3415
     |dialog|
claus
parents: 128
diff changeset
  3416
claus
parents: 128
diff changeset
  3417
     dialog := Dialog new.
claus
parents: 128
diff changeset
  3418
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3419
        addRow:#('a' 'b' 'c' 'd')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3420
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3421
        toX:1
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3422
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  3423
claus
parents: 128
diff changeset
  3424
     dialog addOkButton.
claus
parents: 128
diff changeset
  3425
     dialog open.
claus
parents: 128
diff changeset
  3426
    "
claus
parents: 128
diff changeset
  3427
claus
parents: 128
diff changeset
  3428
    "
claus
parents: 128
diff changeset
  3429
     |dialog|
claus
parents: 128
diff changeset
  3430
claus
parents: 128
diff changeset
  3431
     dialog := Dialog new.
claus
parents: 128
diff changeset
  3432
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3433
        addRow:#('a1' 'b1' 'c1' 'd1')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3434
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3435
        toX:1 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3436
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  3437
claus
parents: 128
diff changeset
  3438
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3439
        addRow:#('a2' 'b2' 'c2' 'd2')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3440
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3441
        toX:0.5 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3442
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  3443
claus
parents: 128
diff changeset
  3444
     dialog 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3445
        addRow:#('a3' 'b3' 'c3' 'd3')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3446
        fromX:0.5
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3447
        toX:1 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3448
        collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  3449
claus
parents: 128
diff changeset
  3450
     dialog addOkButton.
claus
parents: 128
diff changeset
  3451
     dialog open.
claus
parents: 128
diff changeset
  3452
    "
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3453
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3454
    "Modified: 9.2.1996 / 22:25:16 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3455
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3456
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3457
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3458
    "add some elements in a horizontal row.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3459
     Equally space elements as returned from aBlock.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3460
     Advance y."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3461
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3462
    self 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3463
        addRow:aCol 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3464
        fromX:leftX toX:rightX 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3465
        collect:aBlock 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3466
        tabable:tabable 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3467
        horizontalLayout:#spread
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3468
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3469
    "Created: 9.2.1996 / 22:25:35 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3470
!
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
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
  3473
    "add some elements in a horizontal row.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3474
     Equally space elements as returned from aBlock.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3475
     Advance y."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3476
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3477
    |helper component|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3478
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3479
    helper := HorizontalPanelView new.
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
    aCol do:[:el |
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3482
        component := aBlock value:el.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3483
        component resize.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3484
        helper add:component.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3485
        tabable ifTrue:[self makeTabable:component]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3486
    ].    
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3487
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3488
    helper resize.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3489
    self addComponent:helper.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3490
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3491
    width < helper preferredExtent x ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3492
        self width:helper preferredExtent x.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3493
        "/ Transcript show:'w now: '; showCr:helper preferredExtent x
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3494
    ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3495
    helper horizontalLayout:hLayout.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3496
    helper verticalLayout:#fit.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3497
    helper left:leftX asFloat;
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3498
           right:rightX asFloat.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3499
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3500
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3501
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3502
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3503
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3504
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3505
        addRow:#('a' 'b' 'c' 'd')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3506
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3507
        toX:1
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3508
        collect:[:label | Label label:label]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3509
        tabable:false
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3510
        horizontalLayout:#fit.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3511
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3512
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3513
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3514
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3515
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3516
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3517
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3518
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3519
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3520
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3521
        addRow:#('one' 'two' 'three' 'four')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3522
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3523
        toX:1
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3524
        collect:[:label | Button label:label]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3525
        tabable:false
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3526
        horizontalLayout:#fit.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3527
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3528
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3529
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3530
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3531
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3532
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3533
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3534
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3535
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3536
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3537
        addRow:#('a1' 'b1' 'c1' 'd1')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3538
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3539
        toX:1 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3540
        collect:[:label | Label label:label].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3541
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3542
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3543
        addRow:#('a2' 'b2' 'c2' 'd2')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3544
        fromX:0
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3545
        toX:0.5 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3546
        collect:[:label | Label label:label].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3547
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3548
     dialog 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3549
        addRow:#('a3' 'b3' 'c3' 'd3')
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3550
        fromX:0.5
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3551
        toX:1 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3552
        collect:[:label | Label label:label].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3553
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3554
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3555
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3556
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3557
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3558
    "Created: 9.2.1996 / 22:24:31 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3559
    "Modified: 9.2.1996 / 22:28:14 / cg"
130
claus
parents: 128
diff changeset
  3560
!
claus
parents: 128
diff changeset
  3561
120
claus
parents: 118
diff changeset
  3562
addTextLabel:aString
claus
parents: 118
diff changeset
  3563
    "create a text label - the name has been choosen for ST-80 compatibility;
122
claus
parents: 121
diff changeset
  3564
     however, ST/X labels allow image labels too.
claus
parents: 121
diff changeset
  3565
     Returns the label."
120
claus
parents: 118
diff changeset
  3566
claus
parents: 118
diff changeset
  3567
    |l|
claus
parents: 118
diff changeset
  3568
claus
parents: 118
diff changeset
  3569
    l := Label new label:aString.
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3570
    l borderWidth:0.
120
claus
parents: 118
diff changeset
  3571
    self addComponent:l.
claus
parents: 118
diff changeset
  3572
    ^ l
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3573
120
claus
parents: 118
diff changeset
  3574
    "
claus
parents: 118
diff changeset
  3575
     |b|
claus
parents: 118
diff changeset
  3576
claus
parents: 118
diff changeset
  3577
     b := DialogBox new.
claus
parents: 118
diff changeset
  3578
     b addTextLabel:'hello'.
claus
parents: 118
diff changeset
  3579
     b showAtPointer
claus
parents: 118
diff changeset
  3580
    "
claus
parents: 118
diff changeset
  3581
    "
claus
parents: 118
diff changeset
  3582
     |b|
claus
parents: 118
diff changeset
  3583
claus
parents: 118
diff changeset
  3584
     b := DialogBox new.
claus
parents: 118
diff changeset
  3585
     b leftIndent:100.
claus
parents: 118
diff changeset
  3586
     b addTextLabel:'hello'.
claus
parents: 118
diff changeset
  3587
     b leftIndent:0.
claus
parents: 118
diff changeset
  3588
     b addTextLabel:'world'.
claus
parents: 118
diff changeset
  3589
     b showAtPointer
claus
parents: 118
diff changeset
  3590
    "
claus
parents: 118
diff changeset
  3591
    "
claus
parents: 118
diff changeset
  3592
     |b|
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3593
120
claus
parents: 118
diff changeset
  3594
     b := DialogBox new.
claus
parents: 118
diff changeset
  3595
     b addTextLabel:'hello'.
claus
parents: 118
diff changeset
  3596
     b addTextLabel:'world'.
claus
parents: 118
diff changeset
  3597
     b addOkButton.
claus
parents: 118
diff changeset
  3598
     b showAtPointer
claus
parents: 118
diff changeset
  3599
    "
claus
parents: 118
diff changeset
  3600
    "
claus
parents: 118
diff changeset
  3601
     |b|
claus
parents: 118
diff changeset
  3602
claus
parents: 118
diff changeset
  3603
     b := DialogBox new.
claus
parents: 118
diff changeset
  3604
     b addTextLabel:'hello'.
claus
parents: 118
diff changeset
  3605
     (b addTextLabel:'world') foregroundColor:Color red.
claus
parents: 118
diff changeset
  3606
     b addOkButton.
claus
parents: 118
diff changeset
  3607
     b showAtPointer
claus
parents: 118
diff changeset
  3608
    "
claus
parents: 118
diff changeset
  3609
    "
claus
parents: 118
diff changeset
  3610
     |b|
claus
parents: 118
diff changeset
  3611
claus
parents: 118
diff changeset
  3612
     b := DialogBox new.
claus
parents: 118
diff changeset
  3613
     b addTextLabel:'hello world\\How about this ?' withCRs.
claus
parents: 118
diff changeset
  3614
     b addOkButton.
claus
parents: 118
diff changeset
  3615
     b showAtPointer
claus
parents: 118
diff changeset
  3616
    "
claus
parents: 118
diff changeset
  3617
    "
claus
parents: 118
diff changeset
  3618
     |b|
claus
parents: 118
diff changeset
  3619
claus
parents: 118
diff changeset
  3620
     b := DialogBox new.
claus
parents: 118
diff changeset
  3621
     b addTextLabel:'hello world\\How about this ?' withCRs.
claus
parents: 118
diff changeset
  3622
     b addTextLabel:'not bad'.
claus
parents: 118
diff changeset
  3623
     b addAbortButton.
claus
parents: 118
diff changeset
  3624
     b addOkButton.
claus
parents: 118
diff changeset
  3625
     b showAtPointer
claus
parents: 118
diff changeset
  3626
    "
claus
parents: 118
diff changeset
  3627
!
claus
parents: 118
diff changeset
  3628
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3629
addToInputFieldGroup:aComponentOrSubcomponent
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3630
    "add a component to the input group."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3631
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3632
    inputFieldGroup isNil ifTrue:[
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3633
        inputFieldGroup := EnterFieldGroup new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3634
        inputFieldGroup leaveAction:[self lastFieldLeft].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3635
        aComponentOrSubcomponent hasKeyboardFocus:true.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3636
    ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3637
    inputFieldGroup add:aComponentOrSubcomponent.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3638
    self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus).
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3639
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3640
    "Created: 9.2.1996 / 20:23:04 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3641
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3642
122
claus
parents: 121
diff changeset
  3643
addVerticalSpace
claus
parents: 121
diff changeset
  3644
    "add a default vertical space (1 mm)"
claus
parents: 121
diff changeset
  3645
claus
parents: 121
diff changeset
  3646
    self addVerticalSpace:(ViewSpacing).
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3647
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3648
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3649
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3650
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3651
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3652
     dialog addTextLabel:'some title string'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3653
     dialog addVerticalSpace.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3654
     dialog addTextLabel:'more text'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3655
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3656
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3657
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3658
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3659
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3660
    "Modified: 9.2.1996 / 21:41:10 / cg"
122
claus
parents: 121
diff changeset
  3661
!
claus
parents: 121
diff changeset
  3662
claus
parents: 121
diff changeset
  3663
addVerticalSpace:nPixel
claus
parents: 121
diff changeset
  3664
    "add some pixels of space to the next component"
claus
parents: 121
diff changeset
  3665
claus
parents: 121
diff changeset
  3666
    yPosition := yPosition + nPixel.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3667
    needResize := true.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3668
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3669
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3670
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3671
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3672
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3673
     dialog addTextLabel:'some title string'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3674
     dialog addVerticalSpace:50.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3675
     dialog addTextLabel:'more text'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3676
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3677
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3678
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3679
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3680
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3681
    "Modified: 9.2.1996 / 21:41:23 / cg"
122
claus
parents: 121
diff changeset
  3682
!
claus
parents: 121
diff changeset
  3683
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3684
leftIndent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3685
    "return the current indent 
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3686
     (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
  3687
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3688
    ^ leftIndent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3689
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3690
    "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
  3691
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3692
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3693
leftIndent:aNumber 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3694
    "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
  3695
     will be located)."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3696
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3697
    leftIndent := aNumber.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3698
    needResize := true.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3699
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3700
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3701
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3702
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3703
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3704
     (dialog addTextLabel:'label1') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3705
     dialog leftIndent:20.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3706
     (dialog addTextLabel:'label2') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3707
     dialog leftIndent:40.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3708
     (dialog addTextLabel:'label3') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3709
     dialog leftIndent:60.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3710
     (dialog addTextLabel:'label4') adjust:#left.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3711
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3712
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3713
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3714
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3715
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3716
    "Modified: 9.2.1996 / 21:42:20 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3717
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3718
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3719
makeTabable:aComponentOrSubcomponent
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3720
    "add a component (usually a subcomponent, of which the dialog
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3721
     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
  3722
     stepped through via FocusNext/FocusPrevious)"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3723
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3724
    tabableElements isNil ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3725
        tabableElements := OrderedCollection new
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3726
    ].
276
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  3727
    tabableElements add:aComponentOrSubcomponent.
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  3728
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3729
    (aComponentOrSubcomponent isInputField) ifTrue:[
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3730
        self addToInputFieldGroup:aComponentOrSubcomponent
276
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  3731
    ].
431d83f33d8d tabable editFields added with makeTabable fixed (kludged)
ca
parents: 253
diff changeset
  3732
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3733
    "Modified: 4.3.1996 / 11:34:29 / cg"
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3734
!
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3735
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3736
makeTabable:aComponentOrSubcomponent before:anotherComponent
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3737
    "add a component (usually a subcomponent, of which the dialog
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3738
     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
  3739
     stepped through via FocusNext/FocusPrevious)"
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3740
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3741
    tabableElements isNil ifTrue:[
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3742
        tabableElements := OrderedCollection new
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3743
    ].
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3744
    anotherComponent isNil ifTrue:[
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3745
        tabableElements addFirst:aComponentOrSubcomponent
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3746
    ] ifFalse:[
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3747
        tabableElements add:aComponentOrSubcomponent before:anotherComponent.
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3748
    ].
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3749
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3750
    (aComponentOrSubcomponent isInputField) ifTrue:[
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3751
        self addToInputFieldGroup:aComponentOrSubcomponent
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3752
    ].
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3753
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3754
    "Modified: 4.3.1996 / 11:33:54 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3755
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3756
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3757
rightIndent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3758
    "return the current right indent."
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3759
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3760
    ^ rightIndent
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3761
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3762
    "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
  3763
!
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3764
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3765
rightIndent:aNumber 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3766
    "set the right indent"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3767
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3768
    rightIndent := aNumber.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3769
    needResize := true.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3770
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3771
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3772
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3773
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3774
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3775
     (dialog addTextLabel:'label1') adjust:#right.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3776
     dialog rightIndent:20.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3777
     (dialog addTextLabel:'label2') adjust:#right.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3778
     dialog rightIndent:40.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3779
     (dialog addTextLabel:'label3') adjust:#right.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3780
     dialog rightIndent:60.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3781
     (dialog addTextLabel:'label4') adjust:#right.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3782
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3783
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3784
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3785
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3786
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3787
    "Modified: 9.2.1996 / 21:42:46 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3788
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3789
122
claus
parents: 121
diff changeset
  3790
yPosition 
claus
parents: 121
diff changeset
  3791
    "return the current y position (thats where the next component
claus
parents: 121
diff changeset
  3792
     will be located)."
claus
parents: 121
diff changeset
  3793
claus
parents: 121
diff changeset
  3794
    ^ yPosition 
claus
parents: 121
diff changeset
  3795
!
claus
parents: 121
diff changeset
  3796
claus
parents: 121
diff changeset
  3797
yPosition:aNumber 
claus
parents: 121
diff changeset
  3798
    "set the current y position (thats where the next component
claus
parents: 121
diff changeset
  3799
     will be located)."
claus
parents: 121
diff changeset
  3800
claus
parents: 121
diff changeset
  3801
    yPosition := aNumber.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3802
    needResize := true.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3803
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3804
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3805
     |dialog pos|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3806
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3807
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3808
     pos := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3809
     (dialog addTextLabel:'label1') width:0.5.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3810
     dialog yPosition:pos.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3811
     (dialog addTextLabel:'label2') width:0.5; left:0.5.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3812
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3813
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3814
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3815
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3816
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3817
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3818
     |dialog pos|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3819
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3820
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3821
     pos := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3822
     #('one' 'two' 'three' 'four') 
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3823
     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
  3824
         dialog yPosition:pos.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3825
        (dialog addComponent:(Button label:lbl) tabable:true)
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3826
                width:0.25; left:x.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3827
     ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3828
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3829
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3830
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3831
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3832
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3833
    "Modified: 9.2.1996 / 21:46:40 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3834
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3835
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3836
!DialogBox methodsFor:'explicit focus control'!
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3837
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3838
focusOnOk
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3839
    windowGroup focusView:okButton
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3840
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3841
    "Modified: 19.4.1996 / 16:57:58 / cg"
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3842
! !
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3843
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3844
!DialogBox methodsFor:'initialization'!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3845
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3846
focusSequence
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3847
    "return the elements through which we can step via 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3848
     NextField/PreviousField keys.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3849
     Here we return all tabable fields followed by all buttons in
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3850
     the panel."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3851
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3852
    |fields buttons|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3853
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3854
    tabableElements isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3855
	fields := #()
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3856
    ] ifFalse:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3857
	fields := tabableElements
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3858
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3859
    buttonPanel notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3860
	buttons := buttonPanel subViews.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3861
	buttons notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3862
	    fields := fields , buttonPanel subViews
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3863
	]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3864
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3865
    ^ fields
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3866
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3867
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3868
initialize
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3869
    |mm|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3870
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3871
    super initialize.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3872
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3873
    label := 'Dialog'.
128
claus
parents: 126
diff changeset
  3874
    acceptValue := false asValue.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3875
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3876
    mm := ViewSpacing.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3877
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3878
    acceptReturnAsOK := true.
125
claus
parents: 122
diff changeset
  3879
    acceptOnLeave := true.
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3880
    focusToOKOnLeave := true.
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3881
    hideOnAccept := true.
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3882
    autoAccept := true.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3883
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3884
    buttonPanel := HorizontalPanelView in:self.
118
claus
parents: 112
diff changeset
  3885
    buttonPanel 
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3886
        origin:(0.0 @ 1.0) corner:(1.0 @ 1.0);
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3887
        bottomInset:mm; 
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3888
        topInset:(font height + mm * 2) negated;
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3889
        borderWidth:0;
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  3890
        horizontalLayout:#spread.
118
claus
parents: 112
diff changeset
  3891
122
claus
parents: 121
diff changeset
  3892
    yPosition := ViewSpacing.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3893
    leftIndent := rightIndent := (ViewSpacing // 2).
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3894
    needResize := true.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3895
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3896
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3897
     |b|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3898
     b := DialogBox new.
118
claus
parents: 112
diff changeset
  3899
     b addAbortButton; 
claus
parents: 112
diff changeset
  3900
       addOkButton; 
claus
parents: 112
diff changeset
  3901
       showAtPointer
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3902
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3903
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3904
     |b|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3905
     b := DialogBox new.
118
claus
parents: 112
diff changeset
  3906
     b addOkButton; 
claus
parents: 112
diff changeset
  3907
       showAtPointer
claus
parents: 112
diff changeset
  3908
    "
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3909
    "
118
claus
parents: 112
diff changeset
  3910
     |b|
claus
parents: 112
diff changeset
  3911
     b := DialogBox new.
claus
parents: 112
diff changeset
  3912
     b addTextLabel:'hello world';
claus
parents: 112
diff changeset
  3913
       addOkButton; 
claus
parents: 112
diff changeset
  3914
       showAtPointer
claus
parents: 112
diff changeset
  3915
    "
claus
parents: 112
diff changeset
  3916
    "
claus
parents: 112
diff changeset
  3917
     |b|
claus
parents: 112
diff changeset
  3918
     b := DialogBox new.
claus
parents: 112
diff changeset
  3919
     b addTextLabel:'hello world';
claus
parents: 112
diff changeset
  3920
       addVerticalSpace:50; 
claus
parents: 112
diff changeset
  3921
       addOkButton; 
claus
parents: 112
diff changeset
  3922
       showAtPointer
claus
parents: 112
diff changeset
  3923
    "
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3924
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3925
    "Modified: 19.4.1996 / 17:07:49 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3926
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3927
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3928
reAdjustGeometry
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3929
    "sent late in snapin processing - gives me a chance
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3930
     to resize for changed font dimensions."
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3931
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3932
    super reAdjustGeometry.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3933
    okButton notNil ifTrue:[okButton resize].
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3934
    abortButton notNil ifTrue:[abortButton resize].
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3935
    self resize
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3936
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3937
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3938
!DialogBox methodsFor:'private'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3939
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3940
basicAddComponent:aComponent 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3941
    "add a component, dont change its size"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3942
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3943
    addedComponents isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3944
	addedComponents := OrderedCollection new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3945
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3946
    addedComponents add:aComponent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3947
    self addSubView:aComponent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3948
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3949
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3950
hideAndEvaluate:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3951
    "if I am modal, make myself invisible and evaluate aBlock.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3952
     If nonModal, stay up, but also evaluate the block."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3953
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3954
    (windowGroup notNil and:[windowGroup isModal]) ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3955
	self hide.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3956
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3957
    aBlock notNil ifTrue:[aBlock value]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3958
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3959
    "Modified: 5.9.1995 / 19:06:33 / claus"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3960
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3961
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3962
realize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3963
    "if any inputFields where added, activate the first one"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3964
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3965
    inputFieldGroup notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3966
	inputFieldGroup activateFirst
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3967
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3968
    super realize
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3969
!
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3970
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3971
resize
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3972
    needResize ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3973
	needResize := false.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3974
	super resize
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3975
    ]
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3976
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3977
    "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
  3978
    "Modified: 27.1.1996 / 18:25:40 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3979
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3980
120
claus
parents: 118
diff changeset
  3981
!DialogBox methodsFor:'queries'!
118
claus
parents: 112
diff changeset
  3982
121
claus
parents: 120
diff changeset
  3983
accepted
128
claus
parents: 126
diff changeset
  3984
    "after the box has closed:
claus
parents: 126
diff changeset
  3985
	 return true if accepted, false if canceled"
125
claus
parents: 122
diff changeset
  3986
128
claus
parents: 126
diff changeset
  3987
    ^ acceptValue value
121
claus
parents: 120
diff changeset
  3988
!
claus
parents: 120
diff changeset
  3989
120
claus
parents: 118
diff changeset
  3990
positionOffset
claus
parents: 118
diff changeset
  3991
    "return the delta, by which the box should be displayed
claus
parents: 118
diff changeset
  3992
     from the mouse pointer. Value returned here makes center of
claus
parents: 118
diff changeset
  3993
     okButton appear under the cursor"
118
claus
parents: 112
diff changeset
  3994
120
claus
parents: 118
diff changeset
  3995
    okButton isNil ifTrue:[
claus
parents: 118
diff changeset
  3996
	^ super positionOffset
118
claus
parents: 112
diff changeset
  3997
    ].
120
claus
parents: 118
diff changeset
  3998
    buttonPanel setChildPositionsIfChanged.
claus
parents: 118
diff changeset
  3999
    ^ (okButton originRelativeTo:self) + (okButton extent // 2)
118
claus
parents: 112
diff changeset
  4000
!
claus
parents: 112
diff changeset
  4001
130
claus
parents: 128
diff changeset
  4002
preferredExtent 
132
claus
parents: 131
diff changeset
  4003
    "return my preferred extent.
claus
parents: 131
diff changeset
  4004
     That is the max component width, or my current width (default);
claus
parents: 131
diff changeset
  4005
     whichever is larger, by the sum of the components heights."
118
claus
parents: 112
diff changeset
  4006
120
claus
parents: 118
diff changeset
  4007
    |w h p|
118
claus
parents: 112
diff changeset
  4008
120
claus
parents: 118
diff changeset
  4009
    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
  4010
        w := addedComponents 
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4011
                inject:0 
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4012
                into:[:max :element |
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4013
                        |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
  4014
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4015
                        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
  4016
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4017
                        "/ 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
  4018
                        "/ 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
  4019
                        "/ 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
  4020
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4021
                        (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
  4022
                            relX := rel x.
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4023
                            (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
  4024
                                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
  4025
                            ].
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4026
                        ].
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4027
                        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
  4028
                        max max:(eExt + element leftInset + element rightInset)].
120
claus
parents: 118
diff changeset
  4029
    ] ifFalse:[
354
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4030
        w := super preferredExtent x.
120
claus
parents: 118
diff changeset
  4031
    ].
132
claus
parents: 131
diff changeset
  4032
    w := w max:width.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4033
    h := yPosition + ViewSpacing.
118
claus
parents: 112
diff changeset
  4034
130
claus
parents: 128
diff changeset
  4035
    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
  4036
        p := buttonPanel preferredExtent.
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4037
        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
  4038
        h := h
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4039
             + p y
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4040
             + ViewSpacing.
120
claus
parents: 118
diff changeset
  4041
    ].
118
claus
parents: 112
diff changeset
  4042
120
claus
parents: 118
diff changeset
  4043
"/    okButton isNil ifTrue:[
130
claus
parents: 128
diff changeset
  4044
"/        ^ super preferredExtent
120
claus
parents: 118
diff changeset
  4045
"/    ].
130
claus
parents: 128
diff changeset
  4046
"/    p := buttonPanel preferredExtent.
120
claus
parents: 118
diff changeset
  4047
"/    w := p x.
claus
parents: 118
diff changeset
  4048
"/    h := ViewSpacing
claus
parents: 118
diff changeset
  4049
"/         + p y
claus
parents: 118
diff changeset
  4050
"/         + ViewSpacing.
claus
parents: 118
diff changeset
  4051
"/
claus
parents: 118
diff changeset
  4052
    ^ w @ h
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4053
354
dcad6936bfa6 when computing the preferredExtent, take care of relative-sized components (scale)
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  4054
    "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
  4055
! !
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4056
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4057
!DialogBox methodsFor:'special geometry settings'!
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4058
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4059
stickAtBottomWithFixHeight:aComponent
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4060
    "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
  4061
     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
  4062
     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
  4063
     (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
  4064
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4065
    self resize.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4066
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4067
    aComponent
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4068
	topInset:(self height - aComponent top) negated;
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4069
	bottomInset:(self height - aComponent bottom); 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4070
	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
  4071
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4072
    "
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4073
     compare the resizing behavior of:
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4074
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4075
	|box|
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4076
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4077
	box := Dialog new.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4078
	box addTextLabel:'hello'.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4079
	box addTextLabel:'hello2'.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4080
	box addOkButton.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4081
	box show
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4082
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4083
     with:
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4084
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4085
	|box l2|
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4086
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4087
	box := Dialog new.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4088
	box addTextLabel:'hello'.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4089
	l2 := box addTextLabel:'hello2'.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4090
	box addOkButton.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4091
	box stickAtBottomWithFixHeight:l2.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4092
	box show
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4093
   "
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4094
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4095
    "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
  4096
    "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
  4097
!
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4098
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4099
stickAtBottomWithVariableHeight:aComponent
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4100
    "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
  4101
     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
  4102
     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
  4103
     and the bottom.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4104
     (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
  4105
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4106
    self resize.
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4107
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4108
    aComponent
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4109
	bottomInset:(self height - aComponent bottom); 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4110
	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
  4111
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4112
    "
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4113
     compare the resizing behavior of:
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4114
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4115
	|box|
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4116
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4117
	box := Dialog new.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4118
	box addTextLabel:'hello'.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4119
	(box addComponent:(SelectionInListView new)) level:-1.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4120
	box addOkButton.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4121
	box show
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4122
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4123
     with:
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4124
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4125
	|box list|
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4126
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4127
	box := Dialog new.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4128
	box addTextLabel:'hello'.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4129
	list := (box addComponent:(SelectionInListView new)) level:-1.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4130
	box addOkButton.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4131
	box stickAtBottomWithVariableHeight:list.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  4132
	box show
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4133
   "
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4134
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  4135
    "Modified: 27.1.1996 / 18:27:36 / cg"
118
claus
parents: 112
diff changeset
  4136
! !
claus
parents: 112
diff changeset
  4137
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4138
!DialogBox methodsFor:'user actions'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  4139
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4140
abortPressed
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4141
    "sent by the cancel button; user pressed abort button
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4142
     - hide myself and evaluate okAction"
121
claus
parents: 120
diff changeset
  4143
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4144
    abortButton turnOffWithoutRedraw.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4145
    acceptValue value:false.
121
claus
parents: 120
diff changeset
  4146
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4147
    "/ actually, only hides if I have been opened modal
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4148
    self hideAndEvaluate:abortAction
121
claus
parents: 120
diff changeset
  4149
!
claus
parents: 120
diff changeset
  4150
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4151
doAccept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4152
    "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
  4153
     then set my accept value to true.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4154
     This is confusing: this method was originally called #accept,
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4155
     but renamed for compatibility with ST-80, where #accept returns the
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4156
     accept-valueHolder (which looks like a bad name to me ...)."
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  4157
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  4158
    autoAccept ifTrue:[    
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  4159
        addedComponents notNil ifTrue:[
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  4160
            addedComponents do:[:aComponent |
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  4161
                (aComponent respondsTo:#accept) ifTrue:[
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  4162
                    aComponent accept
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  4163
                ]
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  4164
            ]
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  4165
        ].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4166
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4167
    acceptValue value:true.
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  4168
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  4169
    "Modified: 4.3.1996 / 12:14:56 / cg"
128
claus
parents: 126
diff changeset
  4170
!
claus
parents: 126
diff changeset
  4171
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4172
keyPress:aKey x:x y:y
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4173
    "return-key dublicates ok-function if acceptReturnAsOK is true"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  4174
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  4175
    <resource: #keyboard (#Return)>
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  4176
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
  4177
    (aKey == #Return) ifTrue:[
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  4178
        (okButton notNil and:[okButton isReturnButton]) ifTrue:[
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  4179
            ^ self okPressed
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  4180
        ].
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  4181
        (abortButton notNil and:[abortButton isReturnButton]) ifTrue:[
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  4182
            ^ self abortPressed
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  4183
        ].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4184
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4185
    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
  4186
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  4187
    "Modified: 7.3.1996 / 13:15:09 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  4188
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  4189
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4190
lastFieldLeft
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4191
    "if the dialog involves input fields, this is called
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4192
     when the last field is left by Return-key or NextField-key"
120
claus
parents: 118
diff changeset
  4193
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4194
    acceptOnLeave ifTrue:[
357
732f59def851 care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
  4195
        acceptReturnAsOK ifTrue:[
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  4196
            focusToOKOnLeave ifTrue:[
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  4197
                self focusOnOk.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  4198
                ^ self.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  4199
            ].
357
732f59def851 care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
  4200
            self okPressed
732f59def851 care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
  4201
        ]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4202
    ].
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  4203
    inputFieldGroup activateFirst
357
732f59def851 care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
  4204
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  4205
    "Modified: 19.4.1996 / 17:09:02 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  4206
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  4207
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4208
okPressed
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4209
    "sent by the okButton; user pressed ok-button
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4210
     - make myself invisible and if an action was specified do it"
128
claus
parents: 126
diff changeset
  4211
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4212
    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
  4213
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4214
    self doAccept.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4215
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  4216
    acceptCheck notNil ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  4217
	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
  4218
    ].
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  4219
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  4220
    hideOnAccept ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  4221
	"/ actually, only hides if I have been opened modal
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  4222
	self hideAndEvaluate:okAction.
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  4223
    ] ifFalse:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  4224
	okAction value
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  4225
    ]
128
claus
parents: 126
diff changeset
  4226
! !
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  4227
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  4228
!DialogBox class methodsFor:'documentation'!
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  4229
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  4230
version
557
1fbfacd0fed1 suppress scrollBar in choose if there is nothing to scroll
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
  4231
    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.62 1996-04-19 17:01:08 cg Exp $'
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  4232
! !
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  4233
DialogBox initialize!