OptionBox.st
author Claus Gittinger <cg@exept.de>
Mon, 20 Feb 2006 22:30:35 +0100
changeset 3260 274ba11c1789
parent 3211 54cb5fb7fd2f
child 3613 0a1963025199
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1991 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
2212
7475e8be57bb recompute label origin, if the form changes
Claus Gittinger <cg@exept.de>
parents: 2162
diff changeset
    13
"{ Package: 'stx:libwidg' }"
7475e8be57bb recompute label origin, if the form changes
Claus Gittinger <cg@exept.de>
parents: 2162
diff changeset
    14
740
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    15
DialogBox subclass:#OptionBox
3208
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
    16
	instanceVariableNames:'verticalPanel labelPanel formLabel textLabel buttons actions
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
    17
		defaultButtonIndex'
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    18
	classVariableNames:'WarnBitmap'
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    19
	poolDictionaries:''
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    20
	category:'Views-DialogBoxes'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    21
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    22
847
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
    23
!OptionBox class methodsFor:'documentation'!
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    24
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    25
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    26
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    27
 COPYRIGHT (c) 1991 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    28
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    29
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    30
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    31
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    33
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    34
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    35
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    36
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    37
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    38
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    39
documentation
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    40
"
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    41
   CAVEAT: this is a leftover - functionality has been merged into DialogBox
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    42
   PLEASE use one of the `Dialog chooseXXX' methods nstead of OptionBox.
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    43
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    44
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    45
   Historic note:
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    46
      originally, ST/X had separate classes for the various entry methods;
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    47
      there were YesNoBox, EnterBox, InfoBox and so on.
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    48
      In the meantime, the DialogBox class (and therefore its alias: Dialog)
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    49
      is going to duplicate most funcionality found in these classes.
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    50
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    51
      In the future, those existing subclasses' functionality is going to
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    52
      be moved fully into Dialog, and the subclasses will be replaced by dummy
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    53
      delegators. (They will be kept for backward compatibility, though).
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    54
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    55
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    56
    OptionBoxes are like YesNoBoxes but with as many buttons as you like;
91
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
    57
    this will finally be a superclass of WarnBox and YesNoBox - or maybe merged
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    58
    all into DialogBox..
97
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
    59
    Use them for multiway questions.
91
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
    60
    For a consistent user interface, the rightmost button is the default return
97
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
    61
    button (i.e. pressing return in the box performs this buttons function).
91
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
    62
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    63
    [author:]
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    64
        Claus Gittinger
91
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
    65
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    66
    [see also:]
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    67
        DialogBox
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    68
"
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    69
!
91
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
    70
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    71
examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    72
"
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    73
                                                                        [exBegin]
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    74
    |box|
97
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
    75
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    76
    box := OptionBox title:'hello' numberOfOptions:4.
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    77
    box showAtPointer
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    78
                                                                        [exEnd]
97
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
    79
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
    80
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    81
                                                                        [exBegin]
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    82
    |box|
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    83
    box := OptionBox title:'hello' numberOfOptions:3.
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    84
    box buttonTitles:#('one' 'two' 'three').
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    85
    box showAtPointer
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    86
                                                                        [exEnd]
97
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
    87
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    88
 performing an action:
97
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
    89
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    90
                                                                        [exBegin]
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    91
    |box|
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    92
    box := OptionBox title:'hello' numberOfOptions:3.
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    93
    box buttonTitles:#('one' 'two' 'three').
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    94
    box action:[:which | Transcript show:'button ';
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    95
                                    show: which;
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
    96
                                    showCR:' was pressed'].
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    97
    box showAtPointer
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    98
                                                                        [exEnd]
97
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
    99
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   100
 returning a value:
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   101
                                                                        [exBegin]
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   102
    |what|
133
claus
parents: 132
diff changeset
   103
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   104
    what := OptionBox 
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   105
                  request:('text has not been accepted.\\Your modifications will be lost when continuing.') withCRs
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   106
                  label:' Attention'
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   107
                  image:(WarningBox iconBitmap)
3211
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   108
                  buttonLabels:#('Abort' 'Accept' 'Continue')
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   109
                  values:#(#abort #accept #continue).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   110
    Transcript showCR:what.
646
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   111
                                                                        [exEnd]
3211
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   112
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   113
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   114
 use callBack-hook to intercept creation:
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   115
                                                                        [exBegin]
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   116
    |what|
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   117
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   118
    AboutToOpenBoxNotificationSignal handle:[:ex |
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   119
        |box|
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   120
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   121
        box := ex parameter.
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   122
        box verticalPanel 
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   123
            add:(CheckBox label:'Do no show this Dialog again.'
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   124
                          model:false asValue).
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   125
        ex proceed.
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   126
    ] do:[
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   127
        what := OptionBox 
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   128
                      request:('bla bla bla bla.\\You must bla bla bla!!') withCRs
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   129
                      label:' Attention'
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   130
                      image:(WarningBox iconBitmap)
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   131
                      buttonLabels:#('Abort' 'Accept' 'Continue')
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   132
                      values:#(#abort #accept #continue)
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   133
                      default:#continue.
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   134
    ].
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   135
    Transcript showCR:what.
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   136
                                                                        [exEnd]
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   137
"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   138
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   139
847
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   140
!OptionBox class methodsFor:'instance creation'!
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   141
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   142
title:titleString numberOfOptions:nOptions
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   143
    "create a new optionBox with title, aTitleString and nOptions options"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   144
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   145
    |box|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   146
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   147
    box := (self basicNew) numberOfOptions:nOptions.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   148
    box device:Screen current.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   149
    box initialize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   150
    box title:titleString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   151
    ^ box
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   152
! !
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   153
2449
b9bf97bf089d category included a space
Claus Gittinger <cg@exept.de>
parents: 2405
diff changeset
   154
!OptionBox class methodsFor:'easy startup'!
95
7535cfca9509 *** empty log message ***
claus
parents: 91
diff changeset
   155
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   156
forRequest:title label:label image:anImage buttonLabels:labels values:values default:defaultValue
2585
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   157
    "create a new optionBox and return it.
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   158
     Does not open the box."
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   159
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   160
    |box|
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   161
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   162
    box := OptionBox title:title numberOfOptions:(labels size).
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   163
    box buttonTitles:labels.
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   164
    box defaultButtonIndex:(values indexOf:defaultValue). 
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   165
    box label:label; image:anImage.
2898
b7ba089497d6 thumbsUp/down
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   166
    values keysAndValuesDo:[:idx :val |
b7ba089497d6 thumbsUp/down
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   167
        val == false ifTrue:[
b7ba089497d6 thumbsUp/down
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   168
            (box buttons at:idx) cursor:(Cursor thumbsDown).
b7ba089497d6 thumbsUp/down
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   169
        ].
b7ba089497d6 thumbsUp/down
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   170
        val == true ifTrue:[
b7ba089497d6 thumbsUp/down
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   171
            (box buttons at:idx) cursor:(Cursor thumbsUp).
b7ba089497d6 thumbsUp/down
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   172
        ].
b7ba089497d6 thumbsUp/down
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   173
    ].
2585
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   174
    ^ box
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   175
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   176
    "Modified: / 23.2.2000 / 11:59:32 / cg"
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   177
!
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   178
2668
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   179
request:title buttonLabels:labels values:values 
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   180
    "create a new optionBox, open it modal and return the value of
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   181
     the corresponding values collection. Return nil if cancelled"
2668
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   182
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   183
    ^ self 
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   184
        request:title label:title buttonLabels:labels values:values
2668
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   185
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   186
    "
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   187
     OptionBox 
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   188
        request:'please select any'
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   189
        buttonLabels:#('one' 'two' 'three')
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   190
        values:#(1 2 3)   
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   191
    "
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   192
!
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   193
2669
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   194
request:title buttonLabels:labels values:values default:defaultValue
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   195
    "create a new optionBox, open it modal and return the value of
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   196
     the corresponding values collection. Return nil if cancelled."
2669
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   197
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   198
    ^ self
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   199
        request:title label:title image:(YesNoBox iconBitmap) buttonLabels:labels values:values 
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   200
        default:defaultValue onCancel:nil
2669
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   201
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   202
    "
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   203
     OptionBox 
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   204
        request:'please select'
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   205
        buttonLabels:#('one' 'two' 'three')
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   206
        values:#(1 2 3)   
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   207
        default:3   
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   208
    "
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   209
!
182aa7a00d83 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   210
2405
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   211
request:title label:label buttonLabels:labels values:values 
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   212
    "create a new optionBox, open it modal and return the value of
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   213
     the corresponding values collection. Return nil if cancelled"
2405
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   214
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   215
    ^ self 
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   216
        request:title label:label image:(YesNoBox iconBitmap)
2405
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   217
        buttonLabels:labels values:values default:nil onCancel:nil
2668
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   218
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   219
    "
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   220
     OptionBox 
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   221
        request:'please select'
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   222
        label:'select any'
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   223
        buttonLabels:#('one' 'two' 'three')
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   224
        values:#(1 2 3)   
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   225
    "
2405
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   226
!
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   227
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   228
request:title label:label buttonLabels:labels values:values default:defaultValue
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   229
    "create a new optionBox, open it modal and return the value of
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   230
     the corresponding values collection. Return nil if cancelled"
2405
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   231
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   232
    ^ self
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   233
        request:title label:label image:(YesNoBox iconBitmap) buttonLabels:labels values:values 
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   234
        default:defaultValue onCancel:nil
2668
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   235
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   236
    "
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   237
     OptionBox 
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   238
        request:'please select'
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   239
        label:'select any'
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   240
        buttonLabels:#('one' 'two' 'three')
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   241
        values:#(1 2 3)   
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   242
        default:3   
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   243
    "
2405
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   244
!
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   245
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   246
request:title label:label buttonLabels:labels values:values default:defaultValue onCancel:cancelValue
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   247
    "create a new optionBox, open it modal and return the value of
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   248
     the corresponding values collection. Return cancelValue if cancelled."
2405
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   249
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   250
    ^ self
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   251
        request:title label:label image:(YesNoBox iconBitmap) buttonLabels:labels values:values 
2405
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   252
        default:defaultValue onCancel:cancelValue
2668
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   253
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   254
    "
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   255
     OptionBox 
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   256
        request:'please select'
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   257
        label:'select any'
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   258
        buttonLabels:#('one' 'two' 'three')
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   259
        values:#(1 2 3)   
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   260
        default:3   
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   261
        onCancel:2   
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   262
    "
2405
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   263
!
dcdb739b64f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   264
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   265
request:title label:label image:anImage buttonLabels:labels values:values 
133
claus
parents: 132
diff changeset
   266
    "create a new optionBox, open it modal and return the value of
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   267
     the corresponding values collection. Return nil, if cancelled."
133
claus
parents: 132
diff changeset
   268
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   269
    ^ self 
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   270
        request:title label:label image:anImage buttonLabels:labels values:values 
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   271
        default:nil onCancel:nil
2668
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   272
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   273
    "
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   274
     OptionBox 
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   275
        request:'please select'
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   276
        label:'select any'
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   277
        image:(WarningBox iconBitmap)
2668
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   278
        buttonLabels:#('one' 'two' 'three')
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   279
        values:#(1 2 3)
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   280
    "
133
claus
parents: 132
diff changeset
   281
!
claus
parents: 132
diff changeset
   282
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   283
request:title label:label image:anImage buttonLabels:labels values:values default:defaultValue
95
7535cfca9509 *** empty log message ***
claus
parents: 91
diff changeset
   284
    "create a new optionBox, open it modal and return the value of
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   285
     the corresponding values collection. Return nil if cancelled."
95
7535cfca9509 *** empty log message ***
claus
parents: 91
diff changeset
   286
2390
0a72663d8e59 added onCancel: value
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
   287
    ^ self
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   288
        request:title label:label image:anImage buttonLabels:labels values:values 
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   289
        default:defaultValue onCancel:nil
2668
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   290
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   291
    "
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   292
     OptionBox 
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   293
        request:'please select'
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   294
        label:'select any'
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   295
        image:(WarningBox iconBitmap)
2668
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   296
        buttonLabels:#('one' 'two' 'three')
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   297
        values:#(1 2 3)
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   298
        default:3
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   299
    "
2390
0a72663d8e59 added onCancel: value
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
   300
!
0a72663d8e59 added onCancel: value
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
   301
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   302
request:title label:label image:anImage buttonLabels:labels values:values default:defaultValue onCancel:cancelValue
2390
0a72663d8e59 added onCancel: value
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
   303
    "create a new optionBox, open it modal and return the value of
2711
e18e9edca978 by default, return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2700
diff changeset
   304
     the corresponding values collection. Return cancelValue if cancelled."
2390
0a72663d8e59 added onCancel: value
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
   305
2162
9ef1004f8e74 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   306
    |box retVal|
95
7535cfca9509 *** empty log message ***
claus
parents: 91
diff changeset
   307
2390
0a72663d8e59 added onCancel: value
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
   308
    retVal := cancelValue.
2585
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   309
    box := self
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   310
                forRequest:title 
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   311
                label:label 
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   312
                image:anImage 
2585
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   313
                buttonLabels:labels 
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   314
                values:values 
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   315
                default:defaultValue.
bc342ad3c166 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
   316
2162
9ef1004f8e74 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   317
    box action:[:n | retVal := values at:n].
3211
54cb5fb7fd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   318
    self showAndThenDestroyBox:box.
2389
ca78debb0223 return nil if cancelled
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   319
2162
9ef1004f8e74 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   320
    ^ retVal
95
7535cfca9509 *** empty log message ***
claus
parents: 91
diff changeset
   321
7535cfca9509 *** empty log message ***
claus
parents: 91
diff changeset
   322
    "
2668
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   323
     OptionBox 
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   324
        request:'please select'
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   325
        label:'select any'
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   326
        image:(WarningBox iconBitmap)
2668
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   327
        buttonLabels:#('one' 'two' 'three')
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   328
        values:#(1 2 3)
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   329
        default:3
c8655a5eb411 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   330
        onCancel:nil
95
7535cfca9509 *** empty log message ***
claus
parents: 91
diff changeset
   331
    "
920
8487cf717bdf destroy the box after use
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   332
2162
9ef1004f8e74 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   333
    "Modified: / 23.2.2000 / 11:59:32 / cg"
95
7535cfca9509 *** empty log message ***
claus
parents: 91
diff changeset
   334
! !
7535cfca9509 *** empty log message ***
claus
parents: 91
diff changeset
   335
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   336
!OptionBox class methodsFor:'obsolete'!
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   337
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   338
forRequest:title label:label form:anImage buttonLabels:labels values:values default:defaultValue
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   339
    "create a new optionBox and return it.
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   340
     Does not open the box."
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   341
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   342
    <resource:#obsolete>
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   343
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   344
    self forRequest:title label:label image:anImage buttonLabels:labels values:values default:defaultValue
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   345
!
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   346
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   347
request:title label:label form:aForm buttonLabels:labels values:values 
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   348
    "create a new optionBox, open it modal and return the value of
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   349
     the corresponding values collection. Return nil, if cancelled."
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   350
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   351
    <resource:#obsolete>
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   352
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   353
    ^ self 
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   354
        request:title label:label image:aForm buttonLabels:labels values:values 
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   355
        default:nil onCancel:nil
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   356
!
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   357
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   358
request:title label:label form:aForm buttonLabels:labels values:values default:defaultValue
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   359
    "create a new optionBox, open it modal and return the value of
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   360
     the corresponding values collection. Return nil if cancelled."
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   361
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   362
    <resource:#obsolete>
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   363
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   364
    ^ self
2991
f8ba5fe56ea6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   365
        request:title 
f8ba5fe56ea6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   366
        label:label 
f8ba5fe56ea6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   367
        image:aForm 
f8ba5fe56ea6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   368
        buttonLabels:labels 
f8ba5fe56ea6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   369
        values:values 
f8ba5fe56ea6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   370
        default:defaultValue 
f8ba5fe56ea6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   371
        onCancel:nil
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   372
!
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   373
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   374
request:title label:label form:aForm buttonLabels:labels values:values default:defaultValue onCancel:cancelValue
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   375
    "create a new optionBox, open it modal and return the value of
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   376
     the corresponding values collection. Return cancelValue if cancelled."
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   377
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   378
    <resource:#obsolete>
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   379
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   380
    ^ self request:title label:label image:aForm buttonLabels:labels values:values default:defaultValue onCancel:cancelValue
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   381
! !
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   382
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   383
!OptionBox methodsFor:'accessing'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   384
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   385
action:actionBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   386
    "define a single the action for all buttons.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   387
     The action will be evaluated with the button index as argument."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   388
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   389
    buttons keysAndValuesDo:[:index :button |
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   390
	button action:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   391
		       button turnOffWithoutRedraw.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   392
		       self hide.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   393
		       actionBlock value:index
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   394
		      ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   395
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   396
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   397
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   398
actions:actionBlocks
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   399
    "define the actions"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   400
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   401
    actions := actionBlocks
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   402
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   403
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   404
buttonTitles:titles actions:actionBlocks
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   405
    "define both button titles and actions"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   406
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   407
    self buttonTitles:titles.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   408
    actions := actionBlocks.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   409
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   410
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   411
defaultButtonIndex:index
847
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   412
    "define which button is the default (i.e. return-) button.
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   413
     By default, no returnButton is setup. The argument must be an
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   414
     index 1..nButtons, or nil"
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   415
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   416
    defaultButtonIndex notNil ifTrue:[
847
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   417
        (buttons at:defaultButtonIndex) isReturnButton:false
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   418
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   419
    (index notNil and:[index ~~ 0]) ifTrue:[
847
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   420
        defaultButtonIndex := index.
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   421
        defaultButtonIndex notNil ifTrue:[
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   422
            (buttons at:defaultButtonIndex) isReturnButton:true 
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   423
        ].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   424
    ]
847
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   425
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   426
    "Modified: 18.10.1996 / 14:53:36 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   427
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   428
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   429
numberOfOptions
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   430
    "return the number of options"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   431
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   432
    ^ buttons size
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   433
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   434
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   435
numberOfOptions:nOptions
847
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   436
    "set the number of options - this is a private interface"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   437
3260
274ba11c1789 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3211
diff changeset
   438
    buttons := OrderedCollection withSize:nOptions.
274ba11c1789 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3211
diff changeset
   439
    actions := OrderedCollection withSize:nOptions
847
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   440
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   441
    "Modified: 18.10.1996 / 14:54:30 / cg"
740
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   442
! !
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   443
3208
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   444
!OptionBox methodsFor:'accessing-components'!
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   445
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   446
buttons
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   447
    "return the buttons collection"
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   448
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   449
    ^ buttons
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   450
!
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   451
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   452
labelPanel
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   453
    ^ labelPanel
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   454
!
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   455
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   456
verticalPanel
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   457
    ^ verticalPanel
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   458
! !
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   459
2227
58426f7611f2 category changes
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   460
!OptionBox methodsFor:'accessing-look'!
740
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   461
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   462
buttonTitles:titles
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   463
    "set the button titles"
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   464
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   465
    titles keysAndValuesDo:[:index :aString |
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   466
	|b|
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   467
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   468
	(b := buttons at:index) label:aString.
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   469
	b resize.
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   470
    ].
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   471
    shown ifTrue:[self resize]
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   472
!
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   473
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   474
form:aFormOrImage
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   475
    "historical leftover - define a form to be displayed left of the title"
2212
7475e8be57bb recompute label origin, if the form changes
Claus Gittinger <cg@exept.de>
parents: 2162
diff changeset
   476
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   477
    <resource:#obsolete>
2212
7475e8be57bb recompute label origin, if the form changes
Claus Gittinger <cg@exept.de>
parents: 2162
diff changeset
   478
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   479
    self image:aFormOrImage
740
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   480
!
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   481
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   482
formLabel
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   483
    "return the label-view which displays a bitmap"
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   484
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   485
    ^ formLabel
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   486
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   487
2476
7fb8b94e650c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   488
image:aFormOrImage
7fb8b94e650c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   489
    "set the image shown in the label-view"
7fb8b94e650c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   490
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   491
    |mm|
2476
7fb8b94e650c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   492
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   493
    mm := ViewSpacing.
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   494
    formLabel label:aFormOrImage.
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   495
    textLabel origin:((mm + formLabel width + mm) @ mm).
2476
7fb8b94e650c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   496
!
7fb8b94e650c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
   497
2328
07521b0760e7 access to textLabel
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   498
textLabel
07521b0760e7 access to textLabel
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   499
    "return the label-view which displays a message string"
07521b0760e7 access to textLabel
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   500
07521b0760e7 access to textLabel
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   501
    ^ textLabel
07521b0760e7 access to textLabel
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   502
!
07521b0760e7 access to textLabel
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   503
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   504
title:aString
16
83d4f5c6f76c *** empty log message ***
claus
parents: 7
diff changeset
   505
    "set the boxes title"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   506
16
83d4f5c6f76c *** empty log message ***
claus
parents: 7
diff changeset
   507
    aString ~= textLabel label ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   508
	textLabel label:aString withoutSeparators.
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   509
	textLabel forceResize.
97
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
   510
	shown ifTrue:[self resize]
16
83d4f5c6f76c *** empty log message ***
claus
parents: 7
diff changeset
   511
    ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   512
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   513
97
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
   514
title:aString numberOfOptions:nOptions
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
   515
    "set the boxes title and number of options"
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
   516
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
   517
    self title:aString.
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
   518
    buttons grow:nOptions.
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
   519
    actions grow:nOptions
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   520
! !
97
cbf495fe3b64 *** empty log message ***
claus
parents: 95
diff changeset
   521
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   522
!OptionBox methodsFor:'events'!
77
565b052f5277 *** empty log message ***
claus
parents: 63
diff changeset
   523
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   524
keyPress:aKey x:x y:y
2700
d6bc43ddc80f Spelling (du Dubl!)
Stefan Vogel <sv@exept.de>
parents: 2669
diff changeset
   525
    "return-key duplicates ok-function if acceptReturnAsOK is true"
77
565b052f5277 *** empty log message ***
claus
parents: 63
diff changeset
   526
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
   527
    <resource: #keyboard (#Return)>
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
   528
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   529
    |action|
77
565b052f5277 *** empty log message ***
claus
parents: 63
diff changeset
   530
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   531
    defaultButtonIndex notNil ifTrue:[
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
   532
        (aKey == #Return) ifTrue:[
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
   533
            self hide.
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
   534
            action := actions at:defaultButtonIndex.
3201
ce84e272c6bb code cleanup
Claus Gittinger <cg@exept.de>
parents: 2991
diff changeset
   535
            action value
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
   536
        ]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   537
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   538
    super keyPress:aKey x:x y:y
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
   539
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
   540
    "Modified: 7.3.1996 / 13:17:36 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   541
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   542
2523
c10ebb01ab09 category rename
Claus Gittinger <cg@exept.de>
parents: 2476
diff changeset
   543
!OptionBox methodsFor:'initialization'!
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   544
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   545
initFormBitmap
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   546
    WarnBitmap isNil ifTrue:[
1914
f337a7fd99f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1612
diff changeset
   547
        WarnBitmap := WarningBox iconBitmap.
f337a7fd99f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1612
diff changeset
   548
"/        WarnBitmap := Image fromFile:'bitmaps/Warning.xbm' resolution:100 on:Display 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   549
    ].
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2898
diff changeset
   550
    formLabel label:WarnBitmap
899
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 847
diff changeset
   551
1914
f337a7fd99f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1612
diff changeset
   552
    "Modified: / 25.5.1999 / 16:08:06 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   553
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   554
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   555
initialize
3208
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   556
    |nButt mm vPanelLayout|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   557
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   558
    super initialize.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   559
372
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   560
    mm := ViewSpacing.
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   561
3208
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   562
    verticalPanel := VerticalPanelView in:self.
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   563
    vPanelLayout := LayoutFrame origin:(mm @ mm) corner:(1.0@1.0).
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   564
    vPanelLayout bottomOffset:(font height + (mm * 5)) negated.
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   565
    vPanelLayout rightOffset:mm negated.
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   566
    verticalPanel geometryLayout:vPanelLayout.
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   567
    verticalPanel horizontalLayout:#fit.
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   568
    verticalPanel verticalLayout:#bottomFit.
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   569
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   570
    labelPanel := HorizontalPanelView in:verticalPanel.
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   571
    labelPanel horizontalLayout:#leftSpace.
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   572
    labelPanel verticalLayout:#topSpace.
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   573
    labelPanel height:(labelPanel preferredExtent y + (mm * 4)).
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   574
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   575
    formLabel := Label in:labelPanel.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   576
    self initFormBitmap.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   577
    formLabel borderWidth:0.
3208
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   578
"/    formLabel origin:(mm @ mm).
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   579
3208
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   580
    textLabel := Label label:'Select' in:labelPanel.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   581
    textLabel borderWidth:0.
3208
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   582
"/    textLabel origin:((mm + formLabel width + mm) @ mm).
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   583
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   584
    verticalPanel resize.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   585
1612
e7d3bc88a533 oops - two buttonPanels where created (MD's fix).
Claus Gittinger <cg@exept.de>
parents: 953
diff changeset
   586
"/    buttonPanel isNil ifTrue:[
e7d3bc88a533 oops - two buttonPanels where created (MD's fix).
Claus Gittinger <cg@exept.de>
parents: 953
diff changeset
   587
"/        buttonPanel := HorizontalPanelView origin:(0.0 @ 1.0) corner:(1.0 @ 1.0) in:self.
e7d3bc88a533 oops - two buttonPanels where created (MD's fix).
Claus Gittinger <cg@exept.de>
parents: 953
diff changeset
   588
"/    ].
130
claus
parents: 119
diff changeset
   589
    buttonPanel 
3208
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   590
        bottomInset:0 "mm";
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   591
        topInset:(font height + (mm * 4)) negated.
130
claus
parents: 119
diff changeset
   592
    buttonPanel 
372
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   593
        borderWidth:0; 
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   594
        horizontalLayout:#fitSpace.
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   595
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   596
    nButt := buttons size.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   597
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   598
    1 to:nButt do:[:index |
372
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   599
        |button|
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   600
372
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   601
        button := Button label:'press'.
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   602
        button action:[
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   603
                       |action|
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   604
372
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   605
                       (buttons at:index) turnOffWithoutRedraw.
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   606
                       self hide.
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   607
                       action := actions at:index.
3201
ce84e272c6bb code cleanup
Claus Gittinger <cg@exept.de>
parents: 2991
diff changeset
   608
                       action value
372
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   609
                      ].
133
claus
parents: 132
diff changeset
   610
"/        index == nButt ifTrue:[
claus
parents: 132
diff changeset
   611
"/            button isReturnButton:true
claus
parents: 132
diff changeset
   612
"/        ].
372
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   613
        buttonPanel addSubView:button.
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   614
        buttons at:index put:button.
91
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
   615
    ].
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
   616
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
   617
    "
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
   618
     |box|
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
   619
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
   620
     box := OptionBox title:'hello' numberOfOptions:4.
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
   621
     box open
e8db16616e97 *** empty log message ***
claus
parents: 85
diff changeset
   622
    "
372
2ee5887b00f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   623
1612
e7d3bc88a533 oops - two buttonPanels where created (MD's fix).
Claus Gittinger <cg@exept.de>
parents: 953
diff changeset
   624
    "Modified: / 27.7.1998 / 19:37:17 / cg"
133
claus
parents: 132
diff changeset
   625
! !
claus
parents: 132
diff changeset
   626
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
   627
!OptionBox methodsFor:'queries'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   628
130
claus
parents: 119
diff changeset
   629
preferredExtent 
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   630
    "return a size to make everything fit into myself"
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   631
3208
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   632
    |w w1 h buttonPanelsPref vPanelsPref mm|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   633
799
64f8700489a4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   634
    "/ If I have an explicit preferredExtent ..
64f8700489a4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   635
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   636
    preferredExtent notNil ifTrue:[
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   637
        ^ preferredExtent
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   638
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   639
371
ed0d15f84085 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   640
    mm := ViewSpacing.
ed0d15f84085 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   641
3208
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   642
    vPanelsPref := verticalPanel preferredExtent.
371
ed0d15f84085 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   643
    w1 := (mm * 3) + formLabel width + textLabel width.
3208
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   644
    buttonPanelsPref := buttonPanel preferredExtent.
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   645
    w := w1 max:buttonPanelsPref x.
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   646
    w := w max:vPanelsPref x.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   647
3208
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   648
    h := mm
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   649
         + vPanelsPref y
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   650
         + mm
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   651
         + buttonPanelsPref y
7b4c5a215af9 use panels, to allow for hooks to add more widgets.
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   652
         + mm.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   653
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   654
    ^ w @ h
371
ed0d15f84085 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   655
799
64f8700489a4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   656
    "Modified: 19.7.1996 / 20:45:11 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   657
! !
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   658
847
0d760cfc9a8c commentary
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
   659
!OptionBox class methodsFor:'documentation'!
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   660
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   661
version
3260
274ba11c1789 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3211
diff changeset
   662
    ^ '$Header: /cvs/stx/stx/libwidg/OptionBox.st,v 1.63 2006-02-20 21:30:35 cg Exp $'
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   663
! !