DialogBox.st
author Claus Gittinger <cg@exept.de>
Thu, 15 Apr 1999 14:33:52 +0200
changeset 1843 b868964a554e
parent 1780 bfc30a82aae3
child 1877 a46bf520f9c6
permissions -rw-r--r--
checkin from browser
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
950
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
    15
		acceptReturnAsOK yPosition leftIndent rightIndent addedComponents
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
    16
		inputFieldGroup acceptOnLeave acceptValue tabableElements
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
    17
		hideOnAccept acceptCheck needResize autoAccept focusToOKOnLeave
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
    18
		bindings namedComponents'
1757
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
    19
	classVariableNames:'DefaultFocusToOKOnLeave'
253
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
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
    24
!DialogBox class methodsFor:'documentation'!
76
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
647
44ecc7a25172 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 645
diff changeset
    44
    DialogBox is also a superclass of many other boxes - see InfoBox,
76
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.
950
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
    52
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
    53
    Caveat: 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    54
	more adding support is required - especially for row-wise
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    55
	construction.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    56
	The programmatic interface is best suited for row-wise
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    57
	arranged components; laying out elements in columns is a bit
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    58
	complicate - for complicated dialogs, it may be better to not use
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    59
	the automatic arrangement, but instead give explicit layouts to
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    60
	the components (in a subclass).
122
claus
parents: 121
diff changeset
    61
600
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
    62
    Compatibility note:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    63
	For ST-80 compatibility, DialogBox is also accessable under
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    64
	the global named 'Dialog' (which is the name of an ST-80 class,
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    65
	providing a very similar protocol).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    66
	This may lead to confusion, if DialogBox is recompiled - you have
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    67
	to manually assign Dialog again to refer to the new DialogBox class.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    68
	In future versions of ST/X, DialogBox may be renamed to Dialog.
600
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
    69
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    70
    Historic note:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    71
	originally, ST/X had separate classes for the various entry methods;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    72
	there were YesNoBox, EnterBox, InfoBox and so on.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    73
	ST-80 has all this defined in the common Dialog.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    74
	Therefore, for compatibility, many ST/X methods defined here in Dialogs 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    75
	class protocol simply dispatch to some other boxes class method.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    76
	In the future, those existing subclasses' functionality is going to
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    77
	be moved full into Dialog, and the subclasses will be replaced by dummy
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    78
	delegators. (They will be kept for backward compatibility, though).
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    79
121
claus
parents: 120
diff changeset
    80
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
    81
    [instance variables:]
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
    82
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    83
	buttonPanel      <PanelView>    contains the button(s)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    84
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    85
	okButton         <Button>       the ok-Button
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    86
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    87
	okAction         <Block>        the action to be performed when ok is pressed,
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    88
					or return is pressed.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    89
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    90
	acceptReturnAsOK <Boolean>      if true, pressing the return-key counts
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    91
					as if ok was pressed. Default is true.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    92
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    93
	abortButton      <Button>       the cancel-Button
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    94
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    95
	abortAction      <Block>        the action to be performed when cancel is
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    96
					pressed.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    97
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    98
	yPosisition      <Integer>      current y position when adding components
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
    99
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   100
	leftIndent       <Integer>      left inset to use when adding components
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   101
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   102
	rightIndent      <Integer>      right inset to use when adding components
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   103
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   104
	addedComponents  <Collection>   programmatically added components
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   105
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   106
	inputFieldGroup  <EnterFieldGroup>   
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   107
					for added input fields
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   108
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   109
	acceptOnLeave    <Boolean>      if true (the default) and there are 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   110
					tabable inputFields, accept and close when
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   111
					the last field is left. If false, the ok
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   112
					button must be pressed to close the box.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   113
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   114
	acceptedValue    v(<Boolean>)   valueHolder on a boolean
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   115
					after close: holds true if box was accepted
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   116
					(i.e. ok-Button was pressed), false if box was
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   117
					closed via cancel or window manager.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   118
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   119
	autoAccept       Boolean        if true, pressing ok (or return)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   120
					sends #accept to all subcomponents.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   121
					I.e. all subfields update their models
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   122
					first. The default is true.
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
   123
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   124
    For compatibility with ST-80, this class is also available under
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
   125
    the global names DialogView and Dialog (see patches file).
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   126
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 573
diff changeset
   127
    [author:]
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   128
	Claus Gittinger
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   129
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   130
    [see also:]
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   131
	Button CheckToggle Toggle
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   132
	EditField SelectionInListView FileSelectionList
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   133
	FramedBox Separator
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   134
	( introduction to view programming :html: programming/viewintro.html )
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   135
"
81e3409404d2 Initial revision
claus
parents:
diff changeset
   136
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
   137
81e3409404d2 Initial revision
claus
parents:
diff changeset
   138
examples
81e3409404d2 Initial revision
claus
parents:
diff changeset
   139
"
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   140
    historically, DialogBox was used as an abstract class as a base for InfoBox, 
600
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   141
    YesNoBox etc. 
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   142
    However, the programmatic construction protocol (#addComponent:)
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   143
    now allows those classes to be easily replaced and future versions of
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   144
    ST/X may do this and make those subclasses obsolete.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   145
    However, dummy stubs will remain to exist for backward compatibility
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   146
    (i.e. do not fear using YesNoBox, EnterBox 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
   147
125
claus
parents: 122
diff changeset
   148
    For most simple standard dialogs, there are ready to use
claus
parents: 122
diff changeset
   149
    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
   150
125
claus
parents: 122
diff changeset
   151
    For example:
claus
parents: 122
diff changeset
   152
claus
parents: 122
diff changeset
   153
      info & warnings:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   154
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   155
	Dialog information:'hi there'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   156
									[exEnd]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   157
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   158
	Dialog warn:'oops'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   159
									[exEnd]
125
claus
parents: 122
diff changeset
   160
claus
parents: 122
diff changeset
   161
claus
parents: 122
diff changeset
   162
      yes/no questions:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   163
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   164
	(Dialog confirm:'is this simple ?')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   165
	ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   166
	    Transcript showCR:'thats what I expected'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   167
	] ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   168
	    Transcript showCR:'read more examples and documentation'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   169
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   170
									[exEnd]
125
claus
parents: 122
diff changeset
   171
claus
parents: 122
diff changeset
   172
claus
parents: 122
diff changeset
   173
      yes/no question with cancel option:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   174
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   175
	|answer|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   176
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   177
	answer := Dialog confirmWithCancel:'is this simple ?'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   178
	answer isNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   179
	    Transcript showCR:'no easy decision'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   180
	] ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   181
	    answer ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   182
		Transcript showCR:'thats what I expected'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   183
	    ] ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   184
		Transcript showCR:'read more examples and documentation'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   185
	    ]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   186
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   187
									[exEnd]
125
claus
parents: 122
diff changeset
   188
claus
parents: 122
diff changeset
   189
claus
parents: 122
diff changeset
   190
      asking for a string:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   191
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   192
	|s|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   193
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   194
	s := Dialog request:'enter your name, please:'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   195
	s notEmpty ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   196
	    Transcript showCR:'you entered: ' , s.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   197
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   198
									[exEnd]
125
claus
parents: 122
diff changeset
   199
claus
parents: 122
diff changeset
   200
claus
parents: 122
diff changeset
   201
      asking for a string with given default:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   202
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   203
	|s|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   204
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   205
	s := Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   206
		request:'enter your name, please:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   207
		initialAnswer:(OperatingSystem getLoginName).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   208
	s notEmpty ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   209
	    Transcript showCR:'you entered: ' , s.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   210
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   211
									[exEnd]
125
claus
parents: 122
diff changeset
   212
claus
parents: 122
diff changeset
   213
claus
parents: 122
diff changeset
   214
      asking for a filename:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   215
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   216
	|s|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   217
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   218
	s := Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   219
		requestFileName:'select a file, please:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   220
		default:''.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   221
	Transcript show:'you entered: '; showCR:s.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   222
									[exEnd]
125
claus
parents: 122
diff changeset
   223
claus
parents: 122
diff changeset
   224
1030
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   225
      with a namefiler pattern:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   226
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   227
	|s|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   228
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   229
	s := Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   230
		requestFileName:'select a file, please:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   231
		default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   232
		pattern:'*.rc'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   233
	Transcript show:'you entered: '; showCR:s.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   234
									[exEnd]
1030
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   235
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   236
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   237
      another namefiler pattern:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   238
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   239
	|s|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   240
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   241
	s := Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   242
		requestFileName:'select a file, please:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   243
		default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   244
		pattern:'*.rc;*.st;*.h'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   245
	Transcript show:'you entered: '; showCR:s.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   246
									[exEnd]
1030
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   247
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   248
125
claus
parents: 122
diff changeset
   249
      with changed button label and pattern:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   250
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   251
	|s|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   252
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   253
	s := Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   254
		requestFileName:'select a file, please:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   255
		default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   256
		ok:'show'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   257
		abort:'cancel'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   258
		pattern:'*.rc'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   259
	Transcript show:'you entered: '; showCR:s.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   260
									[exEnd]
125
claus
parents: 122
diff changeset
   261
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   262
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   263
      asking for a password:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   264
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   265
	|s|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   266
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   267
	s := Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   268
		requestPassword:'enter your secret, please:'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   269
	Transcript show:'you entered: '; showCR:s.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   270
									[exEnd]
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   271
645
f6ef83a129e1 examples
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   272
      multiple choice dialogs:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   273
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   274
	Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   275
	   choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   276
	   fromList:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   277
	   values:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   278
	   buttons:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   279
	   values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   280
	   lines:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   281
	   cancel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   282
									[exEnd]
645
f6ef83a129e1 examples
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   283
f6ef83a129e1 examples
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   284
      multiple choice dialog, with list & buttons:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   285
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   286
	 Transcript showCR:(
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   287
	     Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   288
		choose:'choose example' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   289
		fromList:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   290
		values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   291
		buttons:#('five' 'six' 'seven')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   292
		values:#(5 6 7)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   293
		lines:4
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   294
		cancel:[Transcript flash. #aborted]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   295
	 )
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   296
									[exEnd]
645
f6ef83a129e1 examples
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   297
f6ef83a129e1 examples
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   298
    You can (and often have to) construct custom dialogs programmatically, 
f6ef83a129e1 examples
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   299
    from individual components. As shown in the following examples:
91
e8db16616e97 *** empty log message ***
claus
parents: 76
diff changeset
   300
121
claus
parents: 120
diff changeset
   301
    basic (unusable) example:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   302
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   303
	DialogBox new open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   304
									[exEnd]
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   305
121
claus
parents: 120
diff changeset
   306
    still unusable - only an ok-button:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   307
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   308
	DialogBox new addOkButton; open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   309
									[exEnd]
121
claus
parents: 120
diff changeset
   310
claus
parents: 120
diff changeset
   311
    both ok- and abortButtons:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   312
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   313
	DialogBox new addAbortButton; addOkButton; open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   314
									[exEnd]
121
claus
parents: 120
diff changeset
   315
122
claus
parents: 121
diff changeset
   316
    with different ok-label:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   317
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   318
	DialogBox new addAbortButton; addOkButtonLabelled:'yeah'; open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   319
									[exEnd]
122
claus
parents: 121
diff changeset
   320
645
f6ef83a129e1 examples
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   321
    adding a (centered by default) textlabel gives an infoBox:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   322
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   323
	DialogBox new
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   324
	    addTextLabel:'hello';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   325
	    addOkButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   326
	    open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   327
									[exEnd]
121
claus
parents: 120
diff changeset
   328
claus
parents: 120
diff changeset
   329
    a textlabel with abort- and okButton gives a yesNoBox:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   330
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   331
	DialogBox new
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   332
	    addTextLabel:'hello';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   333
	    addAbortButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   334
	    addOkButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   335
	    open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   336
									[exEnd]
121
claus
parents: 120
diff changeset
   337
claus
parents: 120
diff changeset
   338
    the same, adjusting the labels contents to the left:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   339
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   340
	|box|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   341
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   342
	box := DialogBox new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   343
	(box addTextLabel:'hello') adjust:#left.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   344
	box addAbortButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   345
	    addOkButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   346
	    open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   347
									[exEnd]
121
claus
parents: 120
diff changeset
   348
122
claus
parents: 121
diff changeset
   349
    with modified buttons:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   350
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   351
	|box|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   352
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   353
	box := DialogBox new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   354
	(box addTextLabel:'are you certain ?') adjust:#left.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   355
	box addAbortButtonLabelled:'not really'. 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   356
	(box addOkButtonLabelled:'yes, absolutely') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   357
		activeBackgroundColor:Color red. 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   358
	box open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   359
									[exEnd]
122
claus
parents: 121
diff changeset
   360
claus
parents: 121
diff changeset
   361
645
f6ef83a129e1 examples
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   362
    mswindows style (different up/down bitmaps in buttons):
f6ef83a129e1 examples
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   363
    ((try tabbing ...)
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   364
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   365
	|b box|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   366
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   367
	box := DialogBox new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   368
	(box addTextLabel:'are you certain ?') adjust:#left.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   369
	b := Button new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   370
	b activeLogo:(Image fromFile:'bitmaps/cancel_down.bmp').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   371
	b passiveLogo:(Image fromFile:'bitmaps/cancel_up.bmp').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   372
	b focusLogo:(Image fromFile:'bitmaps/cancel_focus.bmp').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   373
	b beImageButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   374
	box addAbortButton:b.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   375
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   376
	b := Button new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   377
	b activeLogo:(Image fromFile:'bitmaps/ok_down.bmp').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   378
	b passiveLogo:(Image fromFile:'bitmaps/ok_up.bmp').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   379
	b focusLogo:(Image fromFile:'bitmaps/ok_focus.bmp').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   380
	b beImageButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   381
	box addOkButton:b.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   382
	box open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   383
									[exEnd]
162
claus
parents: 157
diff changeset
   384
claus
parents: 157
diff changeset
   385
121
claus
parents: 120
diff changeset
   386
    two textlabels:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   387
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   388
	DialogBox new
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   389
	    addTextLabel:'hello';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   390
	    addTextLabel:'world';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   391
	    addAbortButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   392
	    addOkButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   393
	    open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   394
									[exEnd]
118
claus
parents: 112
diff changeset
   395
121
claus
parents: 120
diff changeset
   396
    fixing the dialogs size (suppres it calculating its size from the
130
claus
parents: 128
diff changeset
   397
    preferredExtents of its components):
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   398
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   399
	DialogBox new
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   400
	    label:'a simple dialog';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   401
	    addTextLabel:'hello';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   402
	    addAbortButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   403
	    addOkButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   404
	    extent:200@200;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   405
	    sizeFixed:true;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   406
	    open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   407
									[exEnd]
118
claus
parents: 112
diff changeset
   408
121
claus
parents: 120
diff changeset
   409
    asking the box if it was closed via ok:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   410
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   411
	(DialogBox new
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   412
	    label:'a simple dialog';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   413
	    addTextLabel:'hello';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   414
	    addAbortButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   415
	    addOkButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   416
	    extent:200@200;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   417
	    sizeFixed:true;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   418
	    open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   419
	) accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   420
	    Transcript showCR:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   421
	] ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   422
	    Transcript showCR:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   423
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   424
									[exEnd]
118
claus
parents: 112
diff changeset
   425
121
claus
parents: 120
diff changeset
   426
    textLabels are not limited to strings (although, the name which is
claus
parents: 120
diff changeset
   427
    used for ST-80 compatibility, suggests it):
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   428
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   429
	DialogBox new
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   430
	    addTextLabel:(Image fromFile:'bitmaps/garfield.gif');
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   431
	    addOkButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   432
	    open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   433
									[exEnd]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   434
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   435
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   436
	DialogBox new
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   437
	    addTextLabel:'hello';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   438
	    addTextLabel:((Image fromFile:'bitmaps/garfield.gif')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   439
				magnifiedTo:200@150);
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   440
	    addTextLabel:'world';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   441
	    addAbortButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   442
	    addOkButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   443
	    open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   444
									[exEnd]
120
claus
parents: 118
diff changeset
   445
121
claus
parents: 120
diff changeset
   446
    adding an input field (on a string model):
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   447
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   448
	|stringModel|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   449
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   450
	stringModel := '' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   451
	(DialogBox new
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   452
	    addTextLabel:'Please enter a string:';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   453
	    addInputFieldOn:stringModel; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   454
	    addAbortButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   455
	    addOkButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   456
	    open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   457
	) accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   458
	    Transcript showCR:'entered: ', stringModel value
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   459
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   460
									[exEnd]
120
claus
parents: 118
diff changeset
   461
claus
parents: 118
diff changeset
   462
121
claus
parents: 120
diff changeset
   463
    multiple input fields (notice, that the dialog connects the fields
claus
parents: 120
diff changeset
   464
    in a group, so stepping is allowed via Cursor and Return keys):
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   465
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   466
	|firstName lastName|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   467
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   468
	firstName := '' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   469
	lastName := '' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   470
	(DialogBox new
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   471
	    addTextLabel:'Please enter your name:';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   472
	    addInputFieldOn:firstName; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   473
	    addVerticalSpace;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   474
	    addInputFieldOn:lastName; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   475
	    addAbortButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   476
	    addOkButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   477
	    open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   478
	) accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   479
	    Transcript showCR:'entered: ', firstName value , ' ' , lastName value
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   480
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   481
									[exEnd]
121
claus
parents: 120
diff changeset
   482
claus
parents: 120
diff changeset
   483
claus
parents: 120
diff changeset
   484
    of course, the model may contain a value initially:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   485
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   486
	|firstName lastName p line i name|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   487
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   488
	firstName := '' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   489
	lastName := '' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   490
	p := PipeStream readingFrom:'finger ' , OperatingSystem getLoginName.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   491
	p notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   492
	    line := p nextLine.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   493
	    (i := line findString:'Name:') ~~ 0 ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   494
		name := line copyFrom:(i + 'Name:' size).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   495
	    ] ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   496
		(i := line findString:'real life:') == 0 ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   497
		    line := p nextLine.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   498
		].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   499
		(i := line findString:'real life:') ~~ 0 ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   500
		    name := line copyFrom:(i + 'real life:' size).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   501
		]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   502
	    ].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   503
	    name notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   504
		firstName value: name asCollectionOfWords first.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   505
		lastName  value: name asCollectionOfWords last.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   506
		Transcript showCR:'initially ' , firstName value , ' ' , lastName value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   507
	    ].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   508
	    p close.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   509
	].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   510
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   511
	(DialogBox new
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   512
	    addTextLabel:'Please enter your name:';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   513
	    addInputFieldOn:firstName; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   514
	    addVerticalSpace;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   515
	    addInputFieldOn:lastName; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   516
	    addAbortButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   517
	    addOkButton;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   518
	    open
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   519
	) accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   520
	    Transcript showCR:'entered: ', firstName value , ' ' , lastName value
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   521
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   522
									[exEnd]
121
claus
parents: 120
diff changeset
   523
120
claus
parents: 118
diff changeset
   524
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
   525
    validated password entry:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   526
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   527
	|box firstEntry secondEntry|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   528
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   529
	firstEntry := '' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   530
	secondEntry := '' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   531
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   532
	box := DialogBox new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   533
	(box addTextLabel:'Please enter your secret:') adjust:#left.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   534
	(box addInputFieldOn:firstEntry) passwordCharacter:$*. 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   535
	box addVerticalSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   536
	(box addInputFieldOn:secondEntry) passwordCharacter:$*. 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   537
	box addAbortButton. 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   538
	box addOkButton. 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   539
	box open.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   540
	box accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   541
	    firstEntry value ~= secondEntry value ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   542
		Transcript showCR:'wrong input - try again'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   543
	    ] ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   544
		Transcript showCR:'entered: ', firstEntry value
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   545
	    ]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   546
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   547
									[exEnd]
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   548
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   549
     input fields with a label:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   550
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   551
	|box firstNameHolder middleNameHolder lastNameHolder|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   552
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   553
	firstNameHolder := 'John' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   554
	middleNameHolder := 'F' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   555
	lastNameHolder := 'Peters' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   556
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   557
	box := DialogBox new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   558
	box 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   559
	    addLabelledInputField:'first name:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   560
	    adjust:#right
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   561
	    on:firstNameHolder
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   562
	    tabable:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   563
	    separateAtX:0.4.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   564
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   565
	box 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   566
	    addLabelledInputField:'middle initial:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   567
	    adjust:#right
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   568
	    on:middleNameHolder
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   569
	    tabable:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   570
	    separateAtX:0.4.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   571
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   572
	box 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   573
	    addLabelledInputField:'last name:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   574
	    adjust:#right
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   575
	    on:lastNameHolder
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   576
	    tabable:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   577
	    separateAtX:0.4.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   578
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   579
	box addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   580
	box open.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   581
									[exEnd]
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   582
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   583
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   584
     constructing a dialog from other elements:
121
claus
parents: 120
diff changeset
   585
     adding a fileSelectionList:
claus
parents: 120
diff changeset
   586
     (since the dialog adds the component with its preferred extent,
claus
parents: 120
diff changeset
   587
      ignoring the 300-height, this looks ugly ... 
claus
parents: 120
diff changeset
   588
      ... especially when resized vertically)
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   589
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   590
	|top l scr fileName|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   591
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   592
	fileName := '' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   593
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   594
	top := DialogBox new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   595
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   596
	l := FileSelectionList new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   597
	l useIndex:false.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   598
	l doubleClickAction:[:name | top okPressed].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   599
	l action:[:name | fileName value:name].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   600
	scr := ScrollableView forView:l.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   601
	scr extent:(1.0 @ 300).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   602
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   603
	top addComponent:scr.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   604
	top addAbortButton; addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   605
	top openModal.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   606
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   607
	top accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   608
	    Transcript show:'fileName: '; showCR:fileName value storeString.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   609
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   610
									[exEnd]
121
claus
parents: 120
diff changeset
   611
claus
parents: 120
diff changeset
   612
    same, looks better, since the height is made larger (not using 
claus
parents: 120
diff changeset
   613
    fileLists preferredExtent):
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   614
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   615
	|top l scr fileName|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   616
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   617
	fileName := '' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   618
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   619
	top := DialogBox new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   620
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   621
	l := FileSelectionList new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   622
	l useIndex:false.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   623
	l doubleClickAction:[:name | top okPressed].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   624
	l action:[:name | fileName value:name].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   625
	scr := ScrollableView forView:l.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   626
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   627
	top addComponent:scr withExtent:300@300.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   628
	top addAbortButton; addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   629
	top openModal.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   630
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   631
	top accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   632
	    Transcript show:'fileName: '; showCR:fileName value storeString.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   633
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   634
									[exEnd]
121
claus
parents: 120
diff changeset
   635
claus
parents: 120
diff changeset
   636
claus
parents: 120
diff changeset
   637
    again, setting the boxes initial size and fixing it
130
claus
parents: 128
diff changeset
   638
    (let it ignore the components' preferredExtent):
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   639
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   640
	|top fixFrame l scr fileName|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   641
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   642
	fileName := '' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   643
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   644
	top := DialogBox new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   645
	top extent:300@300.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   646
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   647
	fixFrame := View new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   648
	fixFrame extent:(1.0 @ 300).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   649
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   650
	l := FileSelectionList new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   651
	l useIndex:false.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   652
	l doubleClickAction:[:name | top okPressed].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   653
	l action:[:name | fileName value:name].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   654
	scr := ScrollableView forView:l.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   655
	scr origin:0.0@0.0 corner:1.0@1.0.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   656
	fixFrame add:scr.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   657
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   658
	top addComponent:fixFrame.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   659
	top addAbortButton; addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   660
	top openModal.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   661
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   662
	top accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   663
	    Transcript show:'fileName: '; showCR:fileName value storeString.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   664
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   665
									[exEnd]
118
claus
parents: 112
diff changeset
   666
claus
parents: 112
diff changeset
   667
claus
parents: 112
diff changeset
   668
   adding a panel with checkBoxes:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   669
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   670
	|top panel b value1 value2 value3 value4|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   671
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   672
	value1 := true asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   673
	value2 := false asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   674
	value3 := false asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   675
	value4 := true asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   676
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   677
	top := DialogBox new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   678
	top extent:200@300.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   679
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   680
	panel := VerticalPanelView new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   681
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   682
	b := CheckBox on:value1. b label:'check1'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   683
	panel addSubView:b.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   684
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   685
	b := CheckBox on:value2. b label:'check2'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   686
	panel addSubView:b.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   687
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   688
	b := CheckBox on:value3. b label:'check3'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   689
	panel addSubView:b.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   690
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   691
	b := CheckBox on:value4. b label:'check4'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   692
	panel addSubView:b.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   693
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   694
	top addComponent:panel.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   695
	top addAbortButton; addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   696
	top open.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   697
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   698
	top accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   699
	    Transcript show:'value1: '; showCR:value1 value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   700
	    Transcript show:'value2: '; showCR:value2 value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   701
	    Transcript show:'value3: '; showCR:value3 value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   702
	    Transcript show:'value4: '; showCR:value4 value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   703
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   704
									[exEnd]
118
claus
parents: 112
diff changeset
   705
120
claus
parents: 118
diff changeset
   706
   same, using a more convenient interface:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   707
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   708
	|box value1 value2 value3 value4|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   709
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   710
	value1 := true asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   711
	value2 := false asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   712
	value3 := false asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   713
	value4 := true asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   714
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   715
	box := DialogBox new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   716
	box extent:200@300.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   717
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   718
	box addCheckBox:'check1' on:value1.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   719
	box addVerticalSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   720
	box addCheckBox:'check2' on:value2.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   721
	box addVerticalSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   722
	box addCheckBox:'check3' on:value3.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   723
	box addVerticalSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   724
	box addCheckBox:'check4' on:value4.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   725
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   726
	box addAbortButton; addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   727
	box open.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   728
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   729
	box accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   730
	    Transcript show:'value1: '; showCR:value1 value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   731
	    Transcript show:'value2: '; showCR:value2 value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   732
	    Transcript show:'value3: '; showCR:value3 value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   733
	    Transcript show:'value4: '; showCR:value4 value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   734
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   735
									[exEnd]
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   736
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   737
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   738
    same, using an even better interface:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   739
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   740
	|box values labels|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   741
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   742
	values := #(true false false true) collect:[:val | val asValue].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   743
	labels := #('check1' 'check2' 'check3' 'check4').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   744
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   745
	box := Dialog new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   746
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   747
	box
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   748
	   addColumn:(1 to:labels size)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   749
	   fromX:0.0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   750
	   toX:1.0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   751
	   collect:[:index | CheckBox label:(labels at:index) model:(values at:index)]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   752
	   tabable:true.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   753
        
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   754
	box addAbortButton; addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   755
	box open.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   756
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   757
	box accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   758
	   values with:labels do:[:val :lbl |
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   759
	      Transcript show:(lbl , ': '); showCR:val value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   760
	   ]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   761
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   762
									[exEnd]
126
claus
parents: 125
diff changeset
   763
claus
parents: 125
diff changeset
   764
164
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
   765
    adding two panels in a frame:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   766
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   767
	|box frame vPanel1 vPanel2 m1 m2 m3 m4 chk ef|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   768
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   769
	box := Dialog new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   770
	box label:'example'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   771
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   772
	frame := FramedBox label:'frame'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   773
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   774
	vPanel1 := VerticalPanelView origin:0.0@0.0 corner:0.5@1.0 in:frame.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   775
	vPanel1 horizontalLayout:#leftSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   776
	vPanel1 verticalLayout:#spreadSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   777
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   778
	vPanel2 := VerticalPanelView origin:0.5@0.0 corner:1.0@1.0 in:frame.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   779
	vPanel2 horizontalLayout:#leftSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   780
	vPanel2 verticalLayout:#spreadSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   781
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   782
	m1 := true asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   783
	m2 := true asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   784
	m3 := true asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   785
	m4 := 'hello' asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   786
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   787
	vPanel1 add:(Label label:'check1').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   788
	vPanel1 add:(Label label:'m2').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   789
	vPanel1 add:(Label label:'m3').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   790
	vPanel1 add:(Label label:'enter').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   791
	vPanel1 add:(Label label:'lbl1').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   792
	vPanel1 add:(Label label:'lbl2').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   793
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   794
	vPanel2 add:(chk := CheckToggle on:m1). 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   795
	box makeTabable:chk.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   796
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   797
	vPanel2 add:(chk := CheckToggle on:m2). 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   798
	box makeTabable:chk.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   799
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   800
	vPanel2 add:(chk := CheckToggle on:m3). 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   801
	box makeTabable:chk.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   802
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   803
	vPanel2 add:(chk := CheckToggle on:m3). 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   804
	box makeTabable:chk.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   805
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   806
	vPanel2 add:(chk := CheckToggle on:m3). 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   807
	box makeTabable:chk.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   808
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   809
	vPanel2 add:(ef := EditField on:m4). 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   810
	ef immediateAccept:true.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   811
	box makeTabable:ef.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   812
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   813
	box addComponent:frame.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   814
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   815
	box addAbortButton; addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   816
	box openModal.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   817
	box accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   818
	    Transcript showCR:'accepted with:'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   819
	    Transcript showCR:'   m1: ' , m1 value printString.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   820
	    Transcript showCR:'   m2: ' , m2 value printString.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   821
	    Transcript showCR:'   m3: ' , m3 value printString.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   822
	    Transcript showCR:'   m4: ' , m4 value printString.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   823
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   824
									[exEnd]
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   825
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   826
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   827
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   828
    a full example (combined settings dialog - as in launcher):
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   829
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   830
	|box warnSTX allowUnderscore immutableArrays logDoits
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   831
	 listOfLanguages listOfStyles styleNames 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   832
	 frame panel c resourceDir dir |
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   833
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   834
	warnSTX := Compiler warnSTXSpecials asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   835
	allowUnderscore := Compiler allowUnderscoreInIdentifier asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   836
	immutableArrays := Compiler arraysAreImmutable asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   837
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   838
	logDoits := Smalltalk logDoits asValue.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   839
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   840
	listOfLanguages := SelectionInList with:#('english'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   841
						  'french'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   842
						  'german'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   843
						  'italian'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   844
						  'spanish'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   845
						 ).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   846
	listOfLanguages selection:(Language asString).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   847
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   848
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   849
	resourceDir := Smalltalk getSystemFileName:'resources'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   850
	dir := FileDirectory directoryNamed:resourceDir.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   851
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   852
	styleNames := dir select:[:aFileName | aFileName endsWith:'.style'].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   853
	styleNames := styleNames collect:[:aFileName | aFileName copyWithoutLast:6].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   854
	listOfStyles := SelectionInList with:styleNames sort.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   855
	listOfStyles selection:(View defaultStyle asString).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   856
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   857
	box := Dialog new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   858
	box label:'Settings'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   859
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   860
	frame := FramedBox label:'Compiler'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   861
	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   862
	panel horizontalLayout:#leftSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   863
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   864
	panel add:((CheckBox on:warnSTX) label:'warn about ST/X language extensions'; resize).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   865
	panel add:((CheckBox on:allowUnderscore) label:'allow underscore in identifiers'; resize).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   866
	panel add:((CheckBox on:immutableArrays) label:'literal arrays are immutable'; resize).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   867
	box addComponent:frame.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   868
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   869
	frame := FramedBox label:'Misc'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   870
	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   871
	panel horizontalLayout:#leftSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   872
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   873
	panel add:((CheckBox on:logDoits) label:'log doIts in changes file'; resize).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   874
	box addComponent:frame.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   875
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   876
	frame := FramedBox label:'Language'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   877
	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   878
	panel horizontalLayout:#leftSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   879
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   880
	panel add:((PopUpList on:listOfLanguages) width:0.5).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   881
	box addComponent:frame.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   882
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   883
	frame := FramedBox label:'Style'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   884
	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   885
	panel horizontalLayout:#leftSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   886
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   887
	panel add:((PopUpList on:listOfStyles) width:0.5).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   888
	box addComponent:frame.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   889
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   890
	box addAbortButton; addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   891
	box showAtPointer.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   892
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   893
	box accepted ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   894
	    Transcript topView withCursor:Cursor wait do:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   895
		Compiler warnSTXSpecials:warnSTX value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   896
		Compiler allowUnderscoreInIdentifier:allowUnderscore value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   897
		Compiler arraysAreImmutable:immutableArrays value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   898
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   899
		Smalltalk logDoits:logDoits value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   900
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   901
		Transcript showCR:'change language to ' , listOfLanguages selection , ' ...'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   902
		Smalltalk at:#Language put:listOfLanguages selection asSymbol.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   903
		Smalltalk changed:#Language.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   904
		ResourcePack flushCachedResourcePacks.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   905
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   906
		Transcript showCR:'change style to ' , listOfStyles selection , ' ...'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   907
		View defaultStyle:listOfStyles selection asSymbol.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   908
	    ]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   909
	]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   910
									[exEnd]
625
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   911
      an example from Hopkins/Horan:  
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   912
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   913
	|aText index|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   914
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   915
	aText := 'Smalltalk/X: An Introduction to Application Development' asText.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   916
	index := aText findString:'Smalltalk/X' startingAt:1.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   917
	aText emphasizeFrom:index 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   918
			 to:'Smalltalk/X' size + index - 1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   919
		       with:#bold.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   920
	index := aText findString:'Introduction' startingAt:index.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   921
	aText emphasizeFrom:index 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   922
			 to:'Introduction' size + index - 1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   923
		       with:#italic.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   924
	Dialog warn:aText        
625
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   925
        
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   926
									[exEnd]
625
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
   927
      the same, with colors:  
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   928
									[exBegin]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   929
	|aText index|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   930
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   931
	aText := 'Smalltalk/X: An Introduction to Application Development' asText.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   932
	index := aText findString:'Smalltalk/X' startingAt:1.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   933
	aText emphasizeFrom:index 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   934
			 to:'Smalltalk/X' size + index - 1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   935
		       with:(Array with:#bold with:#underline with:(#color->Color red)).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   936
	index := aText findString:'Introduction' startingAt:index.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   937
	aText emphasizeFrom:index 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   938
			 to:'Introduction' size + index - 1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   939
		       with:#italic.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   940
	Dialog warn:aText        
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   941
									[exEnd]
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   942
"
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   943
!
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   944
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   945
inputFocus
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   946
"
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   947
    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
   948
    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
   949
600
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   950
    The default is to shift the focus to the ok-button - thus, another return
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   951
    has to be entered (as confirmation) to close & accept the box.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   952
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   953
    This can be changed to force an automatic OK with:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   954
	aBox focusToOKOnLeave:false
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   955
600
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   956
    Then, leaving the last field with return, automatically accepts the box,
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   957
    as if ok was pressed. (useful for simple - single entry dialogs).
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   958
    All simple dialogs (like 'enter a searchString') behave this way.
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   959
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   960
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   961
    With: 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   962
	aBox acceptReturnAsOK:false
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   963
600
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   964
    any focusShift or automatic OK is turned off, and the input group 
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   965
    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
   966
    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
   967
    (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
   968
     to be handled somehow).
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   969
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   970
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   971
    Simply leaving the group with a cursor movement may also be either
600
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   972
    interpreted as a return (the default), or again wrap back to the top
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   973
    of the group.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   974
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   975
    With:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   976
	aBox acceptOnLeave:false
600
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   977
    this is turned off, so that with cursor-down, the focus is moved back 
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   978
    to the first entry field. The default is true.
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   979
"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
   980
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
   981
1371
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   982
!DialogBox class methodsFor:'Compatibility - VW'!
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   983
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   984
choose:aString fromList:list values:listValues lines:maxLines cancel:cancelBlock for:aView
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   985
    "launch a Dialog showing the message and list.
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   986
     The user can select an item and click ok; in this case, the corresponding value
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   987
     from listValues is returned (doubleclick works as well).
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   988
     If cancel is pressed, the value of cancelBlock is returned.
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   989
     Pressing ok without a selection is treated like cancel.
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   990
     This is a new VW2.5 interface - passing an addtional argument.
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   991
     In ST/X, this is not needed and ignored"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   992
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   993
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   994
	choose:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   995
	fromList:list 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   996
	values:listValues
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   997
	lines:maxLines
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
   998
	cancel:cancelBlock
1371
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
   999
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1000
    "
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1001
     Transcript showCR:(
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1002
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1003
	    choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1004
	    fromList:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1005
	    values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1006
	    lines:4
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1007
	    cancel:nil
1371
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1008
     )
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1009
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1010
     Transcript showCR:(
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1011
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1012
	    choose:'choose example' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1013
	    fromList:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1014
	    values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1015
	    lines:4
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1016
	    cancel:[Transcript flash. #aborted]
1371
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1017
     )
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1018
    "
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1019
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1020
    "Created: / 1.11.1997 / 13:21:32 / cg"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1021
    "Modified: / 1.11.1997 / 13:21:54 / cg"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1022
!
1102
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1023
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1024
confirm:aMessageString for:ignoredView
1371
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1025
    "VW compatibility - confirm using the same viewStyle as in the view
1102
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1026
     argument; not supported in ST/X (who mixes styles ?)"
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1027
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1028
    ^ self confirm:aMessageString
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1029
1371
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1030
    "Created: / 6.3.1997 / 15:45:54 / cg"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1031
    "Modified: / 31.10.1997 / 11:54:59 / cg"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1032
!
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1033
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1034
request:aString for:aView
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1035
    "launch a Dialog, which allows user to enter something.
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1036
     Return the entered string (may be empty string) 
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1037
     or the empty string (if cancel was pressed),
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1038
     This is a new VW2.5 interface - passing an addtional argument.
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1039
     In ST/X, this is not needed and ignored"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1040
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1041
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1042
	request:aString
1371
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1043
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1044
    "Created: / 31.10.1997 / 03:26:32 / cg"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1045
    "Modified: / 31.10.1997 / 11:53:50 / cg"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1046
!
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1047
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1048
request:aString initialAnswer:initial for:aView
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1049
    "launch a Dialog, which allows user to enter something.
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1050
     Return the entered string (may be empty string) or nil (if cancel was pressed).
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1051
     This is a new VW2.5 interface - passing an addtional argument.
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1052
     In ST/X, this is not needed and ignored"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1053
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1054
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1055
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1056
	initialAnswer:initial
1371
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1057
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1058
    "Modified: / 29.5.1996 / 14:30:05 / cg"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1059
    "Created: / 1.11.1997 / 13:18:29 / cg"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1060
!
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1061
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1062
requestFileName:title default:default version:versionSym ifFail:failBlock for:aViewOrNil
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1063
    "new VW2.5 interface - passing an addtional argument.
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1064
     In ST/X, this is not needed and ignored"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1065
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1066
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1067
	requestFileName:title default:default version:versionSym ifFail:failBlock
1371
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1068
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1069
    "Created: / 31.10.1997 / 02:00:42 / cg"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1070
    "Modified: / 31.10.1997 / 11:52:53 / cg"
1102
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1071
!
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1072
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1073
warn:aMessageString for:ignoredView
1371
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1074
    "VW compatibility - warn using the same viewStyle as in the view
1102
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1075
     argument; not supported in ST/X (who mixes styles ?)"
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1076
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1077
    ^ self warn:aMessageString
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1078
1371
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1079
    "Created: / 6.3.1997 / 15:46:02 / cg"
ed9319778d4b st80 stuff
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
  1080
    "Modified: / 31.10.1997 / 11:54:35 / cg"
1102
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1081
! !
d68cff021b9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
  1082
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1083
!DialogBox class methodsFor:'class initialization'!
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1084
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1085
initialize
528
3ed1f0b5a0bb oops - dont clobber Dialog global if subclasses #initialize
Claus Gittinger <cg@exept.de>
parents: 498
diff changeset
  1086
    self == DialogBox ifTrue:[
1757
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1087
        Dialog := self
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1088
    ].
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1089
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1090
    DefaultFocusToOKOnLeave := false.
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1091
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1092
    "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
  1093
    "Modified: 10.4.1996 / 08:16:18 / cg"
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1094
! !
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1095
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1096
!DialogBox class methodsFor:'common dialogs'!
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1097
1703
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1098
informUser:aString during:aBlock
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1099
    "show a message-box while executing aBlock"
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1100
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1101
    |box|
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1102
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1103
    [
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1104
        box := InfoBox title:aString.
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1105
        box hideButtons.
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1106
        box showAtPointer.
1704
304ccbc56ec4 fixed #informUser:during: in case of timeSlicer not running.
Claus Gittinger <cg@exept.de>
parents: 1703
diff changeset
  1107
    ] forkAt:(Processor activePriority + 1).
1703
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1108
    aBlock valueNowOrOnUnwindDo:[box destroy]
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1109
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1110
    "
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1111
     Dialog informUser:'wait a second...' during:[Delay waitForSeconds:1]
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1112
     Dialog informUser:'wait a few seconds...' during:[10000 factorial]
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1113
    "
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1114
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1115
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1116
!
8881861270f1 added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1117
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1118
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
  1119
    "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
  1120
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1121
    (InfoBox title:aString) showAtPointer; destroy
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1122
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1123
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1124
     Dialog information:'help'
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1125
    "
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1126
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1127
    "Modified: 29.5.1996 / 15:23:03 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1128
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1129
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1130
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
  1131
    "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
  1132
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1133
    (WarningBox title:aString) showAtPointer; destroy
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1134
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1135
    "
625
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1136
     Dialog warn:'some warning message'
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1137
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1138
     Dialog warn:('some text with italic emphasis' asText 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1139
			emphasizeFrom:16 to:22 with:#italic)
625
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1140
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1141
     Dialog warn:('some warning message' asText 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1142
			emphasizeAllWith:(#color->Color red))
625
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1143
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1144
     Dialog warn:('some text with color emphasis' asText 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1145
			emphasizeFrom:6 to:10 with:(#color->Color blue);
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1146
			emphasizeFrom:16 to:20 with:(#color->Color red))
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1147
    "
625
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1148
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1149
    "Modified: 29.5.1996 / 15:23:14 / 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
  1150
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1151
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1152
!DialogBox class methodsFor:'confirmation dialogs'!
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1153
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1154
confirm:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1155
    "launch a Dialog, which allows user to enter yes or no.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1156
     return true for yes, false for no"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1157
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1158
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1159
	confirm:aString
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1160
	title:(self classResources string:'confirm')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1161
	yesLabel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1162
	noLabel:nil
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1163
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1164
"/    |box answer|
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1165
"/
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1166
"/    box := YesNoBox title:aString.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1167
"/    box label:(self classResources string:'Confirm').
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1168
"/    box yesAction:[answer := true] noAction:[answer := false].
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1169
"/    box showAtPointer.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1170
"/    box yesAction:nil noAction:nil.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1171
"/    ^ answer
197
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
    " 
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1174
     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
  1175
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  1176
     Transcript showCR:(
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1177
	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
  1178
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1179
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1180
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1181
    "Modified: 14.11.1996 / 16:02:30 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1182
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1183
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1184
confirm:aString initialAnswer:what
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1185
    "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
  1186
     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
  1187
     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
  1188
     the default (i.e. return-) button"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1189
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1190
    |box answer|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1191
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1192
    box := YesNoBox title:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1193
    box yesAction:[answer := true] noAction:[answer := false].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1194
    what == false ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1195
	box okButton isReturnButton:false.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1196
	box acceptReturnAsOK:false.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1197
	box noButton beReturnButton.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1198
    ].
884
ef5688a6a636 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 881
diff changeset
  1199
    box label:(self classResources string:'confirm').
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1200
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1201
    box yesAction:nil noAction:nil.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1202
    box destroy.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1203
    ^ answer
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1204
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1205
    " 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1206
     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
  1207
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  1208
     Transcript showCR:(
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1209
	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
  1210
     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1211
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  1212
     Transcript showCR:(
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1213
	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
  1214
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1215
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1216
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1217
    "Modified: 14.11.1996 / 16:04:13 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1218
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1219
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1220
confirm:aString title:title yesLabel:yesText noLabel:noText
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1221
    "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
  1222
     return true for yes, false for no.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1223
     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
  1224
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1225
    |box answer t|
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1226
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1227
    box := YesNoBox title:aString.
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1228
    yesText notNil ifTrue:[
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1229
        box yesLabel:yesText.
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1230
    ].
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1231
    noText notNil ifTrue:[
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1232
        box noLabel:noText.
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1233
    ].
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1234
    answer := false.
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1235
    box yesAction:[answer := true].
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1236
    title notNil ifTrue:[
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1237
        t := title
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1238
    ] ifFalse:[
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1239
        t := self classResources string:'confirm'
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1240
    ].
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1241
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1242
    box label:t.
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1243
    box showAtPointer.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1244
    box yesAction:nil noAction:nil.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1245
    box destroy.
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1246
    ^ answer
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1247
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1248
    " 
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1249
     Dialog 
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1250
        confirm:'really ?' 
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1251
        title:'fooBar'
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1252
        yesLabel:'oh well' 
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1253
        noLabel:'nope'
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1254
    "
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1255
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1256
    " 
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1257
     Dialog 
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1258
        confirm:'really ?' 
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1259
        title:nil
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1260
        yesLabel:'oh well' 
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1261
        noLabel:'nope'
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1262
    "
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1263
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1264
    " 
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1265
     Dialog 
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1266
        confirm:'really ?' 
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1267
        title:''
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1268
        yesLabel:'oh well' 
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1269
        noLabel:'nope'
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1270
    "
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1271
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1272
    "Created: / 21.2.1996 / 01:10:14 / cg"
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1273
    "Modified: / 18.4.1998 / 19:25:21 / cg"
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1274
!
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1275
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1276
confirm:aString yesLabel:yesText noLabel:noText
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1277
    "launch a Dialog, which allows user to enter yes or no.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1278
     return true for yes, false for no.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1279
     The yes/no buttons labels are defined by yesText/noText."
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1280
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1281
    ^ self confirm:aString title:nil yesLabel:yesText noLabel:noText
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1282
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1283
    " 
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1284
     Dialog confirm:'really ?' yesLabel:'oh well' noLabel:'nope'
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1285
    "
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1286
374
39a735c9a1c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
  1287
    "Created: 21.2.1996 / 01:10:14 / cg"
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1288
    "Modified: 8.3.1996 / 21:15:06 / cg"
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1289
!
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1290
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1291
confirmWithCancel:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1292
    "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
  1293
     return true for 'yes', false for 'no', nil for 'cancel'"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1294
1004
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1295
    ^ self confirmWithCancel:aString default:nil
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1296
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1297
    "
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1298
     Dialog confirmWithCancel:'really ?' 
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1299
    "
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1300
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1301
    "
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1302
     Transcript showCR:(
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1303
	Dialog confirmWithCancel:'really ?'
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1304
     )
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1305
    "
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1306
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1307
    "Modified: 18.10.1996 / 14:51:51 / cg"
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1308
!
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1309
1004
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1310
confirmWithCancel:aString default:default
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1311
    "launch a Dialog, which allows user to enter yes, no and cancel.
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1312
     return true for 'yes', false for 'no', nil for 'cancel'.
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1313
     The default argument marks the return-button; it may be one of nil, false or true"
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1314
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1315
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1316
	confirmWithCancel:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1317
		   labels:(self 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1318
			       classResources 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1319
				   array:
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1320
					#('cancel' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1321
					  'no' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1322
					  'yes')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1323
			  )
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1324
		  default:(#(nil false true) indexOf:default ifAbsent:nil)
1004
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1325
    "
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1326
     Dialog confirmWithCancel:'really ?' default:false
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1327
    "
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1328
!
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1329
1624
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1330
confirmWithCancel:aString labels:labelArray
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1331
    "launch a Dialog, which allows user to enter cancel, no or yes.
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1332
     Return true for 'yes', false for 'no', nil for 'cancel'.
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1333
     The default is yes.
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1334
     The buttons labels are given in labelArray"
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1335
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1336
    ^ self
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1337
        confirmWithCancel:aString 
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1338
                   labels:(self 
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1339
                               classResources 
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1340
                                   array:labelArray
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1341
                          )
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1342
                  default:3
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1343
    "
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1344
     Dialog confirmWithCancel:'really ?' labels:#( 'oops' 'nope' 'yea')
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1345
    "
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1346
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1347
    "Modified: / 28.7.1998 / 21:40:40 / cg"
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1348
!
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1349
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1350
confirmWithCancel:aString labels:buttonLabels default:default
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1351
    "launch a Dialog, which allows user to enter yes, no and cancel.
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1352
     Return true for 'yes', false for 'no', nil for 'cancel'.
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1353
     The strings for cancel, no and yes are to be passed in
1004
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1354
     buttonLabels; 
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1355
     The default argument (if non-nil) defines the index of the 
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1356
     return button (1 to 3)"
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1357
1707
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1358
    ^ self
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1359
        confirmWithCancel:aString 
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1360
        labels:buttonLabels 
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1361
        values:#(nil false true)
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1362
        default:default
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1363
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1364
    "
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1365
     Transcript showCR:(
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1366
         Dialog 
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1367
            confirmWithCancel:'really ?'
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1368
                       labels:#('mhmh' 'maybe' 'definitely')
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1369
                      default:3
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1370
     )
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1371
    "
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1372
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1373
    "Created: / 18.10.1996 / 14:50:51 / cg"
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1374
    "Modified: / 21.10.1998 / 15:49:16 / cg"
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1375
!
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1376
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1377
confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1378
    "launch a Dialog, which allows user to click on any button.
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1379
     Return the corresponding value from the values array.
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1380
     The labels for for the buttons are to be passed in
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1381
     buttonLabels; 
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1382
     The default argument (if non-nil) defines the index of the 
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1383
     return button (1 to n)"
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1384
1748
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1385
    ^ self
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1386
        confirmWithCancel:aString 
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1387
        labels:buttonLabels 
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1388
        values:buttonValues 
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1389
        default:default
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1390
        boxLabel:nil
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1391
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1392
    "
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1393
     Transcript showCR:(
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1394
         Dialog 
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1395
            confirmWithCancel:'really ?'
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1396
                       labels:#('mhmh' 'maybe' 'definitely')
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1397
                       values:#(1 2 3)
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1398
                      default:3
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1399
     )
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1400
    "
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1401
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1402
    "Created: / 18.10.1996 / 14:50:51 / cg"
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1403
    "Modified: / 21.10.1998 / 17:14:14 / cg"
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1404
!
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1405
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1406
confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default boxLabel:boxLabelOrNil
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1407
    "launch a Dialog, which allows user to click on any button.
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1408
     Return the corresponding value from the values array.
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1409
     The labels for for the buttons are to be passed in
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1410
     buttonLabels; 
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1411
     The default argument (if non-nil) defines the index of the 
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1412
     return button (1 to n)"
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1413
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1414
    |box answer|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1415
1708
dc23c5ca439e fixed button-creation in confirmWithCancel.
Claus Gittinger <cg@exept.de>
parents: 1707
diff changeset
  1416
    box := OptionBox title:aString numberOfOptions:buttonLabels size. 
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1417
    box buttonTitles:buttonLabels
1707
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1418
             actions:(buttonValues collect:[:v | [answer := v]]).
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1419
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1420
    default notNil ifTrue:[box defaultButtonIndex:default].
1748
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1421
    box label:(boxLabelOrNil ? (self classResources string:'confirm')).
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1422
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1423
    box actions:nil.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1424
    box destroy.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1425
    ^ answer
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1426
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1427
    "
1707
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1428
     Transcript showCR:(
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1429
         Dialog 
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1430
            confirmWithCancel:'really ?'
1748
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1431
            labels:#('mhmh' 'maybe' 'definitely')
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1432
            values:#(1 2 3)
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1433
            default:3
88215be18503 + confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
  1434
            boxLabel:'hello there'
1707
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1435
     )
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1436
    "
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1437
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  1438
    "Created: / 18.10.1996 / 14:50:51 / cg"
1708
dc23c5ca439e fixed button-creation in confirmWithCancel.
Claus Gittinger <cg@exept.de>
parents: 1707
diff changeset
  1439
    "Modified: / 21.10.1998 / 17:14:14 / 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
  1440
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1441
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1442
!DialogBox class methodsFor:'defaults'!
573
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1443
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1444
defaultLabel
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1445
    "return the boxes default window title."
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1446
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1447
    ^ 'Dialog'
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1448
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1449
    "Created: 23.4.1996 / 17:13:10 / cg"
1757
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1450
!
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1451
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1452
updateStyleCache
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1453
    "extract values from the styleSheet and cache them in class variables"
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1454
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1455
    <resource: #style (#'dialogBox.returnShiftsFocusToOK')>
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1456
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1457
    DefaultFocusToOKOnLeave := StyleSheet at:'dialogBox.returnShiftsFocusToOK' default:false.
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  1458
573
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1459
! !
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1460
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1461
!DialogBox class methodsFor:'file name dialogs'!
307
d3fe810390cb 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
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1463
requestDirectoryName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1464
    "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
  1465
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1466
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1467
	requestDirectoryName:'directory ?' 
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1468
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1469
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1470
     Dialog requestDirectoryName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1471
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1472
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1473
    "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
  1474
    "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
  1475
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1476
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1477
requestDirectoryName:title
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1478
    "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
  1479
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1480
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1481
	requestDirectoryName:title 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1482
	default:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1483
	ifFail:''
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1484
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1485
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1486
     Dialog
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1487
	requestDirectoryName:'which directory ?' 
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1488
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1489
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1490
    "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
  1491
    "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
  1492
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1493
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1494
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
  1495
    "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
  1496
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1497
    ^ self
1740
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1498
        requestDirectoryName:title 
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1499
        default:aFileName
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1500
        ifFail:''
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1501
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1502
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1503
     Dialog
1740
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1504
        requestDirectoryName:'which directory ?' 
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1505
        default:'/etc'
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1506
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1507
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1508
    "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
  1509
    "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
  1510
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1511
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1512
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
  1513
    "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
  1514
1740
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1515
    |dir dirF fN fileBox enteredName|
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1516
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1517
    fileBox := FileSelectionBox
1740
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1518
                    title:title
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1519
                    okText:'ok'
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1520
                    abortText:'cancel'
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1521
                    action:[:fileName | enteredName := fileName].
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1522
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1523
    fN := aFileName.
1780
bfc30a82aae3 dont get confused with a nil default
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1524
    dirF := (aFileName ? '.') asFilename.
1740
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1525
    dirF name = dirF baseName ifFalse:[
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1526
        dir := dirF directoryName.
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1527
        fN := dirF baseName.
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1528
    ] ifTrue:[
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1529
        dir := FileSelectionBox lastFileSelectionDirectory.
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1530
    ].
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1531
    dir notNil ifTrue:[
1740
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1532
        fileBox directory:dir.
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1533
    ].
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1534
1740
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1535
    fileBox initialText:fN.
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1536
    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
  1537
    fileBox showAtPointer.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1538
    fileBox destroy.
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1539
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1540
    (enteredName isNil 
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1541
    or:[enteredName isEmpty]) ifTrue:[
1740
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1542
        ^ failBlock value
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1543
    ].
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1544
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1545
    FileSelectionBox lastFileSelectionDirectory:(enteredName asFilename directoryName).
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1546
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1547
    ^ enteredName
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1548
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1549
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1550
     Dialog
1740
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1551
        requestDirectoryName:'which directory ?' 
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1552
        default:'/etc'
0160c5afae9c care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents: 1736
diff changeset
  1553
        ifFail:'none'
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1554
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1555
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1556
    "Created: 19.4.1996 / 14:31:04 / cg"
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1557
    "Modified: 23.10.1997 / 19:24:41 / cg"
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1558
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1559
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1560
requestFileName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1561
    "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
  1562
     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
  1563
     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
  1564
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1565
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1566
	requestFileName:'filename:' 
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1567
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1568
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1569
     Dialog requestFileName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1570
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1571
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1572
    "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
  1573
    "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
  1574
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1575
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1576
requestFileName:titleString
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1577
    "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
  1578
     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
  1579
     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
  1580
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1581
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1582
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1583
	default:'file.ext' 
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1584
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1585
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1586
     Dialog 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
  1587
     Dialog requestFileName:'enter a fileName:' 
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1588
    "
307
d3fe810390cb 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
d3fe810390cb 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
    "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
  1591
    "Modified: 19.4.1996 / 13:53:17 / cg"
118
claus
parents: 112
diff changeset
  1592
!
claus
parents: 112
diff changeset
  1593
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1594
requestFileName:titleString default:defaultName
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1595
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1596
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1597
     Return the pathname string consisting of the full pathname of the filename,
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1598
     or an empty string (if cancel was pressed)."
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1599
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1600
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1601
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1602
	default:defaultName 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1603
	version:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1604
	ifFail:''
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1605
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1606
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1607
     Dialog requestFileName:'enter a fileName:' default:''  
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1608
     Dialog requestFileName:'enter a fileName:' default:'Makefile.bak'  
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1609
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1610
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1611
    "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
  1612
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1613
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1614
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
  1615
    "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
  1616
     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
  1617
     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
  1618
     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
  1619
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1620
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1621
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1622
	default:defaultName 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1623
	version:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1624
	ifFail:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1625
	fromDirectory:aDirectoryPath
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1626
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1627
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1628
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1629
	requestFileName:'enter a fileName:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1630
	default:'Makefile.bak'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1631
	fromDirectory:'..'      
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1632
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1633
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1634
    "Modified: 19.4.1996 / 14:27:31 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1635
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1636
1736
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1637
requestFileName:titleString default:defaultName ifFail:failReturn pattern:pattern fromDirectory:dir
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1638
    "launch a Dialog, which allows user to enter a filename.
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1639
     The files presented initially are those from dir.
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1640
     The box will show ok/cancel in its buttons.
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1641
     The matchPattern is set to pattern initially.
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1642
     Return the string or failReturn if cancel was pressed."
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1643
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1644
    ^ self 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1645
        requestFileName:titleString 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1646
        default:defaultName
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1647
        version:nil
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1648
        ifFail:failReturn
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1649
        pattern:pattern
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1650
        fromDirectory:dir
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1651
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1652
!
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1653
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1654
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1655
    "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
  1656
     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
  1657
     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
  1658
     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
  1659
     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
  1660
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1661
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1662
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1663
	default:defaultName
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1664
	ok:okText 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1665
	abort:abortText 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1666
	pattern:pattern
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1667
	fromDirectory:nil
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1668
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1669
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1670
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1671
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1672
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1673
	ok:'yeah' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1674
	abort:'oh, no' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1675
	pattern:'*.st'   
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1676
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1677
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1678
    "Modified: 20.2.1997 / 18:13:13 / cg"
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1679
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1680
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1681
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
  1682
    "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
  1683
     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
  1684
     current directory (if a nil path is given).
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1685
     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
  1686
     The matchPattern is set to pattern initially.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1687
     Return the string, or nil if cancel was pressed."
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1688
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1689
    |box defaultDir defaultNm dir enteredName|
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1690
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1691
    defaultNm := defaultName.
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1692
    defaultDir := aDirectoryPath.
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1693
    defaultDir isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1694
	defaultNm notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1695
	    defaultDir := defaultName asFilename directoryName.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1696
	    defaultNm := defaultNm asFilename baseName.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1697
	    defaultDir = Filename currentDirectory name ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1698
		defaultName asFilename isExplicitRelative ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1699
		    defaultDir := nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1700
		]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1701
	    ]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1702
	].
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1703
    ].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1704
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1705
    box := FileSelectionBox 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1706
	       title:titleString
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1707
	       okText:okText 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1708
	       abortText:abortText
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1709
	       action:[:fileName | enteredName := fileName].
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1710
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1711
    defaultDir notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1712
	box directory:defaultDir
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1713
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1714
	dir := FileSelectionBox lastFileSelectionDirectory.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1715
	dir notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1716
	    box directory:dir.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1717
	].
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1718
    ].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1719
    box pattern:pattern.
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1720
    box initialText:defaultNm.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1721
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1722
    box action:nil.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1723
    box destroy.
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1724
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1725
    (enteredName notNil 
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1726
    and:[enteredName notEmpty]) ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1727
	FileSelectionBox lastFileSelectionDirectory:(enteredName asFilename directoryName).
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1728
    ].
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1729
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1730
    ^ enteredName
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1731
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1732
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1733
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1734
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1735
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1736
	ok:'yeah' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1737
	abort:'oh, no' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1738
	pattern:'rc*'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1739
	fromDirectory:'/etc'  
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1740
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1741
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1742
    "Modified: 23.10.1997 / 19:59:01 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1743
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1744
1030
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1745
requestFileName:titleString default:defaultName pattern:pattern
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1746
    "launch a Dialog, which allows user to enter a filename.
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1747
     The files presented initially are those from the current directory.
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1748
     The box will show ok/cancel in its buttons.
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1749
     The matchPattern is set to pattern initially.
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1750
     Return the string or nil if cancel was pressed."
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1751
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1752
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1753
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1754
	default:defaultName
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1755
	ok:(self classResources string:'ok') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1756
	abort:(self classResources string:'cancel') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1757
	pattern:pattern
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1758
	fromDirectory:nil
1030
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1759
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1760
    "
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1761
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1762
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1763
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1764
	pattern:'*.st'   
1030
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1765
    "
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1766
    "
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1767
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1768
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1769
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1770
	pattern:'*.st;*.h'   
1030
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1771
    "
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1772
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1773
    "Created: 21.2.1997 / 11:16:52 / cg"
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1774
    "Modified: 21.2.1997 / 11:18:40 / cg"
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1775
!
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1776
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1777
requestFileName:titleString default:defaultName version:versionSymbol
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1778
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1779
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1780
     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
  1781
     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
  1782
     it may be any of:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1783
	#mustBeNew      - fail (return empty string) if the file exists
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1784
	#new            - confirm if the file exists
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1785
	#mustBeOld      - fail if the file does not exist
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1786
	#old            - confirm if the file does not exist
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1787
	#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
  1788
    "
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1789
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1790
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1791
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1792
	default:defaultName 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1793
	version:versionSymbol 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1794
	ifFail:''
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1795
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1796
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1797
     Dialog requestFileName:'enter a fileName:'
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1798
			default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1799
			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
  1800
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1801
     Dialog requestFileName:'enter a fileName:'
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1802
			default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1803
			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
  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
     Dialog requestFileName:'enter a fileName:'
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1806
			default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1807
			version:#new   
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1808
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1809
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1810
    "Modified: 19.4.1996 / 13:53:58 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1811
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1812
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1813
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1814
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1815
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1816
     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
  1817
     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
  1818
     it may be any of:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1819
	#mustBeNew      - fail (return empty string) if the file exists
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1820
	#new            - confirm if the file exists
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1821
	#mustBeOld      - fail if the file does not exist
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1822
	#old            - confirm if the file does not exist
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1823
	#any (other)    - no validation
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1824
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1825
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1826
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1827
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1828
	default:defaultName 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1829
	version:versionSymbol 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1830
	ifFail:failBlock
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1831
	fromDirectory:nil
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1832
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1833
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1834
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1835
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1836
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1837
	version:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1838
	ifFail:['none']   
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1839
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1840
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1841
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1842
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1843
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1844
	version:#old 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1845
	ifFail:['none']   
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1846
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1847
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1848
    "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
  1849
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1850
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1851
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
  1852
    "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
  1853
     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
  1854
     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
  1855
     it may be any of:
1736
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1856
        #mustBeNew      - fail (return empty string) if the file exists
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1857
        #new            - confirm if the file exists
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1858
        #mustBeOld      - fail if the file does not exist
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1859
        #old            - confirm if the file does not exist
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1860
        #any (other)    - no validation
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1861
    "
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1862
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1863
    ^ self 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1864
        requestFileName:titleString 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1865
        default:defaultName 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1866
        version:versionSymbol 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1867
        ifFail:failBlock 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1868
        pattern:nil 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1869
        fromDirectory:aDirectoryPath
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1870
        
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1871
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1872
     Dialog 
1736
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1873
        requestFileName:'enter a fileName:'
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1874
        default:''
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1875
        version:nil
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1876
        ifFail:['none']
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1877
        fromDirectory:'/etc'
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1878
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1879
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1880
     Dialog 
1736
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1881
        requestFileName:'enter a fileName:'
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1882
        default:''
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1883
        version:#old 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1884
        ifFail:['none']   
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1885
        fromDirectory:'/etc'
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1886
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1887
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1888
     Dialog 
1736
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1889
        requestFileName:'enter a fileName:'
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1890
        default:''
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1891
        version:#mustBeNew 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1892
        ifFail:['none']   
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  1893
        fromDirectory:'/etc'
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1894
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1895
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1896
    "Modified: 20.2.1997 / 18:12:28 / cg"
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1897
    "Modified: 21.2.1997 / 14:27:27 / stefan"
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1898
!
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1899
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1900
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1901
    "launch a Dialog, which allows user to enter a filename.
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1902
     Return the string or the value of failBlock if cancel was pressed.
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1903
     The version argument allows validation of the files existance;
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1904
     it may be any of:
1575
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1905
        #mustBeNew      - fail (return empty string) if the file exists
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1906
        #new            - confirm if the file exists
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1907
        #mustBeOld      - fail if the file does not exist
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1908
        #old            - confirm if the file does not exist
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1909
        #any (other)    - no validation
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1910
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1911
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1912
    |box defaultDir defaultNm|
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1913
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1914
    defaultNm := defaultName.
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1915
    defaultDir := aDirectoryPath.
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1916
    defaultDir isNil ifTrue:[
1575
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1917
        defaultNm notNil ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1918
            defaultName asFilename withoutSuffix baseName = '*' ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1919
                defaultDir := FileSelectionBox lastFileSelectionDirectory.
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1920
                defaultNm := ''.
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1921
            ] ifFalse:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1922
                defaultDir := defaultName asFilename directoryName.
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1923
                defaultNm := defaultNm asFilename baseName.
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1924
            ]
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1925
        ].
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1926
    ].
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1927
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1928
    box := FileSelectionBox title:titleString.
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1929
    defaultDir notNil ifTrue:[box directory:defaultDir].
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1930
    pattern notNil ifTrue:[box pattern:pattern].
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1931
    box initialText:defaultNm.
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1932
    box action:[:name | 
1575
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1933
        versionSymbol == #mustBeNew ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1934
            "/ file may not exist
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1935
            name asFilename exists ifTrue:[^ ''].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1936
        ].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1937
        versionSymbol == #new ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1938
            "/ file may not exist
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1939
            name asFilename exists ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1940
                (self confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:box fileName) withCRs)
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1941
                ifFalse:[^ ''].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1942
            ].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1943
        ].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1944
        versionSymbol == #mustBeOld ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1945
            name asFilename exists ifFalse:[^ ''].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1946
        ].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1947
        versionSymbol == #old ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1948
            "/ file may not exist
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1949
            name asFilename exists ifFalse:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1950
                (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:box fileName) withCRs)
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1951
                ifFalse:[^ ''].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1952
            ].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1953
        ].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1954
        FileSelectionBox lastFileSelectionDirectory:box directory.
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1955
        box destroy. 
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1956
        ^ 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
  1957
    ].
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1958
    box showAtPointer.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1959
    box action:nil.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1960
    box destroy. 
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1961
    ^ failBlock value
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1962
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1963
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1964
     Dialog 
1575
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1965
        requestFileName:'enter a fileName:'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1966
        default:''
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1967
        version:nil
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1968
        ifFail:['none']
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1969
        pattern:'*.conf'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1970
        fromDirectory:'/etc'
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1971
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1972
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1973
     Dialog 
1575
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1974
        requestFileName:'enter a fileName:'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1975
        default:''
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1976
        version:#old 
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1977
        ifFail:['none']   
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1978
        pattern:'*.conf'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1979
        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
  1980
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1981
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1982
     Dialog 
1575
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1983
        requestFileName:'enter a fileName:'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1984
        default:''
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1985
        version:#mustBeNew 
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1986
        ifFail:['none']   
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1987
        pattern:'*.conf'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1988
        fromDirectory:'/etc'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1989
    "
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1990
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1991
    "Created: / 21.2.1997 / 14:23:44 / stefan"
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1992
    "Modified: / 21.2.1997 / 14:38:04 / stefan"
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1993
    "Modified: / 16.6.1998 / 13:34:23 / cg"
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1994
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1995
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1996
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
  1997
    "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
  1998
     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
  1999
     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
  2000
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  2001
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2002
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2003
	default:'file.ext'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2004
	version:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2005
	ifFail:cancelBlock
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  2006
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  2007
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  2008
     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
  2009
     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
  2010
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  2011
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  2012
    "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
  2013
    "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
  2014
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2015
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2016
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
  2017
    "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
  2018
     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
  2019
     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
  2020
     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
  2021
     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
  2022
     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
  2023
1736
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  2024
    ^ self 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  2025
        requestFileName:titleString 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  2026
        default:defaultName 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  2027
        version:#new 
51a7c4c90388 another requestFileName:
Claus Gittinger <cg@exept.de>
parents: 1708
diff changeset
  2028
        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
  2029
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2030
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2031
     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
  2032
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2033
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2034
    "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
  2035
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2036
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  2037
!DialogBox class methodsFor:'fill in the blank dialogs'!
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2038
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2039
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
  2040
    "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
  2041
     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
  2042
     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
  2043
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2044
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2045
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2046
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2047
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2048
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2049
	initialAnswer:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2050
	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
  2051
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2052
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2053
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2054
	 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
  2055
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2056
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2057
    "Modified: 29.5.1996 / 14:26:25 / 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
  2058
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2059
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2060
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
  2061
    "launch a Dialog, which allows user to enter a string.
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2062
     If aPoint is nonNil, the box is shown there, optionally centered around
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2063
     that point.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2064
     If it is nil, it is shown at the current pointer position or at the 
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2065
     screen center.
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2066
     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
  2067
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2068
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2069
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2070
	displayAt:aPoint 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2071
	centered:centered 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2072
	action:resultAction 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2073
	initialAnswer:initial
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2074
	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
  2075
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2076
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2077
     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
  2078
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2079
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2080
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2081
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2082
	    centered:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2083
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2084
	    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
  2085
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2086
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2087
     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
  2088
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2089
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2090
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2091
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2092
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2093
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2094
	    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
  2095
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2096
     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
  2097
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2098
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2099
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2100
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2101
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2102
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2103
	    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
  2104
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2105
     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
  2106
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2107
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2108
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2109
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2110
	    centered:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2111
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2112
	    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
  2113
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2114
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2115
    "Created: 7.12.1995 / 23:14:10 / cg"
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2116
    "Modified: 29.5.1996 / 14:19:36 / cg"
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2117
!
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2118
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2119
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel onCancel:cancelValue
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2120
    "launch a Dialog, which allows user to enter a string.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2121
     If aPoint is nonNil, the box is shown there, optionally centered around it.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2122
     If it is nil, it is shown at the current pointer position or at the 
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2123
     screen center (if centered is true).
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2124
     The ok-button is labelled okLabel (or the default, ifNil),
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2125
     the cancel-button is labelled cancelLabel (or the default, ifNil).
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2126
     Return the string or the value of cancelValue (if cancel was pressed)"
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2127
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2128
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2129
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2130
	displayAt:aPoint 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2131
	centered:centered 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2132
	action:resultAction 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2133
	initialAnswer:initial 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2134
	okLabel:okLabel 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2135
	cancelLabel:cancelLabel 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2136
	title:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2137
	onCancel:cancelValue
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2138
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2139
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2140
     at topLeft (centering is suppressed, to make the box fully visible)    
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2141
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2142
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2143
	    displayAt:0@0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2144
	    centered:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2145
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2146
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2147
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2148
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2149
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2150
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2151
     centered around 200@200:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2152
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2153
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2154
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2155
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2156
	    centered:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2157
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2158
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2159
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2160
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2161
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2162
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2163
     topLeft of box at 200@200:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2164
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2165
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2166
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2167
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2168
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2169
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2170
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2171
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2172
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2173
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2174
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2175
     under mouse pointer:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2176
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2177
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2178
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2179
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2180
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2181
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2182
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2183
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2184
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2185
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2186
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2187
     centered on the screen:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2188
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2189
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2190
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2191
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2192
	    centered:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2193
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2194
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2195
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2196
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2197
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2198
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2199
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2200
    "Created: 7.12.1995 / 23:14:10 / cg"
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2201
    "Modified: 29.5.1996 / 14:35:45 / cg"
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2202
!
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2203
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2204
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString onCancel:cancelValue
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2205
    "launch a Dialog, which allows user to enter a string.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2206
     The dialogs window is titled titleString, or the default (if nil).
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2207
     If aPoint is nonNil, the box is shown there, optionally centered around it.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2208
     If it is nil, it is shown at the current pointer position or at the 
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2209
     screen center (if centered is true).
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2210
     The ok-button is labelled okLabel (or the default, ifNil),
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2211
     the cancel-button is labelled cancelLabel (or the default, ifNil).
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2212
     Return the string or the value of cancelValue (if cancel was pressed)"
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2213
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2214
    ^ self
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2215
        request:aString 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2216
        displayAt:aPoint 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2217
        centered:centered 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2218
        action:resultAction 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2219
        initialAnswer:initial 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2220
        okLabel:okLabel 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2221
        cancelLabel:cancelLabel 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2222
        title:titleString 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2223
        onCancel:cancelValue 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2224
        list:nil
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2225
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2226
!
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2227
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2228
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString onCancel:cancelValue list:listToSelectFrom
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2229
    "launch a Dialog, which allows user to enter a string.
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2230
     The dialogs window is titled titleString, or the default (if nil).
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2231
     If aPoint is nonNil, the box is shown there, optionally centered around it.
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2232
     If it is nil, it is shown at the current pointer position or at the 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2233
     screen center (if centered is true).
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2234
     The ok-button is labelled okLabel (or the default, ifNil),
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2235
     the cancel-button is labelled cancelLabel (or the default, ifNil).
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2236
     Return the string or the value of cancelValue (if cancel was pressed)"
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2237
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2238
    |box|
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2239
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2240
    listToSelectFrom isNil ifTrue:[
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2241
        box := EnterBox title:aString.
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2242
    ] ifFalse:[
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2243
        box := EnterBoxWithList title:aString.
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2244
        box list:listToSelectFrom.
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2245
    ].
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2246
    box initialText:initial printString.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2247
    box abortAction:[:val | box destroy. ^ cancelValue value].
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2248
    okLabel notNil ifTrue:[
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2249
        box okText:okLabel.
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2250
    ].
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2251
    cancelLabel notNil ifTrue:[
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2252
        box abortText:cancelLabel 
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2253
    ].
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2254
    resultAction isNil ifTrue:[
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2255
        box action:[:val | box destroy. ^ val]
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2256
    ] ifFalse:[
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2257
        box action:[:val | box destroy. ^ resultAction value:val]
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2258
    ].
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2259
    titleString notNil ifTrue:[
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2260
        box label:titleString
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2261
    ].
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2262
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2263
    aPoint notNil ifTrue:[
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2264
        box showAt:aPoint center:centered
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2265
    ] ifFalse:[
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2266
        centered ifTrue:[
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2267
            box showAtCenter
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2268
        ] ifFalse:[
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2269
            box showAtPointer
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2270
        ]
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2271
    ].
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2272
    box destroy. 
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2273
    ^ cancelValue value.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2274
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2275
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2276
     centered around 200@200:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2277
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2278
         Dialog 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2279
            request:'enter a string:'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2280
            displayAt:200@200
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2281
            centered:true
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2282
            action:[:result | result printNewline]
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2283
            initialAnswer:'the default'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2284
            okLabel:'yes'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2285
            cancelLabel:'no'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2286
            title:'foo'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2287
            onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2288
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2289
     under mouse pointer:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2290
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2291
         Dialog 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2292
            request:'enter a string:'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2293
            displayAt:nil
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2294
            centered:false 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2295
            action:[:result | result printNewline]
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2296
            initialAnswer:'the default'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2297
            okLabel:'yes'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2298
            cancelLabel:'no'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2299
            title:'foo'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2300
            onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2301
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2302
     centered on the screen:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2303
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2304
         Dialog 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2305
            request:'enter a string:'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2306
            displayAt:nil
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2307
            centered:true 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2308
            action:[:result | result printNewline]
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2309
            initialAnswer:'the default'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2310
            okLabel:'yes'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2311
            cancelLabel:'no'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2312
            title:'foo'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2313
            onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2314
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2315
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2316
    "Created: 29.5.1996 / 14:35:04 / cg"
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2317
    "Modified: 29.5.1996 / 15:26:34 / 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
  2318
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2319
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2320
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
  2321
    "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
  2322
     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
  2323
     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
  2324
     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
  2325
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2326
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2327
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2328
	displayAt:aPoint 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2329
	centered:centered 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2330
	action:resultAction 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2331
	initialAnswer:initial 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2332
	okLabel:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2333
	cancelLabel:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2334
	onCancel:cancelValue
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2335
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  2336
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2337
     at topLeft (centering is suppressed, to make the box fully visible)    
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2338
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2339
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2340
	    displayAt:0@0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2341
	    centered:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2342
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2343
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2344
	    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
  2345
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2346
     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
  2347
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2348
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2349
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2350
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2351
	    centered:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2352
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2353
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2354
	    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
  2355
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2356
     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
  2357
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2358
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2359
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2360
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2361
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2362
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2363
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2364
	    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
  2365
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2366
     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
  2367
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2368
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2369
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2370
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2371
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2372
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2373
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2374
	    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
  2375
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2376
     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
  2377
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2378
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2379
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2380
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2381
	    centered:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2382
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2383
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2384
	    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
  2385
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2386
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2387
    "Created: 7.12.1995 / 23:14:10 / cg"
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2388
    "Modified: 29.5.1996 / 14:24:39 / 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
  2389
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2390
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2391
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
  2392
    "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
  2393
     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
  2394
     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
  2395
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2396
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2397
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2398
	displayAt:aPoint 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2399
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2400
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2401
	initialAnswer:initial
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2402
	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
  2403
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2404
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2405
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2406
	 request:'enter a string:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2407
	 displayAt:(250 @ 250) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2408
	 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
  2409
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2410
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2411
    "Modified: 29.5.1996 / 14:29:51 / 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
  2412
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2413
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2414
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
  2415
    "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
  2416
     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
  2417
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2418
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2419
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2420
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2421
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2422
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2423
	initialAnswer:initial
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2424
	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
  2425
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2426
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2427
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2428
	 request:'enter a string:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2429
	 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
  2430
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2431
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2432
    "Modified: 29.5.1996 / 14:30: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
  2433
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2434
718
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2435
request:aString initialAnswer:initial okLabel:okLabel title:titleString onCancel:cancelAction
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2436
    "launch a Dialog, which allows user to enter something.
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2437
     Return the entered string (may be empty string) 
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2438
     or cancelValue (if cancel was pressed)"
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2439
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2440
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2441
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2442
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2443
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2444
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2445
	initialAnswer:initial
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2446
	okLabel:okLabel
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2447
	cancelLabel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2448
	title:titleString
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2449
	onCancel:cancelAction
718
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2450
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2451
    "
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2452
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2453
	 request:'enter a string:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2454
	 initialAnswer:'the default'  
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2455
	 onCancel:['foooo']      
718
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2456
    "
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2457
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2458
    "Modified: 29.5.1996 / 14:28:24 / cg"
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2459
    "Created: 29.5.1996 / 14:59:57 / cg"
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2460
!
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2461
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2462
request:aString initialAnswer:initial okLabel:okLabel title:titleString onCancel:cancelAction list:listOfChoices
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2463
    "launch a Dialog, which allows user to enter something.
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2464
     Return the entered string (may be empty string) 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2465
     or cancelValue (if cancel was pressed)"
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2466
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2467
    ^ self 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2468
        request:aString 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2469
        displayAt:nil 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2470
        centered:false 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2471
        action:nil 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2472
        initialAnswer:initial
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2473
        okLabel:okLabel
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2474
        cancelLabel:nil
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2475
        title:titleString
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2476
        onCancel:cancelAction
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2477
        list:listOfChoices
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2478
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2479
    "
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2480
     Dialog 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2481
         request:'enter a string:' 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2482
         initialAnswer:'the default'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2483
         okLabel:'ok'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2484
         title:'demo'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2485
         onCancel:nil
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2486
         list:#('foo' 'bar' 'baz')
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2487
    "
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2488
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2489
    "Modified: 29.5.1996 / 14:28:24 / cg"
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2490
    "Created: 29.5.1996 / 14:59:57 / cg"
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2491
!
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2492
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2493
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
  2494
    "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
  2495
     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
  2496
     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
  2497
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2498
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2499
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2500
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2501
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2502
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2503
	initialAnswer:initial
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2504
	onCancel:cancelAction
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2505
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2506
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2507
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2508
	 request:'enter a string:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2509
	 initialAnswer:'the default'  
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2510
	 onCancel:['foooo']      
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2511
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2512
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2513
    "Modified: 29.5.1996 / 14:28:24 / cg"
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2514
!
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2515
1705
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2516
request:aString list:listOfChoices
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2517
    "launch a Dialog, which allows user to enter something,
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2518
     but adds a list of choices for fast input.
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2519
     Return the entered string (may be empty string) 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2520
     or the empty string (if cancel was pressed)"
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2521
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2522
    ^ self 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2523
        request:aString 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2524
        displayAt:nil 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2525
        centered:false 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2526
        action:nil 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2527
        initialAnswer:'' 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2528
        okLabel:nil 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2529
        cancelLabel:nil 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2530
        title:nil 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2531
        onCancel:nil 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2532
        list:listOfChoices
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2533
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2534
    "
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2535
     Dialog 
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2536
         request:'enter a string:'
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2537
         list:#('foo' 'bar' 'baz')
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2538
    "
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2539
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2540
    "Modified: 29.5.1996 / 14:26:25 / cg"
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2541
!
1a126505ac49 added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
  2542
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2543
request:aString okLabel:okLabel
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2544
    "launch a Dialog, which allows user to enter something.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2545
     The okButton is labelled as okLabel.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2546
     Return the entered string (may be empty string) 
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2547
     or the empty string (if cancel was pressed)"
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2548
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2549
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2550
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2551
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2552
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2553
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2554
	initialAnswer:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2555
	okLabel:okLabel
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2556
	cancelLabel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2557
	onCancel:''
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2558
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2559
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2560
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2561
	request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2562
	okLabel:'yes'
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2563
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2564
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2565
    "Modified: 29.5.1996 / 14:26:25 / cg"
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2566
    "Created: 29.5.1996 / 14:31:10 / cg"
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2567
!
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2568
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2569
request:aString okLabel:okLabel onCancel:cancelValue
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2570
    "launch a Dialog, which allows user to enter something.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2571
     The okButton is labelled as okLabel.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2572
     Return the entered string (may be empty string) 
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2573
     or the value from evaluating cancelValue (if cancel was pressed)"
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2574
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2575
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2576
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2577
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2578
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2579
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2580
	initialAnswer:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2581
	okLabel:okLabel
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2582
	cancelLabel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2583
	onCancel:cancelValue
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2584
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2585
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2586
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2587
	request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2588
	okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2589
	onCancel:nil    
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2590
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2591
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2592
    "Modified: 29.5.1996 / 14:32:00 / 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
  2593
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2594
718
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2595
request:aString okLabel:okLabel title:titleString onCancel:cancelValue
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2596
    "launch a Dialog, which allows user to enter something.
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2597
     The okButton is labelled as okLabel.
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2598
     Return the entered string (may be empty string) 
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2599
     or the value from evaluating cancelValue (if cancel was pressed)"
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2600
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2601
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2602
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2603
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2604
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2605
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2606
	initialAnswer:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2607
	okLabel:okLabel
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2608
	cancelLabel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2609
	title:titleString
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2610
	onCancel:cancelValue
718
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2611
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2612
    "
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2613
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2614
	request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2615
	okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2616
	title:'foo'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2617
	onCancel:nil    
718
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2618
    "
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2619
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2620
    "Modified: 29.5.1996 / 14:32:00 / cg"
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2621
    "Created: 29.5.1996 / 14:57:02 / cg"
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2622
!
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2623
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2624
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
  2625
    "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
  2626
     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
  2627
     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
  2628
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2629
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2630
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2631
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2632
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2633
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2634
	initialAnswer:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2635
	onCancel:cancelAction
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2636
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2637
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2638
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2639
	 request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2640
	 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
  2641
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2642
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2643
    "Created: 27.1.1996 / 14:31:45 / cg"
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2644
    "Modified: 29.5.1996 / 14:28:59 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  2645
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  2646
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2647
requestPassword:aString 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2648
    "launch a Dialog, which allows user to enter something invisibly.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2649
     Return the entered string (may be empty string) 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2650
     or nil (if cancel was pressed)"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  2651
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2652
    ^ EnterBox requestPassword:aString 
133
claus
parents: 132
diff changeset
  2653
claus
parents: 132
diff changeset
  2654
    "
claus
parents: 132
diff changeset
  2655
     Dialog 
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2656
	 requestPassword:'enter secret:'
133
claus
parents: 132
diff changeset
  2657
    "
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2658
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2659
    "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
  2660
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2661
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  2662
!DialogBox class methodsFor:'multiple choice dialogs'!
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2663
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2664
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
  2665
    "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
  2666
     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
  2667
     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
  2668
     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
  2669
     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
  2670
     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
  2671
     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
  2672
     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
  2673
1284
8c3f71ee81bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  2674
    |box listView panel answer|
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2675
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2676
    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
  2677
    (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
  2678
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2679
    list notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2680
	maxLines > list size ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2681
	    listView := ScrollableView for:SelectionInListView.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2682
	] ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2683
	    listView := SelectionInListView new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2684
	    listView level:-1.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2685
	].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2686
	listView list:list.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2687
	listView doubleClickAction:[:line | box hide. ^ listValues at:line].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2688
	box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2689
	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
  2690
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2691
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2692
    buttonLabels notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2693
	panel := HorizontalPanelView new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2694
	panel horizontalLayout:#fitSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2695
	buttonLabels keysAndValuesDo:[:index :label |
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2696
	    |b|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2697
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2698
	    b := Button label:label.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2699
	    b action:[box hide. ^ buttonValues at:index].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2700
	    panel add:b.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2701
	    box makeTabable:b.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2702
	].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2703
	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
  2704
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2705
    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
  2706
    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
  2707
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2708
    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
  2709
    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
  2710
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2711
    box showAtPointer.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2712
    box destroy. 
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2713
    box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2714
	(answer := listView selection) notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2715
	    ^ listValues at:answer
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2716
	]
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2717
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2718
    ^ cancelBlock value
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2719
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2720
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2721
     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
  2722
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2723
	 Transcript showCR:(
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2724
	     Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2725
		choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2726
		fromList:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2727
		values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2728
		buttons:#('five' 'six' 'seven')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2729
		values:#(5 6 7)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2730
		lines:10 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2731
		cancel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2732
	 )
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2733
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2734
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2735
     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
  2736
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2737
	 Transcript showCR:(
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2738
	     Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2739
		choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2740
		fromList:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2741
		values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2742
		buttons:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2743
		values:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2744
		lines:4
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2745
		cancel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2746
	 )
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2747
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2748
558
907a0365d06a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 557
diff changeset
  2749
     no list (lines argument is ignored):
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2750
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2751
	 Transcript showCR:(
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2752
	     Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2753
		choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2754
		fromList:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2755
		values:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2756
		buttons:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2757
		values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2758
		lines:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2759
		cancel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2760
	 )
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2761
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2762
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2763
      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
  2764
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2765
	 Transcript showCR:(
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2766
	     Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2767
		choose:'choose example' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2768
		fromList:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2769
		values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2770
		buttons:#('five' 'six' 'seven')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2771
		values:#(5 6 7)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2772
		lines:4
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2773
		cancel:[Transcript flash. #aborted]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2774
	 )
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2775
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2776
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2777
     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
  2778
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2779
	 Transcript showCR:(
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2780
	     Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2781
		choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2782
		fromList:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2783
		values:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2784
		buttons:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2785
		values:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2786
		lines:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2787
		cancel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2788
	 )
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2789
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2790
133
claus
parents: 132
diff changeset
  2791
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2792
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2793
    "Modified: 29.5.1996 / 15:27:22 / 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
  2794
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2795
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2796
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
  2797
    "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
  2798
     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
  2799
     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
  2800
     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
  2801
     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
  2802
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2803
    ^ self
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2804
	choose:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2805
	fromList:list 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2806
	values:listValues
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2807
	buttons:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2808
	values:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2809
	lines:maxLines
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2810
	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
  2811
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2812
    "
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2813
     Transcript showCR:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2814
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2815
	    choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2816
	    fromList:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2817
	    values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2818
	    lines:4
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2819
	    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
  2820
     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2821
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2822
     Transcript showCR:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2823
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2824
	    choose:'choose example' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2825
	    fromList:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2826
	    values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2827
	    lines:4
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2828
	    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
  2829
     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2830
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2831
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2832
    "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
  2833
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2834
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2835
choose:aString label:windowLabel labels:buttonLabels values:values default: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
  2836
    "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
  2837
     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
  2838
     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
  2839
     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
  2840
     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
  2841
     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
  2842
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2843
    |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
  2844
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2845
    box := OptionBox title:aString numberOfOptions:buttonLabels size. 
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2846
    windowLabel notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2847
	box label:windowLabel
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2848
    ].
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2849
    box buttonTitles:(self classResources array:buttonLabels)
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2850
	     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
  2851
    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
  2852
    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
  2853
    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
  2854
    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
  2855
    box showAtPointer.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2856
    box destroy. 
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2857
    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
  2858
    ^ 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
  2859
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2860
    "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
  2861
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2862
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2863
	choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2864
	labels:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2865
	values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2866
	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
  2867
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2868
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2869
	choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2870
	labels:#('cancel' 'foo' 'bar' 'baz') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2871
	values:#(nil foo bar baz) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2872
	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
  2873
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2874
      Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2875
	choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2876
	labels:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2877
	values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2878
	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
  2879
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2880
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2881
    "Modified: 29.5.1996 / 15:27:32 / cg"
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2882
    "Created: 22.7.1996 / 11:44:27 / cg"
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2883
!
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2884
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2885
choose:aString labels:buttonLabels values:values default:default
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2886
    "launch a Dialog, which allows user to enter any of buttonLabels.
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2887
     Returning a corresponding value from the values-array.
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2888
     The default entries button is marked as a return button and entering
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2889
     return will choose that value.
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2890
     For a good userInterface style, we recommend this being the last
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2891
     entry (to make the right-most button the default button)."
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2892
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2893
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2894
	choose:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2895
	label:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2896
	labels:buttonLabels 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2897
	values:values 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2898
	default:default
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2899
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2900
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2901
    "no good style (default button is not the rightmost one)
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2902
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2903
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2904
	choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2905
	labels:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2906
	values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2907
	default:2 
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2908
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2909
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2910
	choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2911
	labels:#('cancel' 'foo' 'bar' 'baz') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2912
	values:#(nil foo bar baz) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2913
	default:#baz     
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2914
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2915
      Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2916
	choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2917
	labels:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2918
	values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2919
	default:nil 
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2920
    "
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2921
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2922
    "Modified: 22.7.1996 / 11:46:09 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  2923
! !
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  2924
1573
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2925
!DialogBox class methodsFor:'queries'!
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2926
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2927
defaultParentWindow
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2928
    "return a default parent (top-) window for the dialog.
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2929
     Here, the currently active view is returned, if there
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2930
     is one; otherwise, the first encountered topView is
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2931
     returned."
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2932
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2933
    |activeGroup|
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2934
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2935
    activeGroup := WindowGroup activeGroup.
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2936
    activeGroup isNil ifTrue:[
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2937
        "/ mhmh - looks like I am a background process ...
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2938
        activeGroup := Transcript windowGroup.
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2939
        activeGroup isNil ifTrue:[^ nil].
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2940
    ].
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2941
    ^ activeGroup topViews first.
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2942
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2943
    "
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2944
     self defaultParentWindow
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2945
    "
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2946
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2947
    "Modified: / 16.6.1998 / 12:36:15 / cg"
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2948
! !
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2949
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2950
!DialogBox methodsFor:'accessing-behavior'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2951
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2952
abortAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2953
    "define the action to be performed when abort is pressed"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2954
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2955
    abortAction := aBlock
125
claus
parents: 122
diff changeset
  2956
!
claus
parents: 122
diff changeset
  2957
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2958
acceptCheck:aBlock
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2959
    "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
  2960
     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
  2961
     otherwise not."
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2962
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2963
    acceptCheck := aBlock
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2964
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2965
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2966
acceptOnLeave:aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2967
    "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
  2968
     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
  2969
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2970
    acceptOnLeave := aBoolean.
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  2971
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  2972
    "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
  2973
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2974
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2975
acceptReturnAsOK:aBoolean
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2976
    "turn on/off interpretation of return-key as ok.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2977
     Default is on"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2978
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2979
    acceptReturnAsOK := aBoolean.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2980
    okButton notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2981
	okButton isReturnButton:aBoolean.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2982
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2983
!
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
action:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2986
    "set the action to be performed when user presses ok-button;
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2987
     aBlock must be nil or a block. This method simply
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2988
     reuses okAction: and has been added for a consistent action-setting
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2989
     protocol."
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2990
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2991
    self okAction:aBlock
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
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2994
focusOnField:anInputField
1646
ecad055bb871 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  2995
    "arrange for the argument to get the focus (initially)"
ecad055bb871 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  2996
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2997
    inputFieldGroup makeActive:anInputField
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2998
1646
ecad055bb871 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  2999
    "Modified: / 13.8.1998 / 21:23:17 / cg"
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3000
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3001
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3002
focusToOKOnLeave:aBoolean
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3003
    "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
  3004
     or cursor key.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3005
     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
  3006
     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
  3007
     the dialog is accepted & closed."
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3008
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3009
    focusToOKOnLeave := aBoolean.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3010
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3011
    "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
  3012
    "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
  3013
!
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  3014
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3015
hideOnAccept:aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3016
    "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
  3017
     The default is true"
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3018
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3019
    hideOnAccept := aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3020
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3021
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3022
makeTabable:aComponentOrSubcomponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3023
    "add a component (usually a subcomponent, of which the dialog
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3024
     does not know) to the list of tabable ones (i.e. those, that can be
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3025
     stepped through via FocusNext/FocusPrevious).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3026
     Toplevel tabable components are usually added with #addComponent:tabable:"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3027
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3028
    tabableElements isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3029
	tabableElements := OrderedCollection new
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3030
    ].
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3031
    (tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3032
	tabableElements add:aComponentOrSubcomponent.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3033
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3034
	(aComponentOrSubcomponent isInputField) ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3035
	    self addToInputFieldGroup:aComponentOrSubcomponent
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3036
	].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3037
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3038
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3039
    "Modified: 31.5.1996 / 21:22:13 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3040
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3041
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3042
makeTabable:aComponentOrSubcomponent after:anotherComponent
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3043
    "add a component (usually a subcomponent, of which the dialog
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3044
     does not know) to the list of tabable ones (i.e. those, that can be
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3045
     stepped through via FocusNext/FocusPrevious).
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3046
     Toplevel tabable components are usually added with #addComponent:tabable:"
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3047
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3048
    tabableElements isNil ifTrue:[
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3049
        tabableElements := OrderedCollection new
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3050
    ].
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3051
    tabableElements removeIdentical:aComponentOrSubcomponent ifAbsent:nil.
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3052
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3053
    anotherComponent isNil ifTrue:[
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3054
        tabableElements addLast:aComponentOrSubcomponent
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3055
    ] ifFalse:[
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3056
        tabableElements add:aComponentOrSubcomponent after:anotherComponent.
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3057
    ].
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3058
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3059
    (aComponentOrSubcomponent isInputField) ifTrue:[
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3060
        self addToInputFieldGroup:aComponentOrSubcomponent after:anotherComponent
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3061
    ].
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3062
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3063
    "Modified: 18.10.1997 / 03:08:20 / cg"
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3064
!
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3065
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3066
makeTabable:aComponentOrSubcomponent before:anotherComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3067
    "add a component (usually a subcomponent, of which the dialog
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3068
     does not know) to the list of tabable ones (i.e. those, that can be
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3069
     stepped through via FocusNext/FocusPrevious).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3070
     Toplevel tabable components are usually added with #addComponent:tabable:"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3071
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3072
    tabableElements isNil ifTrue:[
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3073
        tabableElements := OrderedCollection new
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3074
    ].
989
ca2cdf005359 use #removeIdentical: - its faster.
Claus Gittinger <cg@exept.de>
parents: 953
diff changeset
  3075
    tabableElements removeIdentical:aComponentOrSubcomponent ifAbsent:nil.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3076
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3077
    anotherComponent isNil ifTrue:[
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3078
        tabableElements addFirst:aComponentOrSubcomponent
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3079
    ] ifFalse:[
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3080
        tabableElements add:aComponentOrSubcomponent before:anotherComponent.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3081
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3082
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3083
    (aComponentOrSubcomponent isInputField) ifTrue:[
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3084
        self addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3085
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3086
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3087
    "Modified: 18.10.1997 / 03:08:20 / cg"
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3088
!
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3089
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3090
makeUntabable:aComponentOrSubcomponent
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3091
    (tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3092
	tabableElements removeIdentical:aComponentOrSubcomponent.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3093
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3094
	(aComponentOrSubcomponent isInputField) ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3095
	    self removeFromInputFieldGroup:aComponentOrSubcomponent
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3096
	].
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3097
    ].
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3098
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3099
    "Modified: 18.10.1997 / 02:50:05 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3100
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3101
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3102
okAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3103
    "define the action to be performed when ok is pressed"
133
claus
parents: 132
diff changeset
  3104
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3105
    okAction := aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3106
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3107
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3108
!DialogBox methodsFor:'accessing-components'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3109
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3110
abortButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3111
    "return the abortButton - this access is provided to allow
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3112
     setting the buttons look (for example: colors or font)"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3113
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3114
    ^ abortButton
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3115
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3116
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3117
okButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3118
    "return the okButton - this access is provided to allow
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3119
     setting the buttons look (for example: colors or font)"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3120
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3121
    ^ okButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3122
! !
155
claus
parents: 146
diff changeset
  3123
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3124
!DialogBox methodsFor:'accessing-elements'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3125
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3126
componentAt:name
680
b3ed48cfdfd4 commentary
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  3127
    "retrieve a component by name - to access it, it must have been
950
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3128
     named previously with #name:as:"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3129
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3130
    namedComponents isNil ifTrue:[^ nil].
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3131
    ^ namedComponents at:name ifAbsent:nil
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3132
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3133
    "Modified: 16.1.1997 / 11:40:50 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3134
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3135
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3136
inputFieldGroup
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3137
    ^ inputFieldGroup
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3138
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3139
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3140
name:element as:name
680
b3ed48cfdfd4 commentary
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  3141
    "assign a name to a component. This can be done during construction,
b3ed48cfdfd4 commentary
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  3142
     to allow later access to the components (i.e. without a need to
b3ed48cfdfd4 commentary
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  3143
     remember them in some instVars)"
b3ed48cfdfd4 commentary
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  3144
950
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3145
    namedComponents isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3146
	namedComponents := Dictionary new.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3147
    ].
950
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3148
    namedComponents at:name put:element
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3149
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3150
    "Modified: 16.1.1997 / 11:41:03 / cg"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3151
! !
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3152
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3153
!DialogBox methodsFor:'accessing-look'!
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3154
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3155
abortText:aString
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3156
    "define the label in the abort-button"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3157
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3158
    |oldSize|
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3159
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3160
    aString ~= abortButton label ifTrue:[
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3161
	oldSize := abortButton extent.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3162
	abortButton label:aString.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3163
	abortButton resize.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3164
	abortButton extent ~= oldSize ifTrue:[
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3165
	    shown ifTrue:[self resize]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3166
	]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3167
    ]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3168
!
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3169
1702
a48531c35dd5 added #hideButtons utility.
Claus Gittinger <cg@exept.de>
parents: 1646
diff changeset
  3170
hideButtons
a48531c35dd5 added #hideButtons utility.
Claus Gittinger <cg@exept.de>
parents: 1646
diff changeset
  3171
    "hides the buttonPanel (i.e. the ok and cancel buttons if any)"
a48531c35dd5 added #hideButtons utility.
Claus Gittinger <cg@exept.de>
parents: 1646
diff changeset
  3172
a48531c35dd5 added #hideButtons utility.
Claus Gittinger <cg@exept.de>
parents: 1646
diff changeset
  3173
    buttonPanel notNil ifTrue:[buttonPanel beInvisible]
a48531c35dd5 added #hideButtons utility.
Claus Gittinger <cg@exept.de>
parents: 1646
diff changeset
  3174
!
a48531c35dd5 added #hideButtons utility.
Claus Gittinger <cg@exept.de>
parents: 1646
diff changeset
  3175
950
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3176
okText:aString
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3177
    "define the text in the ok-button"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3178
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3179
    |oldSize|
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3180
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3181
    aString ~= okButton label ifTrue:[
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3182
	oldSize := okButton extent.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3183
	okButton label:aString.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3184
	okButton resize.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3185
	okButton extent ~= oldSize ifTrue:[
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3186
	    shown ifTrue:[self resize]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3187
	]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3188
    ]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3189
!
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3190
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3191
okText:okString abortText:abortString
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3192
    "set both texts displayed in the buttons"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3193
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3194
    (abortString ~= abortButton label 
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3195
    or:[okString ~= okButton label]) ifTrue:[
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3196
	okButton label:okString.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3197
	abortButton label:abortString.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3198
	okButton resize.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3199
	abortButton resize.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3200
	shown ifTrue:[self resize]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3201
    ]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3202
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3203
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3204
!DialogBox methodsFor:'accessing-models'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3205
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3206
accept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3207
    "return the valueHolder holding true when the box
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3208
     is accepted, false if closed via the windowManager or
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3209
     the cancel button.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3210
     This is confusing: this method was originally called #acceptValue,
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3211
     but renamed for compatibility with ST-80.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3212
     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
  3213
     is used to force an accept, not to return some valueHolder ...)."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3214
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3215
    ^ acceptValue
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3216
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3217
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3218
acceptChannel:aValueHolder
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3219
    "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
  3220
     is accepted"
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3221
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  3222
    acceptValue := aValueHolder
950
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3223
!
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3224
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3225
aspectAt:anAspectSymbol put:aDataModel
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3226
    "return the dataModel for some aspect, nil if no such dataModel was defined;
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3227
     requires that a corresponding dataModel has been set (usually during
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3228
     initialization) via the #aspectAt:put: message.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3229
     Allows users of boxes to access individual values - especially useful,
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3230
     in multi-field dialogs."
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3231
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3232
    bindings isNil ifTrue:[bindings := IdentityDictionary new].
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3233
    bindings at:anAspectSymbol put:aDataModel
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3234
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3235
    "Created: 16.1.1997 / 11:38:46 / cg"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3236
    "Modified: 16.1.1997 / 11:41:28 / cg"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3237
!
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3238
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3239
aspectFor:anAspectSymbol
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3240
    "return the dataModel for some aspect, nil if no such dataModel was defined;
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3241
     requires that a corresponding dataModel has been set (usually during
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3242
     initialization) via the #aspectAt:put: message.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3243
     Allows users of boxes to access individual values - especially useful,
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3244
     in multi-field dialogs."
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3245
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3246
    bindings isNil ifTrue:[^ nil].
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3247
    ^ bindings at:anAspectSymbol ifAbsent:nil
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3248
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3249
    "Modified: 16.1.1997 / 11:41:34 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3250
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3251
120
claus
parents: 118
diff changeset
  3252
!DialogBox methodsFor:'construction-adding'!
claus
parents: 118
diff changeset
  3253
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3254
addComponent:aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3255
    "add any component with its preferred height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3256
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3257
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3258
    ^ self addComponent:aComponent indent:nil tabable:false
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3259
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3260
    "Modified: 9.2.1996 / 22:22:41 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3261
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3262
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3263
addComponent:aComponent indent:indent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3264
    "add any component with its preferred height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3265
     The indent is temporarily changed to indent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3266
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3267
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3268
    ^ self addComponent:aComponent indent:indent tabable:false
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3269
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3270
    "Modified: 9.2.1996 / 22:22:44 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3271
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3272
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3273
addComponent:aComponent indent:indent tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3274
    "add any component with its preferred height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3275
     The indent is temporarily changed to indent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3276
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3277
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3278
    |oldLeft oldRight result|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3279
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3280
    oldLeft := leftIndent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3281
    oldRight := rightIndent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3282
    indent notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3283
	leftIndent := rightIndent := indent.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3284
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3285
    result := self addComponent:aComponent tabable:tabable tabbedComponent:aComponent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3286
    leftIndent := oldLeft.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3287
    rightIndent := oldRight.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3288
    ^ result
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3289
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3290
    "Modified: 9.2.1996 / 22:22:50 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3291
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3292
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3293
addComponent:aComponent indent:indent withExtent:ext 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3294
    "add any component with some given extent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3295
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3296
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3297
    |fullSize lI rI|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3298
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3299
    indent isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3300
	lI := leftIndent.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3301
	rI := rightIndent.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3302
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3303
	lI := rI := indent
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3304
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3305
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3306
    self basicAddComponent:aComponent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3307
    fullSize := ext + (lI + rI @ 0).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3308
    aComponent extent:fullSize.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3309
    aComponent origin:0.0@yPosition; 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3310
	       leftInset:lI; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3311
	       rightInset:rI.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3312
    yPosition := yPosition + aComponent height + ViewSpacing.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3313
    width := fullSize x max:width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3314
    needResize := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3315
    ^ aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3316
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3317
    "Modified: 9.2.1996 / 22:22:54 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3318
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3319
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3320
addComponent:aComponent indent:indent withHeight:height 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3321
    "add any component with some given height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3322
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3323
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3324
    |lI rI|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3325
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3326
    indent isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3327
	lI := leftIndent.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3328
	rI := rightIndent.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3329
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3330
	lI := rI := indent
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3331
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3332
    self basicAddComponent:aComponent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3333
    aComponent height:height.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3334
    aComponent origin:0.0@yPosition; 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3335
	       width:1.0; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3336
	       leftInset:lI;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3337
	       rightInset:rI.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3338
    yPosition := yPosition + "aComponent" height + ViewSpacing.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3339
    needResize := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3340
    ^ aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3341
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3342
    "Modified: 9.2.1996 / 22:22:58 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3343
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3344
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3345
addComponent:aComponent tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3346
    "add any component with its preferred height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3347
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3348
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3349
    ^ self addComponent:aComponent tabable:tabable tabbedComponent:aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3350
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3351
    "Modified: 9.2.1996 / 22:23:04 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3352
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3353
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3354
addComponent:aComponent tabable:tabable tabbedComponent:subComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3355
    "add any component with its preferred height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3356
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3357
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3358
    tabable ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3359
	tabableElements isNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3360
	    tabableElements := OrderedCollection new
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3361
	].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3362
	tabableElements add:subComponent
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3363
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3364
    ^ self addComponent:aComponent 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3365
	   withHeight:(aComponent preferredExtent y).
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3366
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3367
    "Modified: 9.2.1996 / 22:23:07 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3368
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3369
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3370
addComponent:aComponent withExtent:ext 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3371
    "add any component with some given extent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3372
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3373
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3374
    ^ self addComponent:aComponent indent:nil withExtent:ext
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3375
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3376
    "Modified: 9.2.1996 / 22:23:11 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3377
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3378
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3379
addComponent:aComponent withHeight:height 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3380
    "add any component with some given height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3381
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3382
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3383
    ^ self addComponent:aComponent indent:nil withHeight:height
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3384
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3385
    "Modified: 9.2.1996 / 22:23:15 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3386
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3387
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3388
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable from:leftX to:rightX separateAtX:relativeX
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3389
    "add a label and some view side-by-side.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3390
     The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3391
     The labels string is defined by labelString and adjusted according to labelAdjust.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3392
     The inputField gets model as its model.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3393
     Return the inputField."
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3394
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3395
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3396
	addLabelledField:aView 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3397
	label:labelString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3398
	adjust:labelAdjust 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3399
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3400
	from:leftX to:rightX separateAtX:relativeX 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3401
	nameAs:nil
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3402
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3403
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3404
     |dialog model field|
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3405
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3406
     model := '' asValue.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3407
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3408
     dialog := DialogBox new.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3409
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3410
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3411
		addLabelledField:(EditField on:model) label:'input here:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3412
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3413
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3414
		separateAtX:0.3.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3415
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3416
     dialog addAbortButton; addOkButton.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3417
     dialog open.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3418
     dialog accepted ifTrue:[Transcript showCR:model value].
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3419
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3420
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3421
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3422
     |dialog model field|
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3423
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3424
     model := SelectionInList new.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3425
     model list:#('foo' 'bar' 'baz').
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3426
     model selectionIndex:2.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3427
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3428
     dialog := DialogBox new.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3429
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3430
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3431
		addLabelledField:(PopUpList on:model) label:'select here:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3432
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3433
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3434
		separateAtX:0.3.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3435
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3436
     dialog addAbortButton; addOkButton.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3437
     dialog open.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3438
     dialog accepted ifTrue:[Transcript showCR:model value].
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3439
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3440
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3441
    "Created: 3.6.1996 / 11:03:24 / cg"
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3442
    "Modified: 17.7.1996 / 15:04:07 / cg"
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3443
!
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3444
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3445
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable from:leftX to:rightX separateAtX:relativeX nameAs:aName
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3446
    "add a label and some view side-by-side.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3447
     The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3448
     The labels string is defined by labelString and adjusted according to labelAdjust.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3449
     The inputField gets model as its model.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3450
     Return the inputField."
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3451
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3452
    |y lbl max relW|
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3453
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3454
    y := self yPosition.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3455
    lbl := Label label:labelString.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3456
    max := lbl preferredExtent y max:(aView preferredExtent y).
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3457
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3458
    relW := rightX - leftX.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3459
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3460
    self addComponent:lbl indent:leftIndent withHeight:max.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3461
    lbl rightInset:0.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3462
    lbl 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3463
	width:(relW*relativeX); 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3464
	left:leftX; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3465
	adjust:labelAdjust; borderWidth:0.
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3466
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3467
    self yPosition:y.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3468
    self addComponent:aView tabable:tabable.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3469
    aView 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3470
	leftInset:ViewSpacing; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3471
	rightInset:ViewSpacing.
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3472
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3473
    aView 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3474
	width:relW*(1.0 - relativeX); 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3475
	left:leftX+(relW*relativeX).
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3476
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3477
    aView isInputField ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3478
	self addToInputFieldGroup:aView
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3479
    ].
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3480
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3481
    aName notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3482
	self name:lbl as:(aName , '.label').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3483
	self name:aView as:aName
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3484
    ].
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3485
    ^ aView
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3486
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3487
    "
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3488
     |dialog model field|
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3489
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3490
     model := '' asValue.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3491
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3492
     dialog := DialogBox new.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3493
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3494
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3495
		addLabelledField:(EditField on:model) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3496
		label:'input here:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3497
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3498
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3499
		separateAtX:0.3.
807
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3500
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3501
     dialog addAbortButton; addOkButton.
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3502
     dialog open.
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3503
     dialog accepted ifTrue:[Transcript showCR:model value].
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3504
    "
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3505
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3506
    "
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3507
     |dialog model field|
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3508
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3509
     model := '' asValue.
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3510
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3511
     dialog := DialogBox new.
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3512
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3513
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3514
		addLabelledField:((ComboListView on:model) list:#('foo' 'bar' 'baz'))
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3515
		label:'select foo:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3516
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3517
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3518
		separateAtX:0.3.
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3519
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3520
     dialog addAbortButton; addOkButton.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3521
     dialog open.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3522
     dialog accepted ifTrue:[Transcript showCR:model value].
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3523
    "
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3524
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3525
    "
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3526
     |dialog model field|
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3527
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3528
     model := SelectionInList new.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3529
     model list:#('foo' 'bar' 'baz').
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3530
     model selectionIndex:2.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3531
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3532
     dialog := DialogBox new.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3533
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3534
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3535
		addLabelledField:(PopUpList on:model) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3536
		label:'select here:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3537
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3538
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3539
		separateAtX:0.3.
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3540
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3541
     dialog addAbortButton; addOkButton.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3542
     dialog open.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3543
     dialog accepted ifTrue:[Transcript showCR:model value].
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3544
    "
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3545
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3546
    "Created: 17.7.1996 / 15:03:32 / cg"
807
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3547
    "Modified: 26.7.1996 / 18:11:12 / cg"
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3548
!
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3549
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3550
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable separateAtX:relativeX
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3551
    "add a label and some view side-by-side.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3552
     The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3553
     The labels string is defined by labelString and adjusted according to labelAdjust.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3554
     The inputField gets model as its model.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3555
     Return the inputField."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3556
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3557
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3558
	addLabelledField:aView 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3559
	label:labelString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3560
	adjust:labelAdjust 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3561
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3562
	from:0.0 to:1.0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3563
	separateAtX:relativeX
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3564
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3565
"/    |y lbl max|
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3566
"/
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3567
"/    y := self yPosition.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3568
"/    lbl := Label label:labelString.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3569
"/    max := lbl preferredExtent y max:(aView preferredExtent y).
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3570
"/
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3571
"/    self addComponent:lbl indent:leftIndent withHeight:max.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3572
"/    lbl rightInset:0.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3573
"/    lbl width:relativeX; adjust:labelAdjust; borderWidth:0.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3574
"/
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3575
"/    self yPosition:y.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3576
"/    self addComponent:aView tabable:tabable.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3577
"/    aView leftInset:ViewSpacing; rightInset:ViewSpacing.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3578
"/    aView width:(1.0 - relativeX); left:relativeX.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3579
"/
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3580
"/    aView isInputField ifTrue:[
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3581
"/        self addToInputFieldGroup:aView
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3582
"/    ].
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3583
"/
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3584
"/    ^ aView
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3585
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3586
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3587
     |dialog model field|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3588
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3589
     model := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3590
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3591
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3592
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3593
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3594
		addLabelledField:(EditField on:model) label:'input here:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3595
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3596
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3597
		separateAtX:0.3.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3598
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3599
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3600
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3601
     dialog accepted ifTrue:[Transcript showCR:model value].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3602
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3603
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3604
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3605
     |dialog model field|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3606
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3607
     model := SelectionInList new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3608
     model list:#('foo' 'bar' 'baz').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3609
     model selectionIndex:2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3610
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3611
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3612
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3613
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3614
		addLabelledField:(PopUpList on:model) label:'select here:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3615
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3616
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3617
		separateAtX:0.3.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3618
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3619
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3620
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3621
     dialog accepted ifTrue:[Transcript showCR:model value].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3622
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3623
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3624
    "Created: 13.4.1996 / 13:41:31 / cg"
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3625
    "Modified: 3.6.1996 / 18:48:49 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3626
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3627
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3628
addTextLabel:aString
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3629
    "create a text label - the name has been choosen for ST-80 compatibility;
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3630
     however, ST/X labels allow image labels too.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3631
     Returns the label."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3632
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3633
    |l|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3634
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3635
    l := Label new label:aString.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3636
    l borderWidth:0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3637
    self addComponent:l.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3638
    ^ l
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3639
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3640
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3641
     |b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3642
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3643
     b := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3644
     b addTextLabel:'hello'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3645
     b showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3646
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3647
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3648
     |b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3649
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3650
     b := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3651
     b leftIndent:100.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3652
     b addTextLabel:'hello'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3653
     b leftIndent:0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3654
     b addTextLabel:'world'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3655
     b showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3656
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3657
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3658
     |b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3659
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3660
     b := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3661
     b addTextLabel:'hello'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3662
     b addTextLabel:'world'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3663
     b addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3664
     b showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3665
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3666
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3667
     |b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3668
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3669
     b := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3670
     b addTextLabel:'hello'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3671
     (b addTextLabel:'world') foregroundColor:Color red.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3672
     b addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3673
     b showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3674
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3675
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3676
     |b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3677
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3678
     b := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3679
     b addTextLabel:'hello world\\How about this ?' withCRs.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3680
     b addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3681
     b showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3682
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3683
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3684
     |b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3685
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3686
     b := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3687
     b addTextLabel:'hello world\\How about this ?' withCRs.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3688
     b addTextLabel:'not bad'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3689
     b addAbortButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3690
     b addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3691
     b showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3692
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3693
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3694
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3695
addToInputFieldGroup:aComponentOrSubcomponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3696
    "add a component to the input group.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3697
     The argument, aComponentOrSubcomponent may even be a nested subcomponent of
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3698
     a topLevel component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3699
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3700
    self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3701
	addToInputFieldGroup:aComponentOrSubcomponent before:nil
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3702
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3703
    "Modified: 18.10.1997 / 03:09:17 / cg"
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3704
!
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3705
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3706
addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3707
    "add a component to the input group.
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3708
     The argument, aComponentOrSubcomponent may even be a nested subcomponent of
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3709
     a topLevel component."
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3710
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3711
    inputFieldGroup isNil ifTrue:[
1759
ceec9f2dd1f9 comment
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
  3712
        inputFieldGroup := EnterFieldGroup new.
ceec9f2dd1f9 comment
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
  3713
        inputFieldGroup leaveAction:[self lastFieldLeft].
ceec9f2dd1f9 comment
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
  3714
        "/
ceec9f2dd1f9 comment
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
  3715
        "/ the first inputField gets the focus initially
ceec9f2dd1f9 comment
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
  3716
        "/
ceec9f2dd1f9 comment
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
  3717
        aComponentOrSubcomponent hasKeyboardFocus:true.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3718
    ].
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3719
    inputFieldGroup add:aComponentOrSubcomponent before:anotherComponent.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3720
    self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3721
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3722
"/    inputFields isNil ifTrue:[
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3723
"/        inputFields := OrderedCollection new.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3724
"/
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3725
"/        "/ the very first field gets the focus initially
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3726
"/
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3727
"/        aComponentOrSubcomponent showCursor.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3728
"/        aComponentOrSubcomponent hasKeyboardFocus:true.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3729
"/    ] ifFalse:[
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3730
"/        aComponentOrSubcomponent hideCursor.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3731
"/        aComponentOrSubcomponent hasKeyboardFocus:false.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3732
"/    ].
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3733
"/    inputFields add:aComponentOrSubcomponent
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3734
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3735
    "Modified: 18.10.1997 / 02:47:20 / cg"
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3736
    "Created: 18.10.1997 / 03:08:51 / cg"
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3737
!
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3738
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3739
removeFromInputFieldGroup:aComponentOrSubcomponent
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3740
    "remove a component from the input group.
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3741
     The argument, aComponentOrSubcomponent may even be a nested subcomponent of
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3742
     a topLevel component."
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3743
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3744
    inputFieldGroup isNil ifTrue:[^ self].
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3745
    inputFieldGroup remove:aComponentOrSubcomponent.
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3746
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3747
    "Created: 18.10.1997 / 02:51:30 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3748
! !
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3749
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3750
!DialogBox methodsFor:'construction-buttons'!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3751
1763
1c6be8158c27 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3752
addAbortAndOkButtons
1c6be8158c27 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3753
    "create both abort- and Ok Buttons"
1c6be8158c27 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3754
1c6be8158c27 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3755
    self addAbortButton; addOkButton
1c6be8158c27 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3756
!
1c6be8158c27 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3757
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3758
addAbortButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3759
    "create an abortButton - to be sent from redefined initialize
162
claus
parents: 157
diff changeset
  3760
     methods in subclasses or when creating a box programmatically.
claus
parents: 157
diff changeset
  3761
     Returns the button."
claus
parents: 157
diff changeset
  3762
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3763
    ^ self addAbortButtonLabelled:nil
122
claus
parents: 121
diff changeset
  3764
!
120
claus
parents: 118
diff changeset
  3765
162
claus
parents: 157
diff changeset
  3766
addAbortButton:aButton 
claus
parents: 157
diff changeset
  3767
    "add an already created abortButton - to be sent from redefined initialize
claus
parents: 157
diff changeset
  3768
     methods in subclasses or when creating a box programmatically.
claus
parents: 157
diff changeset
  3769
     Returns the button."
claus
parents: 157
diff changeset
  3770
1764
45ca6b617934 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
  3771
    <resource: #style (#'dialogBox.okAtLeft')>
45ca6b617934 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
  3772
162
claus
parents: 157
diff changeset
  3773
    abortButton := aButton.
claus
parents: 157
diff changeset
  3774
    aButton model:self; change:#abortPressed.
1764
45ca6b617934 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
  3775
    (styleSheet at:'dialogBox.okAtLeft' default:false) ifTrue:[
1763
1c6be8158c27 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3776
        self addButton:aButton after:nil.
1c6be8158c27 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3777
    ] ifFalse:[
1c6be8158c27 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3778
        self addButton:aButton before:nil.
1c6be8158c27 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3779
    ].
1c6be8158c27 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3780
    ^ aButton.
162
claus
parents: 157
diff changeset
  3781
claus
parents: 157
diff changeset
  3782
    "Created: 17.9.1995 / 20:17:26 / claus"
claus
parents: 157
diff changeset
  3783
!
claus
parents: 157
diff changeset
  3784
122
claus
parents: 121
diff changeset
  3785
addAbortButtonLabelled:buttonLabel
claus
parents: 121
diff changeset
  3786
    "create an abortButton with a label - to be sent from redefined initialize
claus
parents: 121
diff changeset
  3787
     methods in subclasses or when creating a box programmatically.
claus
parents: 121
diff changeset
  3788
     A nil argument creates one with the default label.
claus
parents: 121
diff changeset
  3789
     Returns the button."
claus
parents: 121
diff changeset
  3790
162
claus
parents: 157
diff changeset
  3791
    |aButton|
claus
parents: 157
diff changeset
  3792
claus
parents: 157
diff changeset
  3793
    aButton := Button abortButton.
claus
parents: 157
diff changeset
  3794
    buttonLabel notNil ifTrue:[aButton label:buttonLabel].
claus
parents: 157
diff changeset
  3795
    ^ self addAbortButton:aButton
claus
parents: 157
diff changeset
  3796
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3797
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3798
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3799
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3800
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3801
     dialog addAbortButtonLabelled:'get out of here'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3802
     dialog addOkButtonLabelled:'yes thats ok'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3803
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3804
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3805
    "
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
    "Modified: 9.2.1996 / 22:09:40 / cg"
120
claus
parents: 118
diff changeset
  3808
!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3809
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3810
addButton:aButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3811
    "add a button into the buttonPanel.
122
claus
parents: 121
diff changeset
  3812
     Returns the button."
120
claus
parents: 118
diff changeset
  3813
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3814
    ^ self addButton:aButton after:nil
344
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
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3818
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3819
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3820
     dialog addAbortButton.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3821
     dialog addButton:(Button label:'foo' action:[Transcript showCR:'foo']).
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3822
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3823
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3824
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3825
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3826
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
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3829
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3830
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3831
     dialog addAbortButton.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3832
     dialog addButton:(Button label:'foo' action:[dialog hide. Transcript showCR:'foo']).
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3833
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3834
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3835
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3836
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3837
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3838
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3839
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3840
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3841
     dialog := DialogBox new.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3842
     dialog addButton:(Button label:'foo' action:[dialog hide. Transcript showCR:'foo']).
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3843
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3844
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3845
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3846
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3847
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3848
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3849
    "Modified: 9.2.1996 / 22:14:17 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3850
!
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
addButton:aButton after:someOtherButtonOrNil
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3853
    "add a button into the buttonPanel.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3854
     If the argument someOtherButtonOrNil is nil, the button is
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3855
     added at the end."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3856
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3857
    |h|
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 addSubView:aButton after:someOtherButtonOrNil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3860
    buttonPanel subViews size > 1 ifTrue:[
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3861
        buttonPanel horizontalLayout:#fitSpace.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3862
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3863
    (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3864
         buttonPanel topInset:h negated
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3865
    ].
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3866
    needResize := true.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3867
    ^ aButton
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3868
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3869
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3870
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3871
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3872
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3873
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3874
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3875
     dialog addButton:(Button 
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3876
                        label:'foo' 
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3877
                        action:[dialog hide. Transcript showCR:'foo'])
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3878
                after:(dialog okButton).
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3879
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3880
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3881
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3882
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3883
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3884
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3885
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3886
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3887
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3888
     dialog addButton:(Button 
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3889
                        label:'foo' 
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3890
                        action:[dialog hide. Transcript showCR:'foo'])
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3891
                after:(dialog abortButton).
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3892
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3893
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3894
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3895
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3896
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3897
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3898
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3899
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3900
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3901
     dialog addButton:(Button 
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3902
                        label:'foo' 
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3903
                        action:[dialog hide. Transcript showCR:'foo'])
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3904
                after:nil.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3905
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3906
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3907
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3908
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3909
    "Modified: 9.2.1996 / 22:13:51 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3910
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3911
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3912
addButton:aButton before:someOtherButtonOrNil
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3913
    "add a button into the buttonPanel.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3914
     If the argument someOtherButtonOrNil is nil, the button is
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3915
     added upFront."
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3916
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3917
    |h|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3918
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3919
    buttonPanel addSubView:aButton before:someOtherButtonOrNil.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3920
    buttonPanel subViews size > 1 ifTrue:[
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3921
        buttonPanel horizontalLayout:#fitSpace.
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3922
    ].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3923
    (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3924
         buttonPanel topInset:h negated
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3925
    ].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3926
    needResize := true.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3927
    ^ aButton
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3928
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3929
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3930
     |dialog|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3931
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3932
     dialog := DialogBox new.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3933
     dialog addAbortButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3934
     dialog addOkButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3935
     dialog addButton:(Button 
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3936
                        label:'foo' 
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3937
                        action:[dialog hide. Transcript showCR:'foo'])
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3938
                before:(dialog okButton).
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3939
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3940
     dialog accepted ifTrue:[Transcript showCR:'yes'].
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3941
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3942
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3943
     |dialog|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3944
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3945
     dialog := DialogBox new.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3946
     dialog addAbortButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3947
     dialog addOkButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3948
     dialog addButton:(Button 
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3949
                        label:'foo' 
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3950
                        action:[dialog hide. Transcript showCR:'foo'])
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3951
                before:nil.
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3952
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3953
     dialog accepted ifTrue:[Transcript showCR:'yes'].
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3954
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3955
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3956
    "Modified: 9.2.1996 / 22:13:51 / cg"
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3957
    "Created: 10.2.1996 / 16:04:35 / cg"
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3958
!
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3959
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3960
addHelpButtonFor:pathToHelpText 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3961
    "add a help button to the buttonPanel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3962
     The argument, pathToHelpText should specify the path to the help
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3963
     text under either the doc/online/<language> or the help/<language>
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3964
     directory."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3965
1764
45ca6b617934 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
  3966
    <resource: #style (#'dialogBox.okAtLeft')>
45ca6b617934 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
  3967
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3968
    |helpButton|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3969
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3970
    helpButton := Button label:(resources string:'help').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3971
    helpButton action:[
1760
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  3972
        self withWaitCursorDo:[HTMLDocumentView openFullOnHelpFile:pathToHelpText]
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  3973
    ].
1764
45ca6b617934 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
  3974
    (styleSheet at:'dialogBox.okAtLeft' default:false) ifTrue:[
1760
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  3975
        self addButton:helpButton after:nil.
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  3976
    ] ifFalse:[
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  3977
        self addButton:helpButton before:nil.
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  3978
    ].
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  3979
    ^ helpButton
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3980
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3981
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3982
     |box|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3983
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3984
     box := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3985
     box 
1760
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  3986
        addHelpButtonFor:'Launcher/compilerSettings.html';
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  3987
        addAbortButton; 
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  3988
        addOkButton.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3989
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3990
     box open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3991
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3992
659
423ebd648403 use new documentView
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3993
    "Modified: 20.5.1996 / 20:30:55 / cg"
831
8af010be0a02 Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents: 807
diff changeset
  3994
    "Modified: 9.9.1996 / 22:40:21 / stefan"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3995
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3996
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3997
addOkButton
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3998
    "create an okButton - to be sent from redefined initialize
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3999
     methods in subclasses or when creating a box programmatically.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4000
     Returns the button."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4001
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4002
    ^ self addOkButtonLabelled:nil
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4003
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4004
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4005
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4006
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4007
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4008
     dialog addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4009
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4010
     dialog accepted ifTrue:[Transcript showCR:'yes'].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4011
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4012
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4013
    "Modified: 9.2.1996 / 21:37:02 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4014
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4015
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4016
addOkButton:aButton 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4017
    "add an already created okButton - to be sent from redefined initialize
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4018
     methods in subclasses or when creating a box programmatically.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4019
     Returns the button."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4020
1764
45ca6b617934 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
  4021
    <resource: #style (#'dialogBox.okAtLeft')>
45ca6b617934 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
  4022
45ca6b617934 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
  4023
"/    okButton isNil ifTrue:[
45ca6b617934 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
  4024
        okButton := aButton.
45ca6b617934 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
  4025
"/    ].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4026
    aButton model:self; change:#okPressed.
1764
45ca6b617934 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
  4027
    (styleSheet at:'dialogBox.okAtLeft' default:false) ifTrue:[
1760
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  4028
        self addButton:aButton before:nil.
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  4029
    ] ifFalse:[
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  4030
        self addButton:aButton after:nil.
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  4031
    ].
631f902aaabe care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  4032
    ^ aButton.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4033
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4034
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4035
     |dialog b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4036
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4037
     b := Button label:((Image fromFile:'garfield.gif') magnifiedBy:0.5).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4038
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4039
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4040
     dialog addOkButton:b.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4041
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4042
     dialog accepted ifTrue:[Transcript showCR:'yes'].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4043
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4044
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4045
    "Modified: 17.9.1995 / 20:20:41 / claus"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4046
    "Modified: 9.2.1996 / 21:38:48 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4047
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4048
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4049
addOkButtonLabelled:buttonLabel 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4050
    "create an okButton with a label - to be sent from redefined initialize
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4051
     methods in subclasses or when creating a box programmatically.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4052
     A nil argument creates one with the default text.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4053
     Returns the button."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4054
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4055
    |aButton|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4056
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4057
    aButton := Button okButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4058
    buttonLabel notNil ifTrue:[aButton label:buttonLabel].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4059
    aButton isReturnButton:acceptReturnAsOK.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4060
    ^ self addOkButton:aButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4061
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4062
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4063
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4064
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4065
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4066
     dialog addOkButtonLabelled:'get out of here'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4067
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4068
     dialog accepted ifTrue:[Transcript showCR:'yes'].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4069
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4070
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4071
    "Modified: 9.2.1996 / 21:39:34 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4072
! !
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4073
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4074
!DialogBox methodsFor:'construction-check & comboboxes'!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4075
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4076
addCheckBox:label on:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4077
    "create a checkBox with label on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4078
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4079
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4080
    ^ self addCheckBox:label on:aModel tabable:true
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4081
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4082
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4083
     |dialog check|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4084
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4085
     check := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4086
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4087
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4088
     dialog addCheckBox:'on or off' on:check.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4089
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4090
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4091
     dialog accepted ifTrue:[Transcript showCR:check value].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4092
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4093
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4094
    "Modified: 9.2.1996 / 22:15:38 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4095
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  4096
600
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4097
addCheckBox:label on:aModel tabable:tabable
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4098
    "create a checkBox with label on aModel and add it.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4099
     Returns the box."
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4100
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4101
    |b|
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4102
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4103
    b := CheckBox on:aModel.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4104
    b label:label.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4105
    self addComponent:b tabable:tabable.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4106
    ^ b
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4107
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4108
    "
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4109
     |dialog check1 check2 check3|
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4110
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4111
     check1 := true asValue.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4112
     check2 := false asValue.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4113
     check3 := true asValue.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4114
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4115
     dialog := DialogBox new.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4116
     dialog addCheckBox:'on or off' on:check1 tabable:false.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4117
     dialog addHorizontalLine.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4118
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4119
     dialog addCheckBox:'on or off' on:check2 tabable:true.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4120
     dialog addCheckBox:'on or off' on:check3 tabable:true.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4121
     dialog addOkButton.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4122
     dialog open.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4123
    "
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4124
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4125
    "Modified: 9.2.1996 / 22:16:49 / cg"
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4126
!
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  4127
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4128
addComboBoxOn:aModel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4129
    "create a comboBoxView on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4130
     Returns the comboBoxView."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4131
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4132
    ^ self addComboBoxOn:aModel tabable:true
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4133
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4134
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4135
     without a list, the comboBox is disabled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4136
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4137
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4138
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4139
     val := 'some input' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4140
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4141
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4142
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4143
     (box addTextLabel:'combo box example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4144
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4145
     (box addComboBoxOn:val).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4146
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4147
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4148
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4149
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4150
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4151
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4152
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4153
    "with a list, it can be pulled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4154
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4155
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4156
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4157
     val := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4158
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4159
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4160
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4161
     (box addTextLabel:'combo box example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4162
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4163
     (box addComboBoxOn:val) list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4164
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4165
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4166
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4167
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4168
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4169
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4170
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4171
    "Modified: 28.2.1996 / 15:17:39 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4172
    "Created: 4.3.1996 / 17:21:45 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4173
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4174
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4175
addComboBoxOn:aModel tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4176
    "create a comboBoxView on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4177
     Returns the comboBoxView."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4178
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4179
    |f|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4180
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4181
    f := ComboBoxView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4182
    f model:aModel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4183
    self addComponent:f tabable:tabable.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4184
    tabable ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4185
	self addToInputFieldGroup:f editor.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4186
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4187
    ^ f
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4188
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4189
    "
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4190
     without a list, the comboBox is disabled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4191
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4192
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4193
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4194
     val := 'some input' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4195
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4196
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4197
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4198
     (box addTextLabel:'combo box example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4199
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4200
     (box addComboBoxOn:val tabable:true).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4201
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4202
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4203
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4204
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4205
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4206
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4207
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4208
    "with a list, it can be pulled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4209
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4210
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4211
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4212
     val := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4213
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4214
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4215
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4216
     (box addTextLabel:'combo box example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4217
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4218
     (box addComboBoxOn:val tabable:true) list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4219
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4220
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4221
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4222
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4223
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4224
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4225
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4226
    "Modified: 4.3.1996 / 17:21:57 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4227
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4228
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4229
addComboListOn:aModel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4230
    "create a comboListView on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4231
     Returns the comboListView."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4232
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4233
    ^ self addComboListOn:aModel tabable:true 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4234
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4235
    "without a list, the comboList is disabled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4236
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4237
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4238
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4239
     val := 'some input' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4240
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4241
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4242
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4243
     (box addTextLabel:'combo list example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4244
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4245
     (box addComboListOn:val).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4246
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4247
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4248
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4249
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4250
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4251
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4252
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4253
    "with a list, it can be pulled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4254
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4255
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4256
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4257
     val := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4258
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4259
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4260
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4261
     (box addTextLabel:'combo box example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4262
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4263
     (box addComboListOn:val) list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4264
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4265
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4266
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4267
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4268
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4269
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4270
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4271
    "Created: 28.2.1996 / 15:16:34 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4272
    "Modified: 4.3.1996 / 17:22:59 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4273
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4274
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4275
addComboListOn:aModel tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4276
    "create a comboListView on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4277
     Returns the comboListView."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4278
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4279
    |f|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4280
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4281
    f := ComboListView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4282
    f model:aModel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4283
    self addComponent:f tabable:tabable.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4284
    ^ f
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4285
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4286
    "without a list, the comboList is disabled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4287
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4288
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4289
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4290
     val := 'some input' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4291
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4292
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4293
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4294
     (box addTextLabel:'combo list example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4295
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4296
     (box addComboListOn:val tabable:true).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4297
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4298
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4299
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4300
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4301
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4302
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4303
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4304
    "with a list, it can be pulled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4305
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4306
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4307
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4308
     val := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4309
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4310
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4311
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4312
     (box addTextLabel:'combo box example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4313
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4314
     (box addComboListOn:val tabable:true) list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4315
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4316
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4317
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4318
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4319
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4320
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4321
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4322
    "Created: 28.2.1996 / 15:16:34 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4323
    "Modified: 4.3.1996 / 17:23:38 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4324
! !
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4325
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4326
!DialogBox methodsFor:'construction-inputfields'!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4327
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4328
addFilenameInputFieldOn:aModel in:aDirectory tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4329
    "create a fileName input field on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4330
     Returns the field. This is much like a normal input field,
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4331
     but supports filename completion."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4332
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4333
    |f|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4334
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4335
    f := FilenameEditField new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4336
    aDirectory notNil ifTrue:[f directory:aDirectory].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4337
    f model:aModel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4338
    self addInputField:f tabable:tabable.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4339
    ^ f
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4340
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4341
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4342
addInputField:aField
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4343
    "add an already created input field.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4344
     Returns the field."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4345
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4346
    ^ self addInputField:aField tabable:true
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4347
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4348
    "Modified: 9.2.1996 / 20:46:16 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4349
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4350
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4351
addInputField:aField tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4352
    "add an already created input field.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4353
     If tabable is true, the field is put into a group, to allow
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4354
     stepping through the fields with #Cursor/#Return keys.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4355
     Returns the field."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4356
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4357
    self addComponent:aField tabable:tabable.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4358
    tabable ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4359
	self addToInputFieldGroup:aField.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4360
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4361
    ^ aField
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4362
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  4363
    "Modified: 31.5.1996 / 21:22:29 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4364
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4365
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4366
addInputFieldOn:aModel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4367
    "create an input field on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4368
     Returns the field."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4369
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4370
    ^ self addInputFieldOn:aModel tabable:true
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4371
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4372
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4373
     |dialog model field|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4374
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4375
     model := '' asValue.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4376
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4377
     dialog := DialogBox new.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4378
     (dialog addTextLabel:'enter a string') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4379
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4380
     field := dialog addInputFieldOn:model.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4381
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4382
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4383
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4384
     dialog accepted ifTrue:[Transcript showCR:model value].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4385
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4386
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4387
    "Modified: 9.2.1996 / 21:34:14 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4388
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4389
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4390
addInputFieldOn:aModel tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4391
    "create an input field on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4392
     If tabable is false, the field cannot be tabbed into
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4393
     and return does not close the box.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4394
     (pointer must be moved into it).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4395
     Returns the field."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4396
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4397
    |f|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4398
913
d3318d34a1d0 More #positionOffset fixes.
Stefan Vogel <sv@exept.de>
parents: 912
diff changeset
  4399
    f := EditField model:aModel.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4400
    self addInputField:f tabable:tabable.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4401
    ^ f
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4402
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4403
    " a non-tabable field:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4404
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4405
     |dialog model field|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4406
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4407
     model := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4408
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4409
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4410
     (dialog addTextLabel:'enter a string') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4411
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4412
     field := dialog addInputFieldOn:model tabable:false.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4413
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4414
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4415
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4416
     dialog accepted ifTrue:[Transcript showCR:model value].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4417
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4418
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4419
    "Modified: 9.2.1996 / 21:36:16 / cg"
913
d3318d34a1d0 More #positionOffset fixes.
Stefan Vogel <sv@exept.de>
parents: 912
diff changeset
  4420
    "Modified: 3.1.1997 / 10:24:04 / stefan"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4421
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4422
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4423
addLabelledInputField:labelString adjust:labelAdjust on:model tabable:tabable from:leftX to:rightX separateAtX:relativeX
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4424
    "add a label and an inputField side-by-side.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4425
     The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4426
     The labels string is defined by labelString and adjusted according to labelAdjust.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4427
     The inputField gets model as its model.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4428
     Return the inputField."
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4429
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4430
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4431
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4432
	addLabelledField:(EditField on:model) label:labelString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4433
	adjust:labelAdjust
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4434
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4435
	from:leftX to:rightX
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4436
	separateAtX:relativeX.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4437
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4438
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4439
     |dialog model field|
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4440
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4441
     model := '' asValue.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4442
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4443
     dialog := DialogBox new.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4444
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4445
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4446
		addLabelledInputField:'enter a string' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4447
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4448
		on:model 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4449
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4450
		separateAtX:0.3.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4451
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4452
     dialog addAbortButton; addOkButton.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4453
     dialog open.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4454
     dialog accepted ifTrue:[Transcript showCR:model value].
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4455
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4456
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4457
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4458
     |dialog model1 model2 field|
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4459
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4460
     model1 := '' asValue.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4461
     model2 := '' asValue.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4462
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4463
     dialog := DialogBox new.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4464
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4465
     dialog addTextLabel:'a two-input box'.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4466
     dialog addHorizontalLine.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4467
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4468
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4469
		addLabelledInputField:'string1:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4470
		adjust:#right 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4471
		on:model1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4472
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4473
		separateAtX:0.4.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4474
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4475
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4476
		addLabelledInputField:'string2:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4477
		adjust:#right 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4478
		on:model2 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4479
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4480
		separateAtX:0.4.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4481
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4482
     dialog addAbortButton; addOkButton.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4483
     dialog open.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4484
     dialog accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4485
	Transcript showCR:model1 value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4486
	Transcript showCR:model2 value.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4487
     ].
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4488
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4489
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4490
    "Modified: 19.4.1996 / 17:39:46 / cg"
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4491
    "Created: 3.6.1996 / 11:04:23 / cg"
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4492
!
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4493
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4494
addLabelledInputField:labelString adjust:labelAdjust on:model tabable:tabable separateAtX:relativeX
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4495
    "add a label and an inputField side-by-side.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4496
     The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4497
     The labels string is defined by labelString and adjusted according to labelAdjust.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4498
     The inputField gets model as its model.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4499
     Return the inputField."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4500
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4501
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4502
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4503
	addLabelledField:(EditField on:model) label:labelString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4504
	adjust:labelAdjust
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4505
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4506
	separateAtX:relativeX.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4507
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4508
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4509
     |dialog model field|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4510
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4511
     model := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4512
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4513
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4514
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4515
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4516
		addLabelledInputField:'enter a string' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4517
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4518
		on:model 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4519
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4520
		separateAtX:0.3.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4521
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4522
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4523
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4524
     dialog accepted ifTrue:[Transcript showCR:model value].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4525
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4526
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4527
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4528
     |dialog model1 model2 field|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4529
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4530
     model1 := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4531
     model2 := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4532
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4533
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4534
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4535
     dialog addTextLabel:'a two-input box'.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4536
     dialog addHorizontalLine.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4537
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4538
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4539
		addLabelledInputField:'string1:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4540
		adjust:#right 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4541
		on:model1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4542
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4543
		separateAtX:0.4.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4544
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4545
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4546
		addLabelledInputField:'string2:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4547
		adjust:#right 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4548
		on:model2 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4549
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4550
		separateAtX:0.4.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4551
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4552
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4553
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4554
     dialog accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4555
	Transcript showCR:model1 value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4556
	Transcript showCR:model2 value.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4557
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4558
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4559
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4560
    "Created: 13.4.1996 / 13:41:31 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4561
    "Modified: 19.4.1996 / 17:39:46 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4562
! !
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4563
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4564
!DialogBox methodsFor:'construction-layout'!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4565
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4566
addHorizontalLine
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4567
    "add a horizontal line as separator"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4568
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4569
    ^ self addComponent:(Separator new extent:1.0 @ 5).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4570
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4571
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4572
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4573
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4574
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4575
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4576
	addTextLabel:'some title string';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4577
	addHorizontalLine;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4578
	addTextLabel:'more text';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4579
	addOkButton;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4580
	open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4581
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4582
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4583
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4584
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4585
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4586
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4587
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4588
	addTextLabel:'some title string';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4589
	addHorizontalLine;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4590
	addTextLabel:'more text'.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4591
     (dialog addHorizontalLine) width:20.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4592
     dialog addTextLabel:'more text'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4593
     (dialog addHorizontalLine) width:20.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4594
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4595
	addTextLabel:'more text';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4596
	addHorizontalLine;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4597
	addOkButton;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4598
	open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4599
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4600
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4601
    "Modified: 19.4.1996 / 15:11:30 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4602
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4603
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4604
addVerticalSpace
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4605
    "add a default vertical space (1 mm)"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4606
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4607
    self addVerticalSpace:(ViewSpacing).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4608
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4609
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4610
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4611
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4612
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4613
     dialog addTextLabel:'some title string'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4614
     dialog addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4615
     dialog addTextLabel:'more text'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4616
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4617
     dialog addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4618
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4619
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4620
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4621
    "Modified: 9.2.1996 / 21:41:10 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4622
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4623
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4624
addVerticalSpace:nPixel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4625
    "add some pixels of space to the next component"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4626
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4627
    yPosition := yPosition + nPixel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4628
    needResize := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4629
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4630
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4631
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4632
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4633
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4634
     dialog addTextLabel:'some title string'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4635
     dialog addVerticalSpace:50.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4636
     dialog addTextLabel:'more text'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4637
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4638
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4639
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4640
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4641
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4642
    "Modified: 9.2.1996 / 21:41:23 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4643
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4644
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4645
leftIndent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4646
    "return the current indent 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4647
     (current x position - thats where the next component will be located)."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4648
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4649
    ^ leftIndent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4650
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4651
    "Modified: 27.1.1996 / 18:21:31 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4652
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4653
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4654
leftIndent:aNumber 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4655
    "set the left indent (current x position - thats where the next component
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4656
     will be located)."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4657
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4658
    leftIndent := aNumber.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4659
    needResize := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4660
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4661
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4662
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4663
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4664
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4665
     (dialog addTextLabel:'label1') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4666
     dialog leftIndent:20.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4667
     (dialog addTextLabel:'label2') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4668
     dialog leftIndent:40.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4669
     (dialog addTextLabel:'label3') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4670
     dialog leftIndent:60.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4671
     (dialog addTextLabel:'label4') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4672
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4673
     dialog addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4674
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4675
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4676
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4677
    "Modified: 9.2.1996 / 21:42:20 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4678
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4679
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4680
rightIndent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4681
    "return the current right indent."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4682
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4683
    ^ rightIndent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4684
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4685
    "Modified: 27.1.1996 / 18:21:31 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4686
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4687
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4688
rightIndent:aNumber 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4689
    "set the right indent"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4690
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4691
    rightIndent := aNumber.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4692
    needResize := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4693
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4694
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4695
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4696
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4697
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4698
     (dialog addTextLabel:'label1') adjust:#right.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4699
     dialog rightIndent:20.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4700
     (dialog addTextLabel:'label2') adjust:#right.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4701
     dialog rightIndent:40.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4702
     (dialog addTextLabel:'label3') adjust:#right.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4703
     dialog rightIndent:60.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4704
     (dialog addTextLabel:'label4') adjust:#right.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4705
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4706
     dialog addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4707
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4708
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4709
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4710
    "Modified: 9.2.1996 / 21:42:46 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4711
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4712
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4713
stickAtBottomWithFixHeight:aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4714
    "arrange for a component to be positioned at a constant offset
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4715
     from the bottom of the box and its height to remain the same.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4716
     This will keep the component at a constant distance from the bottom
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4717
     (without this setup, it would stay at a constant offset from the top)"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4718
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4719
    self resize.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4720
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4721
    aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4722
	topInset:(self height - aComponent top) negated;
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4723
	bottomInset:(self height - aComponent bottom); 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4724
	origin:0.0 @ 1.0; corner:1.0 @ 1.0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4725
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4726
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4727
     compare the resizing behavior of:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4728
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4729
	|box|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4730
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4731
	box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4732
	box addTextLabel:'hello'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4733
	box addTextLabel:'hello2'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4734
	box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4735
	box show
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4736
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4737
     with:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4738
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4739
	|box l2|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4740
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4741
	box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4742
	box addTextLabel:'hello'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4743
	l2 := box addTextLabel:'hello2'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4744
	box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4745
	box stickAtBottomWithFixHeight:l2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4746
	box show
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4747
   "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4748
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4749
    "Created: 27.1.1996 / 17:17:41 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4750
    "Modified: 27.1.1996 / 18:29:03 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4751
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4752
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4753
stickAtBottomWithVariableHeight:aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4754
    "arrange for a component to be positioned at a constant offset
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4755
     from the bottom of the box and its height to be adjusted.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4756
     This will resize the component for a constant distance from the top,
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4757
     and the bottom.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4758
     (without this setup, its height would remain constant)"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4759
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4760
    self resize.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4761
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4762
    aComponent
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4763
	bottomInset:(self height - aComponent bottom); 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4764
	corner:1.0@1.0.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4765
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4766
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4767
     compare the resizing behavior of:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4768
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4769
	|box|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4770
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4771
	box := Dialog new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4772
	box addTextLabel:'hello'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4773
	(box addComponent:(SelectionInListView new)) level:-1.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4774
	box addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4775
	box show
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4776
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4777
     with:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4778
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4779
	|box list|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4780
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4781
	box := Dialog new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4782
	box addTextLabel:'hello'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4783
	list := (box addComponent:(SelectionInListView new)) level:-1.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4784
	box addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4785
	box stickAtBottomWithVariableHeight:list.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4786
	box show
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4787
   "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4788
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4789
    "Modified: 27.4.1996 / 18:34:20 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4790
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4791
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4792
yPosition 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4793
    "return the current y position (thats where the next component
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4794
     will be located)."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4795
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4796
    ^ yPosition 
120
claus
parents: 118
diff changeset
  4797
!
claus
parents: 118
diff changeset
  4798
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4799
yPosition:aNumber 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4800
    "set the current y position (thats where the next component
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4801
     will be located)."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4802
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4803
    yPosition := aNumber.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4804
    needResize := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4805
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4806
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4807
     |dialog pos|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4808
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4809
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4810
     pos := dialog yPosition.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4811
     (dialog addTextLabel:'label1') width:0.5.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4812
     dialog yPosition:pos.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4813
     (dialog addTextLabel:'label2') width:0.5; left:0.5.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4814
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4815
     dialog addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4816
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4817
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4818
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4819
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4820
     |dialog pos|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4821
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4822
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4823
     pos := dialog yPosition.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4824
     #('one' 'two' 'three' 'four') 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4825
     with:#(0.0 0.25 0.5 0.75) do:[:lbl :x |
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4826
	 dialog yPosition:pos.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4827
	(dialog addComponent:(Button label:lbl) tabable:true)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4828
		width:0.25; left:x.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4829
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4830
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4831
     dialog addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4832
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4833
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4834
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4835
    "Modified: 9.2.1996 / 21:46:40 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4836
! !
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4837
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4838
!DialogBox methodsFor:'construction-lists'!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4839
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4840
addListBoxOn:aModel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4841
    "add a selectionInListView to the box.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4842
     The listViews ScrollWrapper is returned"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4843
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4844
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4845
	addListBoxOn:aModel 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4846
	withNumberOfLines:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4847
	hScrollable:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4848
	vScrollable:true. 
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4849
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4850
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4851
     |dialog model listView|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4852
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4853
     model := SelectionInList new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4854
     model list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4855
     model selectionIndex:2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4856
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4857
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4858
     (dialog addTextLabel:'select any') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4859
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4860
     listView := dialog addListBoxOn:model.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4861
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4862
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4863
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4864
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4865
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4866
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4867
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4868
    "Modified: 27.4.1996 / 18:27:58 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4869
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4870
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4871
addListBoxOn:aModel class:aListViewClass
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4872
    "create & add an instance of aListViewClass to the box.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4873
     The listViews ScrollWrapper is returned"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4874
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4875
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4876
	addListBoxOn:aModel
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4877
	class:aListViewClass
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4878
	withNumberOfLines:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4879
	hScrollable:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4880
	vScrollable:true.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4881
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4882
    "Created: 19.4.1996 / 13:06:14 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4883
    "Modified: 27.4.1996 / 18:27:53 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4884
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4885
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4886
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4887
    "create and add an instance of aListViewClass to the box.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4888
     The list has numLines (if nonNil) number of lines shown.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4889
     The listViews ScrollWrapper is returned"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4890
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4891
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4892
	addListBoxOn:aModel
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4893
	class:aListViewClass
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4894
	withNumberOfLines:numLines 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4895
	hScrollable:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4896
	vScrollable:true.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4897
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4898
    "Created: 19.4.1996 / 13:05:05 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4899
    "Modified: 27.4.1996 / 18:27:48 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4900
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4901
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4902
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4903
    "add an instance of aListViewClass (selectionInListView) to the box.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4904
     The list has numLines (if nonNil) number of lines shown.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4905
     If scrolled, the ScrollWrapper is returned - otherwise the listView."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4906
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4907
    |l|
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4908
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4909
    l := self addTextBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4910
    l doubleClickAction:[:name | self okPressed].
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4911
    ^ l
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4912
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4913
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4914
     |dialog listView|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4915
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4916
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4917
     (dialog addTextLabel:'select any') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4918
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4919
     listView := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4920
			addListBoxOn:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4921
			class:FileSelectionList
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4922
			withNumberOfLines:10 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4923
			hScrollable:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4924
			vScrollable:false.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4925
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4926
     listView directory:'/etc'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4927
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4928
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4929
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4930
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4931
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView selectionValue].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4932
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4933
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4934
    "Created: 22.2.1996 / 15:40:07 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4935
    "Modified: 27.4.1996 / 18:26:15 / cg"
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4936
    "Modified: 15.6.1996 / 00:31:20 / stefan"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4937
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4938
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4939
addListBoxOn:aModel withNumberOfLines:numLines
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4940
    "add a selectionInListView to the box.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4941
     The list has numLines (if nonNil) number of lines shown.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4942
     The listViews ScrollWrapper is returned"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4943
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4944
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4945
	addListBoxOn:aModel 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4946
	withNumberOfLines:numLines 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4947
	hScrollable:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4948
	vScrollable:true. 
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4949
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4950
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4951
     |dialog model listView|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4952
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4953
     model := SelectionInList new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4954
     model list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4955
     model selectionIndex:2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4956
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4957
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4958
     (dialog addTextLabel:'select any') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4959
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4960
     listView := dialog addListBoxOn:model withNumberOfLines:3.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4961
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4962
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4963
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4964
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4965
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4966
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4967
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4968
    "Created: 22.2.1996 / 15:40:07 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4969
    "Modified: 27.4.1996 / 18:27:42 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4970
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4971
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4972
addListBoxOn:aModel withNumberOfLines:numLines hScrollable:hs vScrollable:vs
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4973
    "add a selectionInListView to the box.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4974
     The list has numLines (if nonNil) number of lines shown.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4975
     If scrolled, the ScrollWrapper is returned - otherwise the listView."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4976
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4977
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4978
	addListBoxOn:aModel 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4979
	class:SelectionInListView
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4980
	withNumberOfLines:numLines 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4981
	hScrollable:hs 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4982
	vScrollable:vs
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4983
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4984
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4985
     |dialog model listView|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4986
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4987
     model := SelectionInList new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4988
     model list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4989
     model selectionIndex:2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4990
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4991
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4992
     (dialog addTextLabel:'select any') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4993
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4994
     listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:true vScrollable:true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4995
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4996
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4997
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4998
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4999
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5000
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5001
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5002
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5003
     |dialog model listView|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5004
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5005
     model := SelectionInList new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5006
     model list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5007
     model selectionIndex:2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5008
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5009
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5010
     (dialog addTextLabel:'select any') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5011
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5012
     listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:false vScrollable:false.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5013
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5014
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5015
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5016
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  5017
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5018
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5019
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5020
    "Created: 22.2.1996 / 15:40:07 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5021
    "Modified: 27.4.1996 / 18:26:36 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5022
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5023
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5024
addPopUpList:labelString on:aModel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5025
    "create a popUpList with a label on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5026
     Returns the box."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5027
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5028
    ^ self addPopUpList:labelString on:aModel tabable:true
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5029
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5030
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5031
addPopUpList:labelString on:aModel tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5032
    "create a popUpList on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5033
     Returns the popUpList."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5034
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5035
    |p box l|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5036
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5037
    p := PopUpList on:aModel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5038
    p resize; sizeFixed:true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5039
    labelString notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5040
	box := HorizontalPanelView new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5041
	box borderWidth:0; horizontalLayout:#rightSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5042
	box add:(l := Label label:labelString).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5043
	l borderWidth:0.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5044
	box add:p.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5045
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5046
	box := p.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5047
    ].        
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5048
    self addComponent:box tabable:tabable tabbedComponent:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5049
    ^ p
735
2552463a8f34 place popUp at right (without extra space)
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
  5050
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5051
    "Modified: 31.5.1996 / 21:25:17 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5052
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5053
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5054
addPopUpListOn:aModel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5055
    "create a popUpList on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5056
     Returns the box."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5057
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5058
    ^ self addPopUpList:nil on:aModel tabable:true
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5059
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5060
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5061
addPopUpListOn:aModel tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5062
    "create a popUpList on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5063
     Returns the popUpList."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5064
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5065
    ^ self addPopUpList:nil on:aModel tabable:tabable
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5066
!
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5067
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5068
addTextBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5069
    "add an instance of aListViewClass to the box.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5070
     The list has numLines (if nonNil) number of lines shown.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5071
     If scrolled, the ScrollWrapper is returned - otherwise the listView."
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5072
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5073
    |l scr h dH|
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5074
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5075
    l := aListViewClass new.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5076
    l model:aModel.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5077
877
b451fa6920d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  5078
    (vs or:[hs]) ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5079
	hs ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5080
	    scr := HVScrollableView forView:l miniScrollerH:true .
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5081
	] ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5082
	    scr := ScrollableView forView:l
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5083
	].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5084
	scr resize.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5085
	"/ Transcript show:scr height; show:' '; showCR:l height.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5086
	dH := scr height - l height.
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5087
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5088
	l level:-1.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5089
	scr := l.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5090
	dH := 0.
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5091
    ].
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5092
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5093
    numLines notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5094
	h := l heightForLines:numLines.
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5095
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5096
	h := l preferredExtent y
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5097
    ].
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5098
    self addComponent:scr withHeight:(h + dH).
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5099
    ^ scr
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5100
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5101
    "
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5102
     |dialog listView|
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5103
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5104
     dialog := DialogBox new.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5105
     (dialog addTextLabel:'select any') adjust:#left.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5106
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5107
     listView := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5108
			addTextBoxOn:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5109
			class:EditTextView
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5110
			withNumberOfLines:10 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5111
			hScrollable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5112
			vScrollable:true.
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5113
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5114
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5115
     dialog addAbortButton; addOkButton.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5116
     dialog open.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5117
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5118
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView contents].
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5119
    "
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5120
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  5121
    "Created: 14.6.1996 / 23:33:47 / stefan"
877
b451fa6920d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  5122
    "Modified: 8.11.1996 / 15:31:15 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5123
! !
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5124
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5125
!DialogBox methodsFor:'construction-rows & columns'!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  5126
130
claus
parents: 128
diff changeset
  5127
addColumn:aRow fromX:leftX toX:rightX collect:aBlock
claus
parents: 128
diff changeset
  5128
    "add some elements in a vertical column.
claus
parents: 128
diff changeset
  5129
     Equally space elements as returned from aBlock."
claus
parents: 128
diff changeset
  5130
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5131
    self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5132
	addColumn:aRow 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5133
	fromX:leftX toX:rightX 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5134
	collect:aBlock 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5135
	tabable:false
130
claus
parents: 128
diff changeset
  5136
claus
parents: 128
diff changeset
  5137
    "
claus
parents: 128
diff changeset
  5138
     |dialog|
claus
parents: 128
diff changeset
  5139
claus
parents: 128
diff changeset
  5140
     dialog := Dialog new.
claus
parents: 128
diff changeset
  5141
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5142
	addColumn:#('label1' 'label2' 'lbl3' 'l4' 'label5')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5143
	fromX:0.0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5144
	toX:1.0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5145
	collect:[:label | Label label:label].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5146
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5147
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5148
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5149
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5150
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5151
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5152
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5153
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5154
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5155
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5156
	addColumn:#('label1' 'label2' 'label3' 'label4' 'label5')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5157
	fromX:0.25 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5158
	toX:0.75
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5159
	collect:[:label | (Label label:label) adjust:#left].
130
claus
parents: 128
diff changeset
  5160
claus
parents: 128
diff changeset
  5161
     dialog addOkButton.
claus
parents: 128
diff changeset
  5162
     dialog open.
claus
parents: 128
diff changeset
  5163
    "
claus
parents: 128
diff changeset
  5164
claus
parents: 128
diff changeset
  5165
    "
claus
parents: 128
diff changeset
  5166
     |dialog y|
claus
parents: 128
diff changeset
  5167
claus
parents: 128
diff changeset
  5168
     dialog := Dialog new.
claus
parents: 128
diff changeset
  5169
     y := dialog yPosition.
claus
parents: 128
diff changeset
  5170
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5171
	addColumn:#('a1' 'b1' 'c1' 'd1')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5172
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5173
	toX:(1/3) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5174
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  5175
claus
parents: 128
diff changeset
  5176
     dialog yPosition:y.
claus
parents: 128
diff changeset
  5177
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5178
	addColumn:#('a2' 'b2' 'c2' 'd2')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5179
	fromX:(1/3)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5180
	toX:(2/3) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5181
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  5182
claus
parents: 128
diff changeset
  5183
     dialog yPosition:y.
claus
parents: 128
diff changeset
  5184
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5185
	addColumn:#('a3' 'b3' 'c3' 'd3')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5186
	fromX:(2/3)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5187
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5188
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  5189
claus
parents: 128
diff changeset
  5190
     dialog addOkButton.
claus
parents: 128
diff changeset
  5191
     dialog open.
claus
parents: 128
diff changeset
  5192
    "
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5193
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5194
    "Modified: 9.2.1996 / 22:22:12 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5195
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5196
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5197
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5198
    "add some elements in a vertical column.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5199
     Equally space elements as returned from aBlock."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5200
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5201
    self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5202
	addColumn:aRow 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5203
	fromX:leftX toX:rightX 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5204
	collect:aBlock 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5205
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5206
	horizontalLayout:#fitSpace 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5207
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5208
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5209
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5210
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5211
     values := (1 to:4) collect:[:dummy | '' asValue].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5212
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5213
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5214
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5215
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5216
	addColumn:#('one' 'two' 'three' 'four')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5217
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5218
	toX:0.3 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5219
	collect:[:label | Label label:label].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5220
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5221
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5222
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5223
	addColumn:values
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5224
	fromX:0.3
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5225
	toX:1.0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5226
	collect:[:value | EditField on:value]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5227
	tabable:true.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5228
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5229
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5230
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5231
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5232
     dialog accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5233
	Transcript showCR:(values collect:[:holder | holder value])
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5234
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5235
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5236
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5237
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5238
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5239
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5240
     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
  5241
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5242
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5243
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5244
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5245
	addColumn:(1 to:4)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5246
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5247
	toX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5248
	collect:[:idx | CheckToggle on:(values at:idx)]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5249
	tabable:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5250
	horizontalLayout:#center.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5251
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5252
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5253
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5254
	addColumn:(5 to:8) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5255
	fromX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5256
	toX:1.0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5257
	collect:[:idx | CheckToggle on:(values at:idx)]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5258
	tabable:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5259
	horizontalLayout:#center.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5260
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5261
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5262
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5263
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5264
     dialog accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5265
	Transcript showCR:(values collect:[:holder | holder value])
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5266
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5267
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5268
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5269
    "Created: 9.2.1996 / 21:51:47 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5270
    "Modified: 9.2.1996 / 22:22:02 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5271
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5272
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5273
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
  5274
    "add some elements in a vertical column.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5275
     Equally space elements as returned from aBlock."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5276
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5277
    |helper component|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5278
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5279
    helper := VerticalPanelView new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5280
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5281
    aRow do:[:el |
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5282
	component := aBlock value:el.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5283
	helper add:component.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5284
	component resize.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5285
	tabable ifTrue:[self makeTabable:component].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5286
    ].    
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5287
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5288
    helper resize.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5289
    self addComponent:helper.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5290
    width < helper preferredExtent x ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5291
	self width:helper preferredExtent x.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5292
	"/ Transcript show:'w now: '; showCR:helper preferredExtent x
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5293
    ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5294
    helper horizontalLayout:hLayout.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5295
    helper left:leftX asFloat;
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5296
	   right:rightX asFloat;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5297
	   leftInset:leftIndent;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5298
	   rightInset:rightIndent.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5299
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5300
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5301
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5302
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5303
     values := (1 to:4) collect:[:dummy | '' asValue].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5304
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5305
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5306
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5307
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5308
	addColumn:#('one' 'two' 'three' 'four')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5309
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5310
	toX:0.3 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5311
	collect:[:label | Label label:label].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5312
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5313
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5314
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5315
	addColumn:values
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5316
	fromX:0.3
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5317
	toX:1.0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5318
	collect:[:value | EditField on:value]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5319
	tabable:true.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5320
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5321
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5322
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5323
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5324
     dialog accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5325
	Transcript showCR:(values collect:[:holder | holder value])
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5326
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5327
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5328
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5329
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5330
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5331
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5332
     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
  5333
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5334
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5335
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5336
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5337
	addColumn:(1 to:4)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5338
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5339
	toX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5340
	collect:[:idx | CheckToggle on:(values at:idx)].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5341
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5342
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5343
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5344
	addColumn:(5 to:8) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5345
	fromX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5346
	toX:1.0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5347
	collect:[:idx | CheckToggle on:(values at:idx)]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5348
	tabable:true.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5349
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5350
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5351
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5352
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5353
     dialog accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5354
	Transcript showCR:(values collect:[:holder | holder value])
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5355
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5356
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5357
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5358
    "Modified: 9.2.1996 / 22:02:22 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5359
    "Created: 9.2.1996 / 22:20:31 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5360
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5361
130
claus
parents: 128
diff changeset
  5362
addRow:aCol fromX:leftX toX:rightX collect:aBlock
claus
parents: 128
diff changeset
  5363
    "add some elements in a horizontal row.
claus
parents: 128
diff changeset
  5364
     Equally space elements as returned from aBlock.
claus
parents: 128
diff changeset
  5365
     Advance y."
claus
parents: 128
diff changeset
  5366
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5367
    self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5368
	addRow:aCol 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5369
	fromX:leftX toX:rightX 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5370
	collect:aBlock 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5371
	tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5372
	horizontalLayout:#spread 
130
claus
parents: 128
diff changeset
  5373
claus
parents: 128
diff changeset
  5374
    "
claus
parents: 128
diff changeset
  5375
     |dialog|
claus
parents: 128
diff changeset
  5376
claus
parents: 128
diff changeset
  5377
     dialog := Dialog new.
claus
parents: 128
diff changeset
  5378
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5379
	addRow:#('a' 'b' 'c' 'd')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5380
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5381
	toX:1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5382
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  5383
claus
parents: 128
diff changeset
  5384
     dialog addOkButton.
claus
parents: 128
diff changeset
  5385
     dialog open.
claus
parents: 128
diff changeset
  5386
    "
claus
parents: 128
diff changeset
  5387
claus
parents: 128
diff changeset
  5388
    "
claus
parents: 128
diff changeset
  5389
     |dialog|
claus
parents: 128
diff changeset
  5390
claus
parents: 128
diff changeset
  5391
     dialog := Dialog new.
claus
parents: 128
diff changeset
  5392
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5393
	addRow:#('a1' 'b1' 'c1' 'd1')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5394
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5395
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5396
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  5397
claus
parents: 128
diff changeset
  5398
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5399
	addRow:#('a2' 'b2' 'c2' 'd2')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5400
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5401
	toX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5402
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  5403
claus
parents: 128
diff changeset
  5404
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5405
	addRow:#('a3' 'b3' 'c3' 'd3')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5406
	fromX:0.5
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5407
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5408
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  5409
claus
parents: 128
diff changeset
  5410
     dialog addOkButton.
claus
parents: 128
diff changeset
  5411
     dialog open.
claus
parents: 128
diff changeset
  5412
    "
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5413
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5414
    "Modified: 9.2.1996 / 22:25:16 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5415
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5416
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5417
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5418
    "add some elements in a horizontal row.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5419
     Equally space elements as returned from aBlock.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5420
     Advance y."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5421
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5422
    self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5423
	addRow:aCol 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5424
	fromX:leftX toX:rightX 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5425
	collect:aBlock 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5426
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5427
	horizontalLayout:#spread
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5428
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5429
    "Created: 9.2.1996 / 22:25:35 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5430
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5431
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5432
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
  5433
    "add some elements in a horizontal row.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5434
     Equally space elements as returned from aBlock.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5435
     Advance y."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5436
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5437
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5438
	addRow:aCol 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5439
	fromX:leftX toX:rightX 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5440
	collect:aBlock 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5441
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5442
	horizontalLayout:hLayout
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5443
	verticalLayout:#fit
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5444
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5445
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5446
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5447
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5448
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5449
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5450
	addRow:#('a' 'b' 'c' 'd')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5451
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5452
	toX:1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5453
	collect:[:label | Label label:label]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5454
	tabable:false
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5455
	horizontalLayout:#fit.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5456
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5457
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5458
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5459
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5460
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5461
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5462
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5463
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5464
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5465
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5466
	addRow:#('one' 'two' 'three' 'four')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5467
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5468
	toX:1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5469
	collect:[:label | Button label:label]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5470
	tabable:false
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5471
	horizontalLayout:#fit.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5472
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5473
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5474
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5475
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5476
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5477
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5478
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5479
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5480
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5481
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5482
	addRow:#('a1' 'b1' 'c1' 'd1')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5483
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5484
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5485
	collect:[:label | Label label:label].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5486
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5487
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5488
	addRow:#('a2' 'b2' 'c2' 'd2')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5489
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5490
	toX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5491
	collect:[:label | Label label:label].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5492
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5493
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5494
	addRow:#('a3' 'b3' 'c3' 'd3')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5495
	fromX:0.5
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5496
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5497
	collect:[:label | Label label:label].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5498
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5499
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5500
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5501
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5502
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5503
    "Created: 9.2.1996 / 22:24:31 / cg"
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5504
    "Modified: 31.5.1996 / 20:46:00 / cg"
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5505
!
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5506
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5507
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable horizontalLayout:hLayout verticalLayout:vLayout
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5508
    "add some elements in a horizontal row.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5509
     Equally space elements as returned from aBlock.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5510
     Advance y."
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5511
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5512
    |helper component|
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5513
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5514
    helper := HorizontalPanelView new.
792
c6953d727789 care for 2D look
Claus Gittinger <cg@exept.de>
parents: 766
diff changeset
  5515
    helper borderWidth:0.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5516
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5517
    aCol do:[:el |
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5518
	component := aBlock value:el.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5519
	component resize.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5520
	helper add:component.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5521
	tabable ifTrue:[self makeTabable:component]
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5522
    ].    
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5523
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5524
    helper resize.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5525
    self addComponent:helper.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5526
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5527
    width < helper preferredExtent x ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5528
	self width:helper preferredExtent x.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5529
	"/ Transcript show:'w now: '; showCR:helper preferredExtent x
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5530
    ].
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5531
    hLayout notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5532
	helper horizontalLayout:hLayout.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5533
    ].
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5534
    vLayout notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5535
	helper verticalLayout:vLayout.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5536
    ].
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5537
    helper left:leftX asFloat;
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5538
	   right:rightX asFloat.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5539
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5540
    "
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5541
     |dialog|
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5542
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5543
     dialog := Dialog new.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5544
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5545
	addRow:#('a' 'b' 'c' 'd')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5546
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5547
	toX:1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5548
	collect:[:label | Label label:label]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5549
	tabable:false
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5550
	horizontalLayout:#fit.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5551
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5552
     dialog addOkButton.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5553
     dialog open.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5554
    "
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5555
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5556
    "
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5557
     |dialog|
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5558
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5559
     dialog := Dialog new.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5560
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5561
	addRow:#('one' 'two' 'three' 'four')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5562
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5563
	toX:1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5564
	collect:[:label | Button label:label]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5565
	tabable:false
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5566
	horizontalLayout:#fit.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5567
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5568
     dialog addOkButton.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5569
     dialog open.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5570
    "
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5571
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5572
    "
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5573
     |dialog|
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5574
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5575
     dialog := Dialog new.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5576
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5577
	addRow:#('a1' 'b1' 'c1' 'd1')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5578
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5579
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5580
	collect:[:label | Label label:label].
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5581
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5582
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5583
	addRow:#('a2' 'b2' 'c2' 'd2')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5584
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5585
	toX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5586
	collect:[:label | Label label:label].
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5587
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5588
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5589
	addRow:#('a3' 'b3' 'c3' 'd3')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5590
	fromX:0.5
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5591
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5592
	collect:[:label | Label label:label].
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5593
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5594
     dialog addOkButton.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5595
     dialog open.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5596
    "
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5597
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5598
    "Created: 31.5.1996 / 20:45:31 / cg"
792
c6953d727789 care for 2D look
Claus Gittinger <cg@exept.de>
parents: 766
diff changeset
  5599
    "Modified: 17.7.1996 / 12:06:08 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5600
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5601
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5602
!DialogBox methodsFor:'explicit focus control'!
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5603
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5604
focusOnOk
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5605
    windowGroup focusView:okButton
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5606
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5607
    "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
  5608
! !
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5609
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5610
!DialogBox methodsFor:'initialization'!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5611
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5612
focusSequence
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5613
    "return the elements through which we can step via 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5614
     NextField/PreviousField keys.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5615
     Here we return all tabable fields followed by all buttons in
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5616
     the panel."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5617
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5618
    |fields buttons|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5619
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5620
    tabableElements isNil ifTrue:[
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  5621
        fields := #()
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5622
    ] ifFalse:[
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  5623
        fields := tabableElements
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5624
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5625
    buttonPanel notNil ifTrue:[
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  5626
        buttons := buttonPanel subViews.
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  5627
        buttons notNil ifTrue:[
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  5628
            fields := fields , buttonPanel subViews
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  5629
        ]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5630
    ].
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  5631
    ^ fields "/ select:[:aField | aField realized and:[aField enabled]].
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5632
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5633
    "Modified: 31.5.1996 / 22:05:58 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5634
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5635
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5636
initialize
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5637
    |mm|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5638
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5639
    super initialize.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5640
573
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  5641
"/    label := 'Dialog'.
948
dbe2e86d0db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
  5642
    acceptValue := ValueHolder newBoolean.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5643
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5644
    mm := ViewSpacing.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5645
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5646
    acceptReturnAsOK := true.
125
claus
parents: 122
diff changeset
  5647
    acceptOnLeave := true.
1757
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  5648
    focusToOKOnLeave := DefaultFocusToOKOnLeave.
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5649
    hideOnAccept := true.
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  5650
    autoAccept := true.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5651
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5652
    buttonPanel := HorizontalPanelView in:self.
118
claus
parents: 112
diff changeset
  5653
    buttonPanel 
1757
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  5654
        origin:(0.0 @ 1.0) corner:(1.0 @ 1.0);
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  5655
        bottomInset:mm; 
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  5656
        topInset:(font height + mm * 2) negated;
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  5657
        borderWidth:0;
6229b8b6678b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
  5658
        horizontalLayout:#spread.
118
claus
parents: 112
diff changeset
  5659
122
claus
parents: 121
diff changeset
  5660
    yPosition := ViewSpacing.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  5661
    leftIndent := rightIndent := (ViewSpacing // 2).
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5662
    needResize := true.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5663
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5664
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5665
     |b|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5666
     b := DialogBox new.
118
claus
parents: 112
diff changeset
  5667
     b addAbortButton; 
claus
parents: 112
diff changeset
  5668
       addOkButton; 
claus
parents: 112
diff changeset
  5669
       showAtPointer
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5670
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5671
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5672
     |b|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5673
     b := DialogBox new.
118
claus
parents: 112
diff changeset
  5674
     b addOkButton; 
claus
parents: 112
diff changeset
  5675
       showAtPointer
claus
parents: 112
diff changeset
  5676
    "
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5677
    "
118
claus
parents: 112
diff changeset
  5678
     |b|
claus
parents: 112
diff changeset
  5679
     b := DialogBox new.
claus
parents: 112
diff changeset
  5680
     b addTextLabel:'hello world';
claus
parents: 112
diff changeset
  5681
       addOkButton; 
claus
parents: 112
diff changeset
  5682
       showAtPointer
claus
parents: 112
diff changeset
  5683
    "
claus
parents: 112
diff changeset
  5684
    "
claus
parents: 112
diff changeset
  5685
     |b|
claus
parents: 112
diff changeset
  5686
     b := DialogBox new.
claus
parents: 112
diff changeset
  5687
     b addTextLabel:'hello world';
claus
parents: 112
diff changeset
  5688
       addVerticalSpace:50; 
claus
parents: 112
diff changeset
  5689
       addOkButton; 
claus
parents: 112
diff changeset
  5690
       showAtPointer
claus
parents: 112
diff changeset
  5691
    "
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5692
1614
5aa3dfca0f33 geometry of buttonPanel.
Claus Gittinger <cg@exept.de>
parents: 1575
diff changeset
  5693
    "Modified: / 23.12.1997 / 10:05:24 / md"
5aa3dfca0f33 geometry of buttonPanel.
Claus Gittinger <cg@exept.de>
parents: 1575
diff changeset
  5694
    "Modified: / 27.7.1998 / 20:16:37 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5695
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5696
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5697
reAdjustGeometry
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5698
    "sent late in snapin processing - gives me a chance
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5699
     to resize for changed font dimensions."
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5700
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5701
    super reAdjustGeometry.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5702
    okButton notNil ifTrue:[okButton resize].
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5703
    abortButton notNil ifTrue:[abortButton resize].
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5704
    self resize
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5705
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5706
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5707
!DialogBox methodsFor:'private'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5708
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5709
basicAddComponent:aComponent 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5710
    "add a component, dont change its size"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5711
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5712
    addedComponents isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5713
	addedComponents := OrderedCollection new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5714
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5715
    addedComponents add:aComponent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5716
    self addSubView:aComponent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5717
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5718
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5719
hideAndEvaluate:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5720
    "if I am modal, make myself invisible and evaluate aBlock.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5721
     If nonModal, stay up, but also evaluate the block."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5722
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5723
    (windowGroup notNil and:[windowGroup isModal]) ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5724
	self hide.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5725
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5726
    aBlock notNil ifTrue:[aBlock value]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5727
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5728
    "Modified: 5.9.1995 / 19:06:33 / claus"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5729
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5730
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5731
realize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5732
    "if any inputFields where added, activate the first one"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5733
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5734
    inputFieldGroup notNil ifTrue:[
1646
ecad055bb871 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  5735
        inputFieldGroup activateFirstIfNoCurrent
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5736
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5737
    super realize
1646
ecad055bb871 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  5738
ecad055bb871 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  5739
    "Modified: / 13.8.1998 / 21:22:40 / cg"
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5740
!
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5741
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5742
resize
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5743
    needResize ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  5744
	needResize := false.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  5745
	super resize
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5746
    ]
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5747
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5748
    "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
  5749
    "Modified: 27.1.1996 / 18:25:40 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5750
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5751
120
claus
parents: 118
diff changeset
  5752
!DialogBox methodsFor:'queries'!
118
claus
parents: 112
diff changeset
  5753
121
claus
parents: 120
diff changeset
  5754
accepted
128
claus
parents: 126
diff changeset
  5755
    "after the box has closed:
claus
parents: 126
diff changeset
  5756
	 return true if accepted, false if canceled"
125
claus
parents: 122
diff changeset
  5757
128
claus
parents: 126
diff changeset
  5758
    ^ acceptValue value
121
claus
parents: 120
diff changeset
  5759
!
claus
parents: 120
diff changeset
  5760
120
claus
parents: 118
diff changeset
  5761
positionOffset
claus
parents: 118
diff changeset
  5762
    "return the delta, by which the box should be displayed
953
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5763
     from the mouse pointer. Here, an offset is returned, which
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5764
     makes the center of the first return-Button in the panel
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5765
     appear under the cursor. If there is no such button,
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5766
     use my superclasses offset."
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5767
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5768
    |idx butt buttons|
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5769
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5770
    buttonPanel notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5771
	buttons := buttonPanel subViews.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5772
	buttons size > 0 ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5773
	    idx := buttons findFirst:[:b | b isReturnButton].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5774
	    idx ~~ 0 ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5775
		butt := buttons at:idx.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5776
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5777
		"get our size (preferredExtent) and compute
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5778
		 origin and extent of buttonPanel and okButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5779
		 This is normally done on view realization."
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5780
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5781
		self resize.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5782
		buttonPanel pixelOrigin:buttonPanel computeOrigin.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5783
		buttonPanel pixelExtent:buttonPanel computeExtent.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5784
		buttonPanel setChildPositionsIfChanged.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5785
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5786
		^ (butt originRelativeTo:self) + (butt extent // 2)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5787
	    ]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5788
	]
118
claus
parents: 112
diff changeset
  5789
    ].
913
d3318d34a1d0 More #positionOffset fixes.
Stefan Vogel <sv@exept.de>
parents: 912
diff changeset
  5790
953
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5791
    ^ super positionOffset
912
310c4970e613 Fix #positionOffset to show 'senders' box with cursor on ok-button.
Stefan Vogel <sv@exept.de>
parents: 884
diff changeset
  5792
913
d3318d34a1d0 More #positionOffset fixes.
Stefan Vogel <sv@exept.de>
parents: 912
diff changeset
  5793
    "Modified: 3.1.1997 / 10:41:58 / stefan"
953
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5794
    "Modified: 16.1.1997 / 22:00:23 / cg"
118
claus
parents: 112
diff changeset
  5795
!
claus
parents: 112
diff changeset
  5796
130
claus
parents: 128
diff changeset
  5797
preferredExtent 
132
claus
parents: 131
diff changeset
  5798
    "return my preferred extent.
claus
parents: 131
diff changeset
  5799
     That is the max component width, or my current width (default);
claus
parents: 131
diff changeset
  5800
     whichever is larger, by the sum of the components heights."
118
claus
parents: 112
diff changeset
  5801
120
claus
parents: 118
diff changeset
  5802
    |w h p|
118
claus
parents: 112
diff changeset
  5803
797
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 795
diff changeset
  5804
    "/ If I have an explicit preferredExtent ..
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 795
diff changeset
  5805
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
  5806
    preferredExtent notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5807
	^ preferredExtent
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
  5808
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
  5809
120
claus
parents: 118
diff changeset
  5810
    addedComponents notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5811
	w := addedComponents 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5812
		inject:0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5813
		into:[:max :element |
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5814
			|eExt prefWidth scale rel relX|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5815
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5816
			prefWidth := element preferredExtent x.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5817
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5818
			"/ special (for your convenience)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5819
			"/ if the element has been added with a relative width,
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5820
			"/ scale it to get at least its preferred width
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5821
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5822
			(rel := element relativeExtent) notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5823
			    relX := rel x.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5824
			    (relX isNil or:[relX isInteger]) ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5825
				prefWidth := (prefWidth * (1 / relX)) rounded
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5826
			    ].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5827
			].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5828
			eExt := prefWidth + (element borderWidth * 2). "/ max:element extent x.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5829
			max max:(eExt + element leftInset + element rightInset)].
120
claus
parents: 118
diff changeset
  5830
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5831
	w := super preferredExtent x.
120
claus
parents: 118
diff changeset
  5832
    ].
132
claus
parents: 131
diff changeset
  5833
    w := w max:width.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5834
    h := yPosition + ViewSpacing.
118
claus
parents: 112
diff changeset
  5835
130
claus
parents: 128
diff changeset
  5836
    buttonPanel subViews size ~~ 0 ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5837
	p := buttonPanel preferredExtent.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5838
	w := w max:p x.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5839
	h := h
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5840
	     + p y
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5841
	     + ViewSpacing.
120
claus
parents: 118
diff changeset
  5842
    ].
118
claus
parents: 112
diff changeset
  5843
120
claus
parents: 118
diff changeset
  5844
"/    okButton isNil ifTrue:[
130
claus
parents: 128
diff changeset
  5845
"/        ^ super preferredExtent
120
claus
parents: 118
diff changeset
  5846
"/    ].
130
claus
parents: 128
diff changeset
  5847
"/    p := buttonPanel preferredExtent.
120
claus
parents: 118
diff changeset
  5848
"/    w := p x.
claus
parents: 118
diff changeset
  5849
"/    h := ViewSpacing
claus
parents: 118
diff changeset
  5850
"/         + p y
claus
parents: 118
diff changeset
  5851
"/         + ViewSpacing.
claus
parents: 118
diff changeset
  5852
"/
claus
parents: 118
diff changeset
  5853
    ^ w @ h
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5854
797
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 795
diff changeset
  5855
    "Modified: 19.7.1996 / 20:43:52 / cg"
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5856
! !
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5857
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5858
!DialogBox methodsFor:'user actions'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5859
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5860
abortPressed
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5861
    "sent by the cancel button; user pressed abort button
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5862
     - hide myself and evaluate okAction"
121
claus
parents: 120
diff changeset
  5863
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5864
    abortButton turnOffWithoutRedraw.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5865
    acceptValue value:false.
121
claus
parents: 120
diff changeset
  5866
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5867
    "/ actually, only hides if I have been opened modal
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5868
    self hideAndEvaluate:abortAction
121
claus
parents: 120
diff changeset
  5869
!
claus
parents: 120
diff changeset
  5870
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5871
doAccept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5872
    "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
  5873
     then set my accept value to true.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5874
     This is confusing: this method was originally called #accept,
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5875
     but renamed for compatibility with ST-80, where #accept returns the
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5876
     accept-valueHolder (which looks like a bad name to me ...)."
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5877
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  5878
    autoAccept ifTrue:[    
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5879
	addedComponents notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5880
	    addedComponents do:[:aComponent |
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5881
		(aComponent respondsTo:#accept) ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5882
		    aComponent accept
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5883
		]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5884
	    ]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5885
	].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5886
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5887
    acceptValue value:true.
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  5888
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  5889
    "Modified: 4.3.1996 / 12:14:56 / cg"
128
claus
parents: 126
diff changeset
  5890
!
claus
parents: 126
diff changeset
  5891
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5892
keyPress:aKey x:x y:y
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5893
    "return-key dublicates ok-function if acceptReturnAsOK is true"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5894
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  5895
    <resource: #keyboard (#Return)>
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  5896
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  5897
    (aKey == #Return) ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5898
	(okButton notNil and:[okButton isReturnButton]) ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5899
	    ^ self okPressed
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5900
	].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5901
	(abortButton notNil and:[abortButton isReturnButton]) ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5902
	    ^ self abortPressed
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5903
	].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5904
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5905
    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
  5906
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  5907
    "Modified: 7.3.1996 / 13:15:09 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5908
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5909
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5910
lastFieldLeft
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5911
    "if the dialog involves input fields, this is called
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5912
     when the last field is left by Return-key or NextField-key"
120
claus
parents: 118
diff changeset
  5913
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5914
    acceptOnLeave ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5915
	acceptReturnAsOK ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5916
	    focusToOKOnLeave ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5917
		self focusOnOk.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5918
		^ self.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5919
	    ].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5920
	    self okPressed
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5921
	]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5922
    ].
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5923
    inputFieldGroup activateFirst
357
732f59def851 care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
  5924
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5925
    "Modified: 19.4.1996 / 17:09:02 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5926
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5927
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5928
okPressed
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5929
    "sent by the okButton; user pressed ok-button
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5930
     - make myself invisible and if an action was specified do it"
128
claus
parents: 126
diff changeset
  5931
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5932
    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
  5933
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5934
    self doAccept.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5935
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5936
    acceptCheck notNil ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  5937
	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
  5938
    ].
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5939
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5940
    hideOnAccept ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  5941
	"/ actually, only hides if I have been opened modal
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  5942
	self hideAndEvaluate:okAction.
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5943
    ] ifFalse:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  5944
	okAction value
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5945
    ]
128
claus
parents: 126
diff changeset
  5946
! !
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  5947
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  5948
!DialogBox class methodsFor:'documentation'!
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  5949
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  5950
version
1843
b868964a554e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  5951
    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.133 1999-04-15 12:33:52 cg Exp $'
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  5952
! !
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  5953
DialogBox initialize!