DialogBox.st
author Claus Gittinger <cg@exept.de>
Tue, 28 Jul 1998 21:41:23 +0200
changeset 1624 bc716c00b226
parent 1614 5aa3dfca0f33
child 1646 ecad055bb871
permissions -rw-r--r--
added #confirmWithCancel:labels:
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'
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    19
	classVariableNames:''
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    20
	poolDictionaries:''
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    21
	category:'Views-DialogBoxes'
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
    22
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
    23
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:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1087
	Dialog := self
528
3ed1f0b5a0bb oops - dont clobber Dialog global if subclasses #initialize
Claus Gittinger <cg@exept.de>
parents: 498
diff changeset
  1088
    ]
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1089
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1090
    "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
  1091
    "Modified: 10.4.1996 / 08:16:18 / cg"
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1092
! !
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1093
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1094
!DialogBox class methodsFor:'common dialogs'!
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1095
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1096
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
  1097
    "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
  1098
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1099
    (InfoBox title:aString) showAtPointer; destroy
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1100
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1101
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1102
     Dialog information:'help'
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1103
    "
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1104
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1105
    "Modified: 29.5.1996 / 15:23:03 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1106
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1107
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1108
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
  1109
    "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
  1110
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1111
    (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
  1112
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1113
    "
625
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1114
     Dialog warn:'some warning message'
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1115
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1116
     Dialog warn:('some text with italic emphasis' asText 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1117
			emphasizeFrom:16 to:22 with:#italic)
625
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1118
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1119
     Dialog warn:('some warning message' asText 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1120
			emphasizeAllWith:(#color->Color red))
625
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1121
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1122
     Dialog warn:('some text with color emphasis' asText 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1123
			emphasizeFrom:6 to:10 with:(#color->Color blue);
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1124
			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
  1125
    "
625
9a43e6d91b62 comment example
Claus Gittinger <cg@exept.de>
parents: 600
diff changeset
  1126
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1127
    "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
  1128
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1129
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1130
!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
  1131
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1132
confirm:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1133
    "launch a Dialog, which allows user to enter yes or no.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1134
     return true for yes, false for no"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1135
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1136
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1137
	confirm:aString
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1138
	title:(self classResources string:'confirm')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1139
	yesLabel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1140
	noLabel:nil
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1141
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1142
"/    |box answer|
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1143
"/
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1144
"/    box := YesNoBox title:aString.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1145
"/    box label:(self classResources string:'Confirm').
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1146
"/    box yesAction:[answer := true] noAction:[answer := false].
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1147
"/    box showAtPointer.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1148
"/    box yesAction:nil noAction:nil.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1149
"/    ^ answer
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1150
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1151
    " 
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1152
     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
  1153
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  1154
     Transcript showCR:(
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1155
	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
  1156
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1157
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1158
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1159
    "Modified: 14.11.1996 / 16:02:30 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1160
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1161
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1162
confirm:aString initialAnswer:what
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1163
    "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
  1164
     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
  1165
     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
  1166
     the default (i.e. return-) button"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1167
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1168
    |box answer|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1169
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1170
    box := YesNoBox title:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1171
    box yesAction:[answer := true] noAction:[answer := false].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1172
    what == false ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1173
	box okButton isReturnButton:false.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1174
	box acceptReturnAsOK:false.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1175
	box noButton beReturnButton.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1176
    ].
884
ef5688a6a636 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 881
diff changeset
  1177
    box label:(self classResources string:'confirm').
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1178
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1179
    box yesAction:nil noAction:nil.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1180
    box destroy.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1181
    ^ answer
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
     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
  1185
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  1186
     Transcript showCR:(
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1187
	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
  1188
     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1189
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  1190
     Transcript showCR:(
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1191
	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
  1192
     )
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1193
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1194
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1195
    "Modified: 14.11.1996 / 16:04:13 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1196
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1197
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1198
confirm:aString title:title yesLabel:yesText noLabel:noText
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1199
    "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
  1200
     return true for yes, false for no.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1201
     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
  1202
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1203
    |box answer t|
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1204
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1205
    box := YesNoBox title:aString.
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1206
    yesText notNil ifTrue:[
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1207
        box yesLabel:yesText.
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1208
    ].
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1209
    noText notNil ifTrue:[
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1210
        box noLabel:noText.
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1211
    ].
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1212
    answer := false.
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1213
    box yesAction:[answer := true].
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1214
    title notNil ifTrue:[
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1215
        t := title
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1216
    ] ifFalse:[
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1217
        t := self classResources string:'confirm'
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1218
    ].
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1219
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1220
    box label:t.
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1221
    box showAtPointer.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1222
    box yesAction:nil noAction:nil.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1223
    box destroy.
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1224
    ^ answer
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1225
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1226
    " 
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1227
     Dialog 
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1228
        confirm:'really ?' 
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1229
        title:'fooBar'
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1230
        yesLabel:'oh well' 
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1231
        noLabel:'nope'
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1232
    "
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1233
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1234
    " 
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1235
     Dialog 
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1236
        confirm:'really ?' 
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1237
        title:nil
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1238
        yesLabel:'oh well' 
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1239
        noLabel:'nope'
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1240
    "
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1241
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1242
    " 
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1243
     Dialog 
1488
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1244
        confirm:'really ?' 
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1245
        title:''
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1246
        yesLabel:'oh well' 
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1247
        noLabel:'nope'
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1248
    "
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1249
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1250
    "Created: / 21.2.1996 / 01:10:14 / cg"
630b308c4295 ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1251
    "Modified: / 18.4.1998 / 19:25:21 / cg"
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1252
!
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1253
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1254
confirm:aString yesLabel:yesText noLabel:noText
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1255
    "launch a Dialog, which allows user to enter yes or no.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1256
     return true for yes, false for no.
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1257
     The yes/no buttons labels are defined by yesText/noText."
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1258
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1259
    ^ self confirm:aString title:nil yesLabel:yesText noLabel:noText
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1260
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1261
    " 
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1262
     Dialog confirm:'really ?' yesLabel:'oh well' noLabel:'nope'
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1263
    "
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1264
374
39a735c9a1c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
  1265
    "Created: 21.2.1996 / 01:10:14 / cg"
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1266
    "Modified: 8.3.1996 / 21:15:06 / cg"
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1267
!
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1268
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1269
confirmWithCancel:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1270
    "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
  1271
     return true for 'yes', false for 'no', nil for 'cancel'"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1272
1004
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1273
    ^ self confirmWithCancel:aString default:nil
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1274
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1275
    "
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1276
     Dialog confirmWithCancel:'really ?' 
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1277
    "
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1278
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1279
    "
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1280
     Transcript showCR:(
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1281
	Dialog confirmWithCancel:'really ?'
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1282
     )
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1283
    "
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1284
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1285
    "Modified: 18.10.1996 / 14:51:51 / cg"
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1286
!
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1287
1004
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1288
confirmWithCancel:aString default:default
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1289
    "launch a Dialog, which allows user to enter yes, no and cancel.
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1290
     return true for 'yes', false for 'no', nil for 'cancel'.
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1291
     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
  1292
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1293
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1294
	confirmWithCancel:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1295
		   labels:(self 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1296
			       classResources 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1297
				   array:
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1298
					#('cancel' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1299
					  'no' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1300
					  'yes')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1301
			  )
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1302
		  default:(#(nil false true) indexOf:default ifAbsent:nil)
1004
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1303
    "
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1304
     Dialog confirmWithCancel:'really ?' default:false
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1305
    "
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1306
!
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1307
1624
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1308
confirmWithCancel:aString labels:labelArray
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1309
    "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
  1310
     Return true for 'yes', false for 'no', nil for 'cancel'.
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1311
     The default is yes.
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1312
     The buttons labels are given in labelArray"
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1313
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1314
    ^ self
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1315
        confirmWithCancel:aString 
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1316
                   labels:(self 
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1317
                               classResources 
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1318
                                   array:labelArray
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1319
                          )
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1320
                  default:3
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1321
    "
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1322
     Dialog confirmWithCancel:'really ?' labels:#( 'oops' 'nope' 'yea')
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1323
    "
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1324
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1325
    "Modified: / 28.7.1998 / 21:40:40 / cg"
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1326
!
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  1327
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1328
confirmWithCancel:aString labels:buttonLabels default:default
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1329
    "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
  1330
     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
  1331
     The strings for cancel, no and yes are to be passed in
1004
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1332
     buttonLabels; 
5aeade10f64d added #confirmWithCancel:default:
ca
parents: 989
diff changeset
  1333
     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
  1334
     return button (1 to 3)"
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1335
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1336
    |box answer|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1337
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1338
    box := OptionBox title:aString numberOfOptions:3. 
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1339
    box buttonTitles:buttonLabels
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1340
	     actions:(Array with:[answer := nil]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1341
			    with:[answer := false] 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1342
			    with:[answer := true]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1343
		     ).
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1344
    default notNil ifTrue:[box defaultButtonIndex:default].
884
ef5688a6a636 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 881
diff changeset
  1345
    box label:(self classResources string:'confirm').
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1346
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1347
    box actions:nil.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1348
    box destroy.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1349
    ^ answer
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1350
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1351
    "
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1352
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1353
	confirmWithCancel:'really ?'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1354
		   labels:#('mhmh' 'maybe' 'definitely')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1355
		  default:3
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1356
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1357
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1358
    "Created: 18.10.1996 / 14:50:51 / cg"
881
76f7f4b3d4a9 confirmation box labels
Claus Gittinger <cg@exept.de>
parents: 877
diff changeset
  1359
    "Modified: 14.11.1996 / 16:06:23 / 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
  1360
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1361
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1362
!DialogBox class methodsFor:'defaults'!
573
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1363
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1364
defaultLabel
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1365
    "return the boxes default window title."
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1366
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1367
    ^ 'Dialog'
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1368
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1369
    "Created: 23.4.1996 / 17:13:10 / cg"
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1370
! !
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  1371
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1372
!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
  1373
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1374
requestDirectoryName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1375
    "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
  1376
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1377
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1378
	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
  1379
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1380
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1381
     Dialog requestDirectoryName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1382
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1383
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1384
    "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
  1385
    "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
  1386
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1387
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1388
requestDirectoryName:title
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1389
    "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
  1390
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1391
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1392
	requestDirectoryName:title 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1393
	default:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1394
	ifFail:''
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1395
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1396
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1397
     Dialog
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1398
	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
  1399
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1400
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1401
    "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
  1402
    "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
  1403
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1404
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1405
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
  1406
    "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
  1407
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1408
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1409
	requestDirectoryName:title 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1410
	default:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1411
	ifFail:''
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1412
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1413
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1414
     Dialog
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1415
	requestDirectoryName:'which directory ?' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1416
	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
  1417
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1418
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1419
    "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
  1420
    "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
  1421
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1422
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1423
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
  1424
    "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
  1425
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1426
    |dir 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
  1427
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1428
    fileBox := FileSelectionBox
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1429
		    title:title
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1430
		    okText:'ok'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1431
		    abortText:'cancel'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1432
		    action:[:fileName | enteredName := fileName].
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1433
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1434
    dir := FileSelectionBox lastFileSelectionDirectory.
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1435
    dir notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1436
	fileBox directory:dir.
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1437
    ].
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1438
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1439
    fileBox initialText:aFileName.
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1440
    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
  1441
    fileBox showAtPointer.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1442
    fileBox destroy.
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1443
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1444
    (enteredName isNil 
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1445
    or:[enteredName isEmpty]) ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1446
	^ failBlock value
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1447
    ].
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1448
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1449
    FileSelectionBox lastFileSelectionDirectory:(enteredName asFilename directoryName).
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1450
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1451
    ^ enteredName
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1452
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1453
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1454
     Dialog
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1455
	requestDirectoryName:'which directory ?' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1456
	default:'/etc'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1457
	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
  1458
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1459
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1460
    "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
  1461
    "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
  1462
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1463
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1464
requestFileName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1465
    "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
  1466
     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
  1467
     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
  1468
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1469
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1470
	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
  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
     Dialog requestFileName
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1474
    "
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
    "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
  1477
    "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
  1478
!
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
requestFileName:titleString
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1481
    "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
  1482
     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
  1483
     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
  1484
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1485
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1486
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1487
	default:'file.ext' 
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1488
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1489
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1490
     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
  1491
     Dialog requestFileName:'enter a fileName:' 
183
b40623839205 requestPassword also here
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1492
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1493
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1494
    "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
  1495
    "Modified: 19.4.1996 / 13:53:17 / cg"
118
claus
parents: 112
diff changeset
  1496
!
claus
parents: 112
diff changeset
  1497
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1498
requestFileName:titleString default:defaultName
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1499
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1500
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1501
     Return the pathname string consisting of the full pathname of the filename,
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1502
     or an empty string (if cancel was pressed)."
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1503
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1504
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1505
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1506
	default:defaultName 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1507
	version:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1508
	ifFail:''
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1509
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1510
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1511
     Dialog requestFileName:'enter a fileName:' default:''  
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1512
     Dialog requestFileName:'enter a fileName:' default:'Makefile.bak'  
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1513
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1514
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1515
    "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
  1516
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1517
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1518
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
  1519
    "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
  1520
     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
  1521
     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
  1522
     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
  1523
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1524
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1525
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1526
	default:defaultName 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1527
	version:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1528
	ifFail:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1529
	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
  1530
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1531
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1532
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1533
	requestFileName:'enter a fileName:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1534
	default:'Makefile.bak'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1535
	fromDirectory:'..'      
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1536
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1537
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1538
    "Modified: 19.4.1996 / 14:27:31 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1539
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1540
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1541
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1542
    "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
  1543
     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
  1544
     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
  1545
     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
  1546
     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
  1547
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1548
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1549
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1550
	default:defaultName
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1551
	ok:okText 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1552
	abort:abortText 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1553
	pattern:pattern
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1554
	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
  1555
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1556
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1557
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1558
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1559
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1560
	ok:'yeah' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1561
	abort:'oh, no' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1562
	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
  1563
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1564
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1565
    "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
  1566
!
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
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
  1569
    "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
  1570
     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
  1571
     current directory (if a nil path is given).
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1572
     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
  1573
     The matchPattern is set to pattern initially.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1574
     Return the string, or nil if cancel was pressed."
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1575
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1576
    |box defaultDir defaultNm dir enteredName|
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1577
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1578
    defaultNm := defaultName.
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1579
    defaultDir := aDirectoryPath.
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1580
    defaultDir isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1581
	defaultNm notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1582
	    defaultDir := defaultName asFilename directoryName.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1583
	    defaultNm := defaultNm asFilename baseName.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1584
	    defaultDir = Filename currentDirectory name ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1585
		defaultName asFilename isExplicitRelative ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1586
		    defaultDir := nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1587
		]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1588
	    ]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1589
	].
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1590
    ].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1591
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1592
    box := FileSelectionBox 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1593
	       title:titleString
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1594
	       okText:okText 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1595
	       abortText:abortText
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1596
	       action:[:fileName | enteredName := fileName].
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1597
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1598
    defaultDir notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1599
	box directory:defaultDir
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1600
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1601
	dir := FileSelectionBox lastFileSelectionDirectory.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1602
	dir notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1603
	    box directory:dir.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1604
	].
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1605
    ].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1606
    box pattern:pattern.
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1607
    box initialText:defaultNm.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1608
    box showAtPointer.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1609
    box action:nil.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1610
    box destroy.
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1611
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1612
    (enteredName notNil 
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1613
    and:[enteredName notEmpty]) ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1614
	FileSelectionBox lastFileSelectionDirectory:(enteredName asFilename directoryName).
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1615
    ].
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1616
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1617
    ^ enteredName
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1618
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1619
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1620
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1621
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1622
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1623
	ok:'yeah' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1624
	abort:'oh, no' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1625
	pattern:'rc*'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1626
	fromDirectory:'/etc'  
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1627
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1628
1360
ede30cea2827 also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1629
    "Modified: 23.10.1997 / 19:59:01 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1630
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  1631
1030
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1632
requestFileName:titleString default:defaultName pattern:pattern
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1633
    "launch a Dialog, which allows user to enter a filename.
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1634
     The files presented initially are those from the current directory.
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1635
     The box will show ok/cancel in its buttons.
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1636
     The matchPattern is set to pattern initially.
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1637
     Return the string or nil if cancel was pressed."
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1638
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1639
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1640
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1641
	default:defaultName
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1642
	ok:(self classResources string:'ok') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1643
	abort:(self classResources string:'cancel') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1644
	pattern:pattern
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1645
	fromDirectory:nil
1030
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1646
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1647
    "
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1648
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1649
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1650
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1651
	pattern:'*.st'   
1030
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1652
    "
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1653
    "
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1654
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1655
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1656
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1657
	pattern:'*.st;*.h'   
1030
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1658
    "
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1659
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1660
    "Created: 21.2.1997 / 11:16:52 / cg"
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1661
    "Modified: 21.2.1997 / 11:18:40 / cg"
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1662
!
f977fc6b85e3 comment
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1663
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1664
requestFileName:titleString default:defaultName version:versionSymbol
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1665
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1666
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1667
     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
  1668
     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
  1669
     it may be any of:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1670
	#mustBeNew      - fail (return empty string) if the file exists
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1671
	#new            - confirm if the file exists
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1672
	#mustBeOld      - fail if the file does not exist
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1673
	#old            - confirm if the file does not exist
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1674
	#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
  1675
    "
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1676
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1677
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1678
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1679
	default:defaultName 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1680
	version:versionSymbol 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1681
	ifFail:''
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1682
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1683
    "
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1684
     Dialog requestFileName:'enter a fileName:'
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1685
			default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1686
			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
  1687
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1688
     Dialog requestFileName:'enter a fileName:'
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1689
			default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1690
			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
  1691
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1692
     Dialog requestFileName:'enter a fileName:'
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1693
			default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1694
			version:#new   
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1695
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1696
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1697
    "Modified: 19.4.1996 / 13:53:58 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1698
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1699
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1700
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1701
    "launch a Dialog, which allows user to enter a filename.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1702
     The box will not allow pressing 'ok' without an entered string.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1703
     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
  1704
     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
  1705
     it may be any of:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1706
	#mustBeNew      - fail (return empty string) if the file exists
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1707
	#new            - confirm if the file exists
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1708
	#mustBeOld      - fail if the file does not exist
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1709
	#old            - confirm if the file does not exist
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1710
	#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
  1711
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1712
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1713
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1714
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1715
	default:defaultName 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1716
	version:versionSymbol 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1717
	ifFail:failBlock
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1718
	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
  1719
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1720
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1721
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1722
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1723
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1724
	version:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1725
	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
  1726
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1727
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1728
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1729
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1730
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1731
	version:#old 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1732
	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
  1733
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1734
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1735
    "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
  1736
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1737
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1738
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
  1739
    "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
  1740
     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
  1741
     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
  1742
     it may be any of:
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1743
	#mustBeNew      - fail (return empty string) if the file exists
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1744
	#new            - confirm if the file exists
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1745
	#mustBeOld      - fail if the file does not exist
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1746
	#old            - confirm if the file does not exist
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1747
	#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
  1748
    "
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1749
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1750
    ^ self requestFileName:titleString default:defaultName version:versionSymbol 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1751
	   ifFail:failBlock pattern:nil fromDirectory:aDirectoryPath
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1752
        
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1753
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1754
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1755
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1756
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1757
	version:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1758
	ifFail:['none']
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1759
	fromDirectory:'/etc'
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1760
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1761
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1762
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1763
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1764
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1765
	version:#old 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1766
	ifFail:['none']   
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1767
	fromDirectory:'/etc'
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1768
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1769
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1770
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1771
	requestFileName:'enter a fileName:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1772
	default:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1773
	version:#mustBeNew 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1774
	ifFail:['none']   
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1775
	fromDirectory:'/etc'
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1776
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1777
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1778
    "Modified: 20.2.1997 / 18:12:28 / cg"
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1779
    "Modified: 21.2.1997 / 14:27:27 / stefan"
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1780
!
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1781
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1782
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
  1783
    "launch a Dialog, which allows user to enter a filename.
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1784
     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
  1785
     The version argument allows validation of the files existance;
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1786
     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
  1787
        #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
  1788
        #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
  1789
        #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
  1790
        #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
  1791
        #any (other)    - no validation
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1792
    "
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1793
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1794
    |box defaultDir defaultNm|
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1795
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1796
    defaultNm := defaultName.
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1797
    defaultDir := aDirectoryPath.
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1798
    defaultDir isNil ifTrue:[
1575
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1799
        defaultNm notNil ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1800
            defaultName asFilename withoutSuffix baseName = '*' ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1801
                defaultDir := FileSelectionBox lastFileSelectionDirectory.
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1802
                defaultNm := ''.
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1803
            ] ifFalse:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1804
                defaultDir := defaultName asFilename directoryName.
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1805
                defaultNm := defaultNm asFilename baseName.
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1806
            ]
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1807
        ].
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1808
    ].
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1809
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1810
    box := FileSelectionBox title:titleString.
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1811
    defaultDir notNil ifTrue:[box directory:defaultDir].
1031
eec6775b6fb3 New class method:
Stefan Vogel <sv@exept.de>
parents: 1030
diff changeset
  1812
    pattern notNil ifTrue:[box pattern:pattern].
1029
ddc27f751b3d allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  1813
    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
  1814
    box action:[:name | 
1575
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1815
        versionSymbol == #mustBeNew ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1816
            "/ file may not exist
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1817
            name asFilename exists ifTrue:[^ ''].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1818
        ].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1819
        versionSymbol == #new ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1820
            "/ file may not exist
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1821
            name asFilename exists ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1822
                (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
  1823
                ifFalse:[^ ''].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1824
            ].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1825
        ].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1826
        versionSymbol == #mustBeOld ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1827
            name asFilename exists ifFalse:[^ ''].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1828
        ].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1829
        versionSymbol == #old ifTrue:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1830
            "/ file may not exist
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1831
            name asFilename exists ifFalse:[
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1832
                (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
  1833
                ifFalse:[^ ''].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1834
            ].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1835
        ].
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1836
        FileSelectionBox lastFileSelectionDirectory:box directory.
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1837
        box destroy. 
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1838
        ^ 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
  1839
    ].
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1840
    box showAtPointer.
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1841
    box action:nil.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  1842
    box destroy. 
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1843
    ^ failBlock value
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1844
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  1845
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1846
     Dialog 
1575
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1847
        requestFileName:'enter a fileName:'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1848
        default:''
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1849
        version:nil
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1850
        ifFail:['none']
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1851
        pattern:'*.conf'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1852
        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
  1853
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1854
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1855
     Dialog 
1575
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1856
        requestFileName:'enter a fileName:'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1857
        default:''
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1858
        version:#old 
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1859
        ifFail:['none']   
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1860
        pattern:'*.conf'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1861
        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
  1862
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1863
    "
549
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1864
     Dialog 
1575
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1865
        requestFileName:'enter a fileName:'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1866
        default:''
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1867
        version:#mustBeNew 
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1868
        ifFail:['none']   
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1869
        pattern:'*.conf'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1870
        fromDirectory:'/etc'
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1871
    "
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1872
a30ae9842432 use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  1873
    "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
  1874
    "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
  1875
    "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
  1876
!
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1877
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1878
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
  1879
    "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
  1880
     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
  1881
     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
  1882
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1883
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1884
	requestFileName:titleString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1885
	default:'file.ext'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1886
	version:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1887
	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
  1888
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1889
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1890
     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
  1891
     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
  1892
    "
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1893
c9d438ab85ce moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1894
    "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
  1895
    "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
  1896
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1897
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1898
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
  1899
    "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
  1900
     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
  1901
     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
  1902
     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
  1903
     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
  1904
     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
  1905
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1906
    ^ self requestFileName:titleString 
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1907
		   default:defaultName 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1908
		   version:#new 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  1909
		    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
  1910
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1911
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1912
     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
  1913
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1914
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1915
    "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
  1916
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1917
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  1918
!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
  1919
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1920
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
  1921
    "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
  1922
     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
  1923
     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
  1924
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1925
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1926
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1927
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1928
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1929
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1930
	initialAnswer:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1931
	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
  1932
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1933
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1934
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1935
	 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
  1936
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1937
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1938
    "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
  1939
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1940
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1941
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
  1942
    "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
  1943
     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
  1944
     that point.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1945
     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
  1946
     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
  1947
     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
  1948
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1949
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1950
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1951
	displayAt:aPoint 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1952
	centered:centered 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1953
	action:resultAction 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1954
	initialAnswer:initial
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1955
	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
  1956
d3fe810390cb 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
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1958
     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
  1959
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1960
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1961
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1962
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1963
	    centered:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1964
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1965
	    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
  1966
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1967
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1968
     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
  1969
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1970
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1971
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1972
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1973
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1974
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1975
	    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
  1976
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1977
     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
  1978
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1979
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1980
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1981
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1982
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1983
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1984
	    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
  1985
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1986
     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
  1987
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1988
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1989
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1990
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1991
	    centered:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1992
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  1993
	    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
  1994
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1995
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1996
    "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
  1997
    "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
  1998
!
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1999
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2000
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
  2001
    "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
  2002
     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
  2003
     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
  2004
     screen center (if centered is true).
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2005
     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
  2006
     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
  2007
     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
  2008
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2009
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2010
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2011
	displayAt:aPoint 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2012
	centered:centered 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2013
	action:resultAction 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2014
	initialAnswer:initial 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2015
	okLabel:okLabel 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2016
	cancelLabel:cancelLabel 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2017
	title:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2018
	onCancel:cancelValue
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2019
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2020
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2021
     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
  2022
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2023
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2024
	    displayAt:0@0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2025
	    centered:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2026
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2027
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2028
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2029
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2030
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2031
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2032
     centered around 200@200:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2033
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2034
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2035
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2036
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2037
	    centered:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2038
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2039
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2040
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2041
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2042
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2043
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2044
     topLeft of box at 200@200:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2045
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2046
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2047
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2048
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2049
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2050
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2051
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2052
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2053
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2054
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2055
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2056
     under mouse pointer:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2057
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2058
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2059
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2060
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2061
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2062
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2063
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2064
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2065
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2066
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2067
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2068
     centered on the screen:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2069
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2070
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2071
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2072
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2073
	    centered:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2074
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2075
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2076
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2077
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2078
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2079
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2080
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2081
    "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
  2082
    "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
  2083
!
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2084
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2085
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
  2086
    "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
  2087
     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
  2088
     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
  2089
     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
  2090
     screen center (if centered is true).
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2091
     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
  2092
     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
  2093
     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
  2094
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2095
    |box|
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2096
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2097
    box := EnterBox title:aString.
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2098
    box initialText:initial printString.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2099
    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
  2100
    okLabel notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2101
	box okText:okLabel.
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2102
    ].
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2103
    cancelLabel notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2104
	box abortText:cancelLabel 
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2105
    ].
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2106
    resultAction isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2107
	box action:[:val | box destroy. ^ val]
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2108
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2109
	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
  2110
    ].
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2111
    titleString notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2112
	box label:titleString
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2113
    ].
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2114
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2115
    aPoint notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2116
	box showAt:aPoint center:centered
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2117
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2118
	centered ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2119
	    box showAtCenter
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2120
	] ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2121
	    box showAtPointer
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2122
	]
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2123
    ].
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2124
    box destroy. 
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2125
    ^ cancelValue value.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2126
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
     centered around 200@200:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2129
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2130
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2131
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2132
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2133
	    centered:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2134
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2135
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2136
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2137
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2138
	    title:'foo'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2139
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2140
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2141
     under mouse pointer:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2142
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2143
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2144
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2145
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2146
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2147
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2148
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2149
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2150
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2151
	    title:'foo'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2152
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2153
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2154
     centered on the screen:
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2155
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2156
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2157
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2158
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2159
	    centered:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2160
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2161
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2162
	    okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2163
	    cancelLabel:'no'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2164
	    title:'foo'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2165
	    onCancel:#foo
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2166
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2167
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2168
    "Created: 29.5.1996 / 14:35:04 / cg"
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2169
    "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
  2170
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2171
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2172
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
  2173
    "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
  2174
     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
  2175
     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
  2176
     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
  2177
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2178
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2179
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2180
	displayAt:aPoint 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2181
	centered:centered 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2182
	action:resultAction 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2183
	initialAnswer:initial 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2184
	okLabel:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2185
	cancelLabel:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2186
	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
  2187
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  2188
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2189
     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
  2190
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2191
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2192
	    displayAt:0@0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2193
	    centered:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2194
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2195
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2196
	    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
  2197
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2198
     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
  2199
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2200
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2201
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2202
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2203
	    centered:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2204
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2205
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2206
	    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
  2207
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2208
     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
  2209
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2210
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2211
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2212
	    displayAt:200@200
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2213
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2214
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2215
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2216
	    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
  2217
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2218
     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
  2219
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2220
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2221
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2222
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2223
	    centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2224
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2225
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2226
	    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
  2227
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2228
     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
  2229
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2230
	 Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2231
	    request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2232
	    displayAt:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2233
	    centered:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2234
	    action:[:result | result printNewline]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2235
	    initialAnswer:'the default'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2236
	    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
  2237
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2238
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2239
    "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
  2240
    "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
  2241
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2242
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2243
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
  2244
    "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
  2245
     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
  2246
     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
  2247
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2248
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2249
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2250
	displayAt:aPoint 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2251
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2252
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2253
	initialAnswer:initial
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2254
	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
  2255
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2256
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2257
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2258
	 request:'enter a string:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2259
	 displayAt:(250 @ 250) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2260
	 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
  2261
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2262
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2263
    "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
  2264
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2265
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2266
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
  2267
    "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
  2268
     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
  2269
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2270
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2271
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2272
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2273
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2274
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2275
	initialAnswer:initial
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2276
	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
  2277
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2278
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2279
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2280
	 request:'enter a string:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2281
	 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
  2282
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2283
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2284
    "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
  2285
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2286
718
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2287
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
  2288
    "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
  2289
     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
  2290
     or cancelValue (if cancel was pressed)"
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2291
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2292
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2293
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2294
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2295
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2296
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2297
	initialAnswer:initial
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2298
	okLabel:okLabel
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2299
	cancelLabel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2300
	title:titleString
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2301
	onCancel:cancelAction
718
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2302
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2303
    "
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2304
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2305
	 request:'enter a string:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2306
	 initialAnswer:'the default'  
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2307
	 onCancel:['foooo']      
718
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2308
    "
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2309
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2310
    "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
  2311
    "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
  2312
!
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2313
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2314
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
  2315
    "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
  2316
     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
  2317
     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
  2318
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2319
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2320
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2321
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2322
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2323
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2324
	initialAnswer:initial
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2325
	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
  2326
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2327
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2328
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2329
	 request:'enter a string:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2330
	 initialAnswer:'the default'  
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2331
	 onCancel:['foooo']      
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2332
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2333
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2334
    "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
  2335
!
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2336
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2337
request:aString okLabel:okLabel
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2338
    "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
  2339
     The okButton is labelled as okLabel.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2340
     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
  2341
     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
  2342
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2343
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2344
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2345
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2346
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2347
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2348
	initialAnswer:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2349
	okLabel:okLabel
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2350
	cancelLabel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2351
	onCancel:''
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2352
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2353
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2354
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2355
	request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2356
	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
  2357
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2358
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2359
    "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
  2360
    "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
  2361
!
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2362
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2363
request:aString okLabel:okLabel onCancel:cancelValue
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2364
    "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
  2365
     The okButton is labelled as okLabel.
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2366
     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
  2367
     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
  2368
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2369
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2370
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2371
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2372
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2373
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2374
	initialAnswer:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2375
	okLabel:okLabel
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2376
	cancelLabel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2377
	onCancel:cancelValue
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2378
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2379
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2380
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2381
	request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2382
	okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2383
	onCancel:nil    
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2384
    "
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2385
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2386
    "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
  2387
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2388
718
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2389
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
  2390
    "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
  2391
     The okButton is labelled as okLabel.
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2392
     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
  2393
     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
  2394
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2395
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2396
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2397
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2398
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2399
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2400
	initialAnswer:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2401
	okLabel:okLabel
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2402
	cancelLabel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2403
	title:titleString
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2404
	onCancel:cancelValue
718
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2405
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2406
    "
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2407
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2408
	request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2409
	okLabel:'yes'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2410
	title:'foo'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2411
	onCancel:nil    
718
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2412
    "
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2413
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2414
    "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
  2415
    "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
  2416
!
bd04131f84c8 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2417
307
d3fe810390cb 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
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
  2419
    "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
  2420
     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
  2421
     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
  2422
717
816259bd3408 more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  2423
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2424
	request:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2425
	displayAt:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2426
	centered:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2427
	action:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2428
	initialAnswer:''
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2429
	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
  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
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2432
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2433
	 request:'enter a string:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2434
	 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
  2435
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2436
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2437
    "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
  2438
    "Modified: 29.5.1996 / 14:28:59 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  2439
!
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  2440
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2441
requestPassword:aString 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2442
    "launch a Dialog, which allows user to enter something invisibly.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2443
     Return the entered string (may be empty string) 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2444
     or nil (if cancel was pressed)"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  2445
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2446
    ^ EnterBox requestPassword:aString 
133
claus
parents: 132
diff changeset
  2447
claus
parents: 132
diff changeset
  2448
    "
claus
parents: 132
diff changeset
  2449
     Dialog 
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2450
	 requestPassword:'enter secret:'
133
claus
parents: 132
diff changeset
  2451
    "
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2452
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2453
    "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
  2454
! !
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2455
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  2456
!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
  2457
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2458
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
  2459
    "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
  2460
     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
  2461
     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
  2462
     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
  2463
     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
  2464
     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
  2465
     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
  2466
     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
  2467
1284
8c3f71ee81bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1102
diff changeset
  2468
    |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
  2469
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2470
    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
  2471
    (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
  2472
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2473
    list notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2474
	maxLines > list size ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2475
	    listView := ScrollableView for:SelectionInListView.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2476
	] ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2477
	    listView := SelectionInListView new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2478
	    listView level:-1.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2479
	].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2480
	listView list:list.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2481
	listView doubleClickAction:[:line | box hide. ^ listValues at:line].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2482
	box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2483
	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
  2484
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2485
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2486
    buttonLabels notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2487
	panel := HorizontalPanelView new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2488
	panel horizontalLayout:#fitSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2489
	buttonLabels keysAndValuesDo:[:index :label |
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2490
	    |b|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2491
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2492
	    b := Button label:label.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2493
	    b action:[box hide. ^ buttonValues at:index].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2494
	    panel add:b.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2495
	    box makeTabable:b.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2496
	].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2497
	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
  2498
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2499
    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
  2500
    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
  2501
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  2502
    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
  2503
    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
  2504
307
d3fe810390cb 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
    box showAtPointer.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2506
    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
  2507
    box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2508
	(answer := listView selection) notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2509
	    ^ listValues at:answer
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2510
	]
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2511
    ].
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2512
    ^ cancelBlock value
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2513
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2514
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2515
     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
  2516
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2517
	 Transcript showCR:(
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2518
	     Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2519
		choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2520
		fromList:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2521
		values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2522
		buttons:#('five' 'six' 'seven')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2523
		values:#(5 6 7)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2524
		lines:10 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2525
		cancel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2526
	 )
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2527
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2528
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2529
     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
  2530
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2531
	 Transcript showCR:(
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2532
	     Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2533
		choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2534
		fromList:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2535
		values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2536
		buttons:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2537
		values:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2538
		lines:4
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2539
		cancel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2540
	 )
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2541
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2542
558
907a0365d06a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 557
diff changeset
  2543
     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
  2544
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2545
	 Transcript showCR:(
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2546
	     Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2547
		choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2548
		fromList:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2549
		values:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2550
		buttons:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2551
		values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2552
		lines:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2553
		cancel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2554
	 )
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2555
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2556
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2557
      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
  2558
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2559
	 Transcript showCR:(
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2560
	     Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2561
		choose:'choose example' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2562
		fromList:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2563
		values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2564
		buttons:#('five' 'six' 'seven')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2565
		values:#(5 6 7)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2566
		lines:4
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2567
		cancel:[Transcript flash. #aborted]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2568
	 )
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2569
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2570
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2571
     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
  2572
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2573
	 Transcript showCR:(
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2574
	     Dialog 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2575
		choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2576
		fromList:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2577
		values:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2578
		buttons:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2579
		values:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2580
		lines:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2581
		cancel:nil
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2582
	 )
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2583
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2584
133
claus
parents: 132
diff changeset
  2585
    "
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2586
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2587
    "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
  2588
!
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2589
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2590
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
  2591
    "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
  2592
     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
  2593
     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
  2594
     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
  2595
     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
  2596
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2597
    ^ self
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2598
	choose:aString 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2599
	fromList:list 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2600
	values:listValues
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2601
	buttons:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2602
	values:nil
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2603
	lines:maxLines
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2604
	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
  2605
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2606
    "
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2607
     Transcript showCR:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2608
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2609
	    choose:'choose any' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2610
	    fromList:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2611
	    values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2612
	    lines:4
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2613
	    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
  2614
     )
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2615
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2616
     Transcript showCR:(
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2617
	 Dialog 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2618
	    choose:'choose example' 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2619
	    fromList:#('one' 'two' 'three' 'four') 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2620
	    values:#(1 2 3 4) 
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2621
	    lines:4
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  2622
	    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
  2623
     )
d3fe810390cb 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
    "
d3fe810390cb 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
d3fe810390cb 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
    "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
  2627
!
d3fe810390cb 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
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2629
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
  2630
    "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
  2631
     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
  2632
     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
  2633
     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
  2634
     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
  2635
     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
  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
    |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
  2638
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2639
    box := OptionBox title:aString numberOfOptions:buttonLabels size. 
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2640
    windowLabel notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2641
	box label:windowLabel
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2642
    ].
307
d3fe810390cb 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
    box buttonTitles:(self classResources array:buttonLabels)
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2644
	     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
  2645
    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
  2646
    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
  2647
    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
  2648
    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
  2649
    box showAtPointer.
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2650
    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
  2651
    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
  2652
    ^ 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
  2653
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2654
    "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
  2655
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2656
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2657
	choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2658
	labels:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2659
	values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2660
	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
  2661
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2662
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2663
	choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2664
	labels:#('cancel' 'foo' 'bar' 'baz') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2665
	values:#(nil foo bar baz) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2666
	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
  2667
d3fe810390cb 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
      Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2669
	choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2670
	labels:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2671
	values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2672
	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
  2673
    "
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  2674
719
574be1981be0 destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents: 718
diff changeset
  2675
    "Modified: 29.5.1996 / 15:27:32 / cg"
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2676
    "Created: 22.7.1996 / 11:44:27 / cg"
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2677
!
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2678
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2679
choose:aString labels:buttonLabels values:values default:default
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2680
    "launch a Dialog, which allows user to enter any of buttonLabels.
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2681
     Returning a corresponding value from the values-array.
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2682
     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
  2683
     return will choose that value.
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2684
     For a good userInterface style, we recommend this being the last
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2685
     entry (to make the right-most button the default button)."
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2686
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2687
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2688
	choose:aString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2689
	label:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2690
	labels:buttonLabels 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2691
	values:values 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2692
	default:default
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2693
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2694
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2695
    "no good style (default button is not the rightmost one)
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2696
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2697
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2698
	choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2699
	labels:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2700
	values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2701
	default:2 
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2702
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2703
     Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2704
	choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2705
	labels:#('cancel' 'foo' 'bar' 'baz') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2706
	values:#(nil foo bar baz) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2707
	default:#baz     
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2708
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2709
      Dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2710
	choose:'choose any' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2711
	labels:#('one' 'two' 'three' 'four') 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2712
	values:#(1 2 3 4) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2713
	default:nil 
803
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2714
    "
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2715
0719c7f6a019 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  2716
    "Modified: 22.7.1996 / 11:46:09 / cg"
100
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  2717
! !
25778412f2b0 *** empty log message ***
claus
parents: 97
diff changeset
  2718
1573
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2719
!DialogBox class methodsFor:'queries'!
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2720
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2721
defaultParentWindow
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2722
    "return a default parent (top-) window for the dialog.
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2723
     Here, the currently active view is returned, if there
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2724
     is one; otherwise, the first encountered topView is
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2725
     returned."
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2726
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2727
    |activeGroup|
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2728
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2729
    activeGroup := WindowGroup activeGroup.
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2730
    activeGroup isNil ifTrue:[
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2731
        "/ mhmh - looks like I am a background process ...
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2732
        activeGroup := Transcript windowGroup.
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2733
        activeGroup isNil ifTrue:[^ nil].
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2734
    ].
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2735
    ^ activeGroup topViews first.
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2736
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2737
    "
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2738
     self defaultParentWindow
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2739
    "
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2740
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2741
    "Modified: / 16.6.1998 / 12:36:15 / cg"
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2742
! !
63a7b74f45be added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
  2743
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2744
!DialogBox methodsFor:'accessing-behavior'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2745
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2746
abortAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2747
    "define the action to be performed when abort is pressed"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2748
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2749
    abortAction := aBlock
125
claus
parents: 122
diff changeset
  2750
!
claus
parents: 122
diff changeset
  2751
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2752
acceptCheck:aBlock
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2753
    "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
  2754
     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
  2755
     otherwise not."
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2756
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2757
    acceptCheck := aBlock
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2758
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2759
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2760
acceptOnLeave:aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2761
    "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
  2762
     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
  2763
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2764
    acceptOnLeave := aBoolean.
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  2765
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  2766
    "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
  2767
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2768
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2769
acceptReturnAsOK:aBoolean
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2770
    "turn on/off interpretation of return-key as ok.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2771
     Default is on"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2772
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2773
    acceptReturnAsOK := aBoolean.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2774
    okButton notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2775
	okButton isReturnButton:aBoolean.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2776
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2777
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2778
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2779
action:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2780
    "set the action to be performed when user presses ok-button;
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2781
     aBlock must be nil or a block. This method simply
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2782
     reuses okAction: and has been added for a consistent action-setting
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2783
     protocol."
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2784
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2785
    self okAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2786
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2787
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2788
focusOnField:anInputField
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2789
    inputFieldGroup makeActive:anInputField
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2790
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2791
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2792
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2793
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2794
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2795
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2796
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2797
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2798
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  2799
focusToOKOnLeave:aBoolean
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  2800
    "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
  2801
     or cursor key.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  2802
     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
  2803
     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
  2804
     the dialog is accepted & closed."
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  2805
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  2806
    focusToOKOnLeave := aBoolean.
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  2807
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  2808
    "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
  2809
    "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
  2810
!
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  2811
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2812
hideOnAccept:aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2813
    "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
  2814
     The default is true"
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2815
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2816
    hideOnAccept := aBoolean
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2817
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2818
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2819
makeTabable:aComponentOrSubcomponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2820
    "add a component (usually a subcomponent, of which the dialog
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2821
     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
  2822
     stepped through via FocusNext/FocusPrevious).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2823
     Toplevel tabable components are usually added with #addComponent:tabable:"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2824
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2825
    tabableElements isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2826
	tabableElements := OrderedCollection new
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2827
    ].
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2828
    (tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2829
	tabableElements add:aComponentOrSubcomponent.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2830
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2831
	(aComponentOrSubcomponent isInputField) ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2832
	    self addToInputFieldGroup:aComponentOrSubcomponent
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2833
	].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2834
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2835
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2836
    "Modified: 31.5.1996 / 21:22:13 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2837
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2838
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2839
makeTabable:aComponentOrSubcomponent before:anotherComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2840
    "add a component (usually a subcomponent, of which the dialog
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2841
     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
  2842
     stepped through via FocusNext/FocusPrevious).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2843
     Toplevel tabable components are usually added with #addComponent:tabable:"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2844
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2845
    tabableElements isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2846
	tabableElements := OrderedCollection new
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2847
    ].
989
ca2cdf005359 use #removeIdentical: - its faster.
Claus Gittinger <cg@exept.de>
parents: 953
diff changeset
  2848
    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
  2849
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2850
    anotherComponent isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2851
	tabableElements addFirst:aComponentOrSubcomponent
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2852
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2853
	tabableElements add:aComponentOrSubcomponent before:anotherComponent.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2854
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2855
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2856
    (aComponentOrSubcomponent isInputField) ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2857
	self addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2858
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2859
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  2860
    "Modified: 18.10.1997 / 03:08:20 / cg"
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  2861
!
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  2862
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  2863
makeUntabable:aComponentOrSubcomponent
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  2864
    (tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2865
	tabableElements removeIdentical:aComponentOrSubcomponent.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2866
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2867
	(aComponentOrSubcomponent isInputField) ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2868
	    self removeFromInputFieldGroup:aComponentOrSubcomponent
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2869
	].
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  2870
    ].
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  2871
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  2872
    "Modified: 18.10.1997 / 02:50:05 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2873
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  2874
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2875
okAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2876
    "define the action to be performed when ok is pressed"
133
claus
parents: 132
diff changeset
  2877
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2878
    okAction := aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2879
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2880
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2881
!DialogBox methodsFor:'accessing-components'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2882
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2883
abortButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2884
    "return the abortButton - this access is provided to allow
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2885
     setting the buttons look (for example: colors or font)"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2886
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2887
    ^ abortButton
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2888
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2889
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2890
okButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2891
    "return the okButton - this access is provided to allow
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2892
     setting the buttons look (for example: colors or font)"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2893
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2894
    ^ okButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2895
! !
155
claus
parents: 146
diff changeset
  2896
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2897
!DialogBox methodsFor:'accessing-elements'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2898
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2899
componentAt:name
680
b3ed48cfdfd4 commentary
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  2900
    "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
  2901
     named previously with #name:as:"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2902
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2903
    namedComponents isNil ifTrue:[^ nil].
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2904
    ^ namedComponents at:name ifAbsent:nil
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2905
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2906
    "Modified: 16.1.1997 / 11:40:50 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2907
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2908
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2909
inputFieldGroup
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2910
    ^ inputFieldGroup
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2911
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2912
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2913
name:element as:name
680
b3ed48cfdfd4 commentary
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  2914
    "assign a name to a component. This can be done during construction,
b3ed48cfdfd4 commentary
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  2915
     to allow later access to the components (i.e. without a need to
b3ed48cfdfd4 commentary
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  2916
     remember them in some instVars)"
b3ed48cfdfd4 commentary
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  2917
950
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2918
    namedComponents isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2919
	namedComponents := Dictionary new.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2920
    ].
950
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2921
    namedComponents at:name put:element
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2922
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2923
    "Modified: 16.1.1997 / 11:41:03 / cg"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2924
! !
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2925
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2926
!DialogBox methodsFor:'accessing-look'!
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2927
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2928
abortText:aString
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2929
    "define the label in the abort-button"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2930
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2931
    |oldSize|
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2932
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2933
    aString ~= abortButton label ifTrue:[
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2934
	oldSize := abortButton extent.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2935
	abortButton label:aString.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2936
	abortButton resize.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2937
	abortButton extent ~= oldSize ifTrue:[
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2938
	    shown ifTrue:[self resize]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2939
	]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2940
    ]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2941
!
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2942
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2943
okText:aString
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2944
    "define the text in the ok-button"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2945
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2946
    |oldSize|
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2947
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2948
    aString ~= okButton label ifTrue:[
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2949
	oldSize := okButton extent.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2950
	okButton label:aString.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2951
	okButton resize.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2952
	okButton extent ~= oldSize ifTrue:[
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2953
	    shown ifTrue:[self resize]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2954
	]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2955
    ]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2956
!
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2957
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2958
okText:okString abortText:abortString
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2959
    "set both texts displayed in the buttons"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2960
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2961
    (abortString ~= abortButton label 
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2962
    or:[okString ~= okButton label]) ifTrue:[
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2963
	okButton label:okString.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2964
	abortButton label:abortString.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2965
	okButton resize.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2966
	abortButton resize.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2967
	shown ifTrue:[self resize]
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2968
    ]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2969
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2970
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2971
!DialogBox methodsFor:'accessing-models'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  2972
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2973
accept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2974
    "return the valueHolder holding true when the box
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2975
     is accepted, false if closed via the windowManager or
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2976
     the cancel button.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2977
     This is confusing: this method was originally called #acceptValue,
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2978
     but renamed for compatibility with ST-80.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2979
     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
  2980
     is used to force an accept, not to return some valueHolder ...)."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2981
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  2982
    ^ acceptValue
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2983
!
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2984
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2985
acceptChannel:aValueHolder
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2986
    "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
  2987
     is accepted"
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2988
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  2989
    acceptValue := aValueHolder
950
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2990
!
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2991
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2992
aspectAt:anAspectSymbol put:aDataModel
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2993
    "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
  2994
     requires that a corresponding dataModel has been set (usually during
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2995
     initialization) via the #aspectAt:put: message.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2996
     Allows users of boxes to access individual values - especially useful,
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2997
     in multi-field dialogs."
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2998
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  2999
    bindings isNil ifTrue:[bindings := IdentityDictionary new].
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3000
    bindings at:anAspectSymbol put:aDataModel
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3001
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3002
    "Created: 16.1.1997 / 11:38:46 / cg"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3003
    "Modified: 16.1.1997 / 11:41:28 / cg"
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3004
!
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3005
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3006
aspectFor:anAspectSymbol
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3007
    "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
  3008
     requires that a corresponding dataModel has been set (usually during
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3009
     initialization) via the #aspectAt:put: message.
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3010
     Allows users of boxes to access individual values - especially useful,
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3011
     in multi-field dialogs."
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3012
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3013
    bindings isNil ifTrue:[^ nil].
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3014
    ^ bindings at:anAspectSymbol ifAbsent:nil
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3015
09baff873688 added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  3016
    "Modified: 16.1.1997 / 11:41:34 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3017
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3018
120
claus
parents: 118
diff changeset
  3019
!DialogBox methodsFor:'construction-adding'!
claus
parents: 118
diff changeset
  3020
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3021
addComponent:aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3022
    "add any component with its preferred height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3023
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3024
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3025
    ^ self addComponent:aComponent indent:nil tabable:false
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3026
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3027
    "Modified: 9.2.1996 / 22:22:41 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3028
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3029
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3030
addComponent:aComponent indent:indent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3031
    "add any component with its preferred height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3032
     The indent is temporarily changed to indent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3033
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3034
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3035
    ^ self addComponent:aComponent indent:indent tabable:false
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3036
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3037
    "Modified: 9.2.1996 / 22:22:44 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3038
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3039
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3040
addComponent:aComponent indent:indent tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3041
    "add any component with its preferred height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3042
     The indent is temporarily changed to indent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3043
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3044
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3045
    |oldLeft oldRight result|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3046
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3047
    oldLeft := leftIndent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3048
    oldRight := rightIndent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3049
    indent notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3050
	leftIndent := rightIndent := indent.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3051
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3052
    result := self addComponent:aComponent tabable:tabable tabbedComponent:aComponent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3053
    leftIndent := oldLeft.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3054
    rightIndent := oldRight.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3055
    ^ result
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3056
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3057
    "Modified: 9.2.1996 / 22:22:50 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3058
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3059
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3060
addComponent:aComponent indent:indent withExtent:ext 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3061
    "add any component with some given extent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3062
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3063
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3064
    |fullSize lI rI|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3065
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3066
    indent isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3067
	lI := leftIndent.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3068
	rI := rightIndent.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3069
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3070
	lI := rI := indent
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3071
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3072
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3073
    self basicAddComponent:aComponent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3074
    fullSize := ext + (lI + rI @ 0).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3075
    aComponent extent:fullSize.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3076
    aComponent origin:0.0@yPosition; 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3077
	       leftInset:lI; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3078
	       rightInset:rI.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3079
    yPosition := yPosition + aComponent height + ViewSpacing.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3080
    width := fullSize x max:width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3081
    needResize := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3082
    ^ aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3083
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3084
    "Modified: 9.2.1996 / 22:22:54 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3085
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3086
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3087
addComponent:aComponent indent:indent withHeight:height 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3088
    "add any component with some given height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3089
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3090
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3091
    |lI rI|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3092
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3093
    indent isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3094
	lI := leftIndent.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3095
	rI := rightIndent.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3096
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3097
	lI := rI := indent
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3098
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3099
    self basicAddComponent:aComponent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3100
    aComponent height:height.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3101
    aComponent origin:0.0@yPosition; 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3102
	       width:1.0; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3103
	       leftInset:lI;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3104
	       rightInset:rI.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3105
    yPosition := yPosition + "aComponent" height + ViewSpacing.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3106
    needResize := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3107
    ^ aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3108
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3109
    "Modified: 9.2.1996 / 22:22:58 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3110
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3111
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3112
addComponent:aComponent tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3113
    "add any component with its preferred height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3114
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3115
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3116
    ^ self addComponent:aComponent tabable:tabable tabbedComponent:aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3117
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3118
    "Modified: 9.2.1996 / 22:23:04 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3119
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3120
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3121
addComponent:aComponent tabable:tabable tabbedComponent:subComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3122
    "add any component with its preferred height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3123
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3124
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3125
    tabable ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3126
	tabableElements isNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3127
	    tabableElements := OrderedCollection new
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3128
	].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3129
	tabableElements add:subComponent
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3130
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3131
    ^ self addComponent:aComponent 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3132
	   withHeight:(aComponent preferredExtent y).
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3133
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3134
    "Modified: 9.2.1996 / 22:23:07 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3135
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3136
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3137
addComponent:aComponent withExtent:ext 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3138
    "add any component with some given extent.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3139
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3140
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3141
    ^ self addComponent:aComponent indent:nil withExtent:ext
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3142
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3143
    "Modified: 9.2.1996 / 22:23:11 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3144
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3145
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3146
addComponent:aComponent withHeight:height 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3147
    "add any component with some given height and full width.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3148
     Returns the component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3149
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3150
    ^ self addComponent:aComponent indent:nil withHeight:height
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3151
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3152
    "Modified: 9.2.1996 / 22:23:15 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3153
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3154
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3155
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
  3156
    "add a label and some view side-by-side.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3157
     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
  3158
     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
  3159
     The inputField gets model as its model.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3160
     Return the inputField."
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3161
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3162
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3163
	addLabelledField:aView 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3164
	label:labelString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3165
	adjust:labelAdjust 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3166
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3167
	from:leftX to:rightX separateAtX:relativeX 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3168
	nameAs:nil
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3169
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3170
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3171
     |dialog model field|
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3172
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3173
     model := '' asValue.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3174
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3175
     dialog := DialogBox new.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3176
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3177
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3178
		addLabelledField:(EditField on:model) label:'input here:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3179
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3180
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3181
		separateAtX:0.3.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3182
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3183
     dialog addAbortButton; addOkButton.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3184
     dialog open.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3185
     dialog accepted ifTrue:[Transcript showCR:model value].
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3186
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3187
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3188
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3189
     |dialog model field|
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3190
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3191
     model := SelectionInList new.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3192
     model list:#('foo' 'bar' 'baz').
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3193
     model selectionIndex:2.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3194
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3195
     dialog := DialogBox new.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3196
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3197
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3198
		addLabelledField:(PopUpList on:model) label:'select here:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3199
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3200
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3201
		separateAtX:0.3.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3202
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3203
     dialog addAbortButton; addOkButton.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3204
     dialog open.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3205
     dialog accepted ifTrue:[Transcript showCR:model value].
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3206
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3207
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3208
    "Created: 3.6.1996 / 11:03:24 / cg"
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3209
    "Modified: 17.7.1996 / 15:04:07 / cg"
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3210
!
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3211
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3212
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
  3213
    "add a label and some view side-by-side.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3214
     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
  3215
     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
  3216
     The inputField gets model as its model.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3217
     Return the inputField."
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3218
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3219
    |y lbl max relW|
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3220
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3221
    y := self yPosition.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3222
    lbl := Label label:labelString.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3223
    max := lbl preferredExtent y max:(aView preferredExtent y).
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3224
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3225
    relW := rightX - leftX.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3226
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3227
    self addComponent:lbl indent:leftIndent withHeight:max.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3228
    lbl rightInset:0.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3229
    lbl 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3230
	width:(relW*relativeX); 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3231
	left:leftX; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3232
	adjust:labelAdjust; borderWidth:0.
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3233
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3234
    self yPosition:y.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3235
    self addComponent:aView tabable:tabable.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3236
    aView 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3237
	leftInset:ViewSpacing; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3238
	rightInset:ViewSpacing.
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3239
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3240
    aView 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3241
	width:relW*(1.0 - relativeX); 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3242
	left:leftX+(relW*relativeX).
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3243
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3244
    aView isInputField ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3245
	self addToInputFieldGroup:aView
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3246
    ].
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3247
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3248
    aName notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3249
	self name:lbl as:(aName , '.label').
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3250
	self name:aView as:aName
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3251
    ].
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3252
    ^ aView
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3253
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3254
    "
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3255
     |dialog model field|
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3256
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3257
     model := '' asValue.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3258
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3259
     dialog := DialogBox new.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3260
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3261
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3262
		addLabelledField:(EditField on:model) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3263
		label:'input here:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3264
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3265
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3266
		separateAtX:0.3.
807
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3267
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3268
     dialog addAbortButton; addOkButton.
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3269
     dialog open.
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3270
     dialog accepted ifTrue:[Transcript showCR:model value].
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3271
    "
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3272
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3273
    "
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3274
     |dialog model field|
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3275
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3276
     model := '' asValue.
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3277
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3278
     dialog := DialogBox new.
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3279
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3280
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3281
		addLabelledField:((ComboListView on:model) list:#('foo' 'bar' 'baz'))
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3282
		label:'select foo:'
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3283
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3284
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3285
		separateAtX:0.3.
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3286
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3287
     dialog addAbortButton; addOkButton.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3288
     dialog open.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3289
     dialog accepted ifTrue:[Transcript showCR:model value].
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3290
    "
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3291
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3292
    "
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3293
     |dialog model field|
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3294
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3295
     model := SelectionInList new.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3296
     model list:#('foo' 'bar' 'baz').
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3297
     model selectionIndex:2.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3298
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3299
     dialog := DialogBox new.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3300
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3301
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3302
		addLabelledField:(PopUpList on:model) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3303
		label:'select here:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3304
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3305
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3306
		separateAtX:0.3.
795
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3307
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3308
     dialog addAbortButton; addOkButton.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3309
     dialog open.
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3310
     dialog accepted ifTrue:[Transcript showCR:model value].
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3311
    "
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3312
eee477a6587a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 792
diff changeset
  3313
    "Created: 17.7.1996 / 15:03:32 / cg"
807
3f9980053be4 another example
Claus Gittinger <cg@exept.de>
parents: 803
diff changeset
  3314
    "Modified: 26.7.1996 / 18:11:12 / cg"
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3315
!
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3316
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3317
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable separateAtX:relativeX
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3318
    "add a label and some view side-by-side.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3319
     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
  3320
     The labels string is defined by labelString and adjusted according to labelAdjust.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3321
     The inputField gets model as its model.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3322
     Return the inputField."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3323
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3324
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3325
	addLabelledField:aView 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3326
	label:labelString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3327
	adjust:labelAdjust 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3328
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3329
	from:0.0 to:1.0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3330
	separateAtX:relativeX
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3331
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3332
"/    |y lbl max|
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3333
"/
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3334
"/    y := self yPosition.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3335
"/    lbl := Label label:labelString.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3336
"/    max := lbl preferredExtent y max:(aView preferredExtent y).
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3337
"/
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3338
"/    self addComponent:lbl indent:leftIndent withHeight:max.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3339
"/    lbl rightInset:0.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3340
"/    lbl width:relativeX; adjust:labelAdjust; borderWidth:0.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3341
"/
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3342
"/    self yPosition:y.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3343
"/    self addComponent:aView tabable:tabable.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3344
"/    aView leftInset:ViewSpacing; rightInset:ViewSpacing.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3345
"/    aView width:(1.0 - relativeX); left:relativeX.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3346
"/
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3347
"/    aView isInputField ifTrue:[
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3348
"/        self addToInputFieldGroup:aView
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3349
"/    ].
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3350
"/
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3351
"/    ^ aView
593
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
     |dialog model field|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3355
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3356
     model := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3357
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3358
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3359
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3360
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3361
		addLabelledField:(EditField on:model) label:'input here:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3362
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3363
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3364
		separateAtX:0.3.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3365
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3366
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3367
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3368
     dialog accepted ifTrue:[Transcript showCR:model value].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3369
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3370
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3371
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3372
     |dialog model field|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3373
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3374
     model := SelectionInList new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3375
     model list:#('foo' 'bar' 'baz').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3376
     model selectionIndex:2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3377
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3378
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3379
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3380
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3381
		addLabelledField:(PopUpList on:model) label:'select here:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3382
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3383
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3384
		separateAtX:0.3.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3385
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3386
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3387
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3388
     dialog accepted ifTrue:[Transcript showCR:model value].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3389
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3390
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3391
    "Created: 13.4.1996 / 13:41:31 / cg"
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  3392
    "Modified: 3.6.1996 / 18:48:49 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3393
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3394
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3395
addTextLabel:aString
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3396
    "create a text label - the name has been choosen for ST-80 compatibility;
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3397
     however, ST/X labels allow image labels too.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3398
     Returns the label."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3399
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3400
    |l|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3401
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3402
    l := Label new label:aString.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3403
    l borderWidth:0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3404
    self addComponent:l.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3405
    ^ l
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3406
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3407
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3408
     |b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3409
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3410
     b := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3411
     b addTextLabel:'hello'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3412
     b showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3413
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3414
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3415
     |b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3416
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3417
     b := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3418
     b leftIndent:100.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3419
     b addTextLabel:'hello'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3420
     b leftIndent:0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3421
     b addTextLabel:'world'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3422
     b showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3423
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3424
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3425
     |b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3426
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3427
     b := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3428
     b addTextLabel:'hello'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3429
     b addTextLabel:'world'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3430
     b addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3431
     b showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3432
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3433
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3434
     |b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3435
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3436
     b := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3437
     b addTextLabel:'hello'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3438
     (b addTextLabel:'world') foregroundColor:Color red.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3439
     b addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3440
     b showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3441
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3442
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3443
     |b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3444
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3445
     b := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3446
     b addTextLabel:'hello world\\How about this ?' withCRs.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3447
     b addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3448
     b showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3449
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3450
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3451
     |b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3452
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3453
     b := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3454
     b addTextLabel:'hello world\\How about this ?' withCRs.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3455
     b addTextLabel:'not bad'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3456
     b addAbortButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3457
     b addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3458
     b showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3459
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3460
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3461
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3462
addToInputFieldGroup:aComponentOrSubcomponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3463
    "add a component to the input group.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3464
     The argument, aComponentOrSubcomponent may even be a nested subcomponent of
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3465
     a topLevel component."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3466
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3467
    self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3468
	addToInputFieldGroup:aComponentOrSubcomponent before:nil
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3469
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3470
    "Modified: 18.10.1997 / 03:09:17 / cg"
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3471
!
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3472
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3473
addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3474
    "add a component to the input group.
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3475
     The argument, aComponentOrSubcomponent may even be a nested subcomponent of
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3476
     a topLevel component."
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3477
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3478
    inputFieldGroup isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3479
	inputFieldGroup := EnterFieldGroup new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3480
	inputFieldGroup leaveAction:[self lastFieldLeft].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3481
	aComponentOrSubcomponent hasKeyboardFocus:true.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3482
    ].
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3483
    inputFieldGroup add:aComponentOrSubcomponent before:anotherComponent.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3484
    self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3485
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3486
"/    inputFields isNil ifTrue:[
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3487
"/        inputFields := OrderedCollection new.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3488
"/
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3489
"/        "/ 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
  3490
"/
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3491
"/        aComponentOrSubcomponent showCursor.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3492
"/        aComponentOrSubcomponent hasKeyboardFocus:true.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3493
"/    ] ifFalse:[
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3494
"/        aComponentOrSubcomponent hideCursor.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3495
"/        aComponentOrSubcomponent hasKeyboardFocus:false.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3496
"/    ].
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3497
"/    inputFields add:aComponentOrSubcomponent
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3498
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3499
    "Modified: 18.10.1997 / 02:47:20 / cg"
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3500
    "Created: 18.10.1997 / 03:08:51 / cg"
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3501
!
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3502
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3503
removeFromInputFieldGroup:aComponentOrSubcomponent
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3504
    "remove a component from the input group.
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3505
     The argument, aComponentOrSubcomponent may even be a nested subcomponent of
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3506
     a topLevel component."
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3507
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3508
    inputFieldGroup isNil ifTrue:[^ self].
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3509
    inputFieldGroup remove:aComponentOrSubcomponent.
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3510
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  3511
    "Created: 18.10.1997 / 02:51:30 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3512
! !
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3513
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3514
!DialogBox methodsFor:'construction-buttons'!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3515
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3516
addAbortButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3517
    "create an abortButton - to be sent from redefined initialize
162
claus
parents: 157
diff changeset
  3518
     methods in subclasses or when creating a box programmatically.
claus
parents: 157
diff changeset
  3519
     Returns the button."
claus
parents: 157
diff changeset
  3520
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3521
    ^ self addAbortButtonLabelled:nil
122
claus
parents: 121
diff changeset
  3522
!
120
claus
parents: 118
diff changeset
  3523
162
claus
parents: 157
diff changeset
  3524
addAbortButton:aButton 
claus
parents: 157
diff changeset
  3525
    "add an already created abortButton - to be sent from redefined initialize
claus
parents: 157
diff changeset
  3526
     methods in subclasses or when creating a box programmatically.
claus
parents: 157
diff changeset
  3527
     Returns the button."
claus
parents: 157
diff changeset
  3528
claus
parents: 157
diff changeset
  3529
    abortButton := aButton.
claus
parents: 157
diff changeset
  3530
    aButton model:self; change:#abortPressed.
claus
parents: 157
diff changeset
  3531
    ^ self addButton:aButton.
claus
parents: 157
diff changeset
  3532
claus
parents: 157
diff changeset
  3533
    "Created: 17.9.1995 / 20:17:26 / claus"
claus
parents: 157
diff changeset
  3534
!
claus
parents: 157
diff changeset
  3535
122
claus
parents: 121
diff changeset
  3536
addAbortButtonLabelled:buttonLabel
claus
parents: 121
diff changeset
  3537
    "create an abortButton with a label - to be sent from redefined initialize
claus
parents: 121
diff changeset
  3538
     methods in subclasses or when creating a box programmatically.
claus
parents: 121
diff changeset
  3539
     A nil argument creates one with the default label.
claus
parents: 121
diff changeset
  3540
     Returns the button."
claus
parents: 121
diff changeset
  3541
162
claus
parents: 157
diff changeset
  3542
    |aButton|
claus
parents: 157
diff changeset
  3543
claus
parents: 157
diff changeset
  3544
    aButton := Button abortButton.
claus
parents: 157
diff changeset
  3545
    buttonLabel notNil ifTrue:[aButton label:buttonLabel].
claus
parents: 157
diff changeset
  3546
    ^ self addAbortButton:aButton
claus
parents: 157
diff changeset
  3547
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3548
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3549
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3550
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3551
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3552
     dialog addAbortButtonLabelled:'get out of here'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3553
     dialog addOkButtonLabelled:'yes thats ok'.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3554
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3555
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3556
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3557
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3558
    "Modified: 9.2.1996 / 22:09:40 / cg"
120
claus
parents: 118
diff changeset
  3559
!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  3560
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3561
addButton:aButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3562
    "add a button into the buttonPanel.
122
claus
parents: 121
diff changeset
  3563
     Returns the button."
120
claus
parents: 118
diff changeset
  3564
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3565
    ^ self addButton:aButton after:nil
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3566
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3567
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3568
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3569
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3570
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3571
     dialog addAbortButton.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3572
     dialog addButton:(Button label:'foo' action:[Transcript showCR:'foo']).
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3573
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3574
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3575
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3576
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3577
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3578
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3579
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3580
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3581
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3582
     dialog addAbortButton.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3583
     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
  3584
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3585
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3586
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3587
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3588
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3589
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3590
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3591
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3592
     dialog := DialogBox new.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3593
     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
  3594
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3595
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3596
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3597
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3598
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3599
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3600
    "Modified: 9.2.1996 / 22:14:17 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3601
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3602
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3603
addButton:aButton after:someOtherButtonOrNil
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3604
    "add a button into the buttonPanel.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3605
     If the argument someOtherButtonOrNil is nil, the button is
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3606
     added at the end."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3607
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3608
    |h|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3609
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3610
    buttonPanel addSubView:aButton after:someOtherButtonOrNil.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3611
    buttonPanel subViews size > 1 ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3612
	buttonPanel horizontalLayout:#fitSpace.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3613
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3614
    (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3615
	 buttonPanel topInset:h negated
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3616
    ].
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3617
    needResize := true.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3618
    ^ aButton
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  3619
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3620
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3621
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3622
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3623
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3624
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3625
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3626
     dialog addButton:(Button 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3627
			label:'foo' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3628
			action:[dialog hide. Transcript showCR:'foo'])
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3629
		after:(dialog okButton).
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3630
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3631
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3632
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3633
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3634
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3635
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3636
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3637
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3638
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3639
     dialog addButton:(Button 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3640
			label:'foo' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3641
			action:[dialog hide. Transcript showCR:'foo'])
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3642
		after:(dialog abortButton).
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3643
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3644
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3645
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3646
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3647
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3648
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3649
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3650
     dialog addAbortButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3651
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3652
     dialog addButton:(Button 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3653
			label:'foo' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3654
			action:[dialog hide. Transcript showCR:'foo'])
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3655
		after:nil.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3656
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3657
     dialog accepted ifTrue:[Transcript showCR:'yes'].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3658
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3659
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3660
    "Modified: 9.2.1996 / 22:13:51 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3661
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3662
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3663
addButton:aButton before:someOtherButtonOrNil
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3664
    "add a button into the buttonPanel.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3665
     If the argument someOtherButtonOrNil is nil, the button is
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3666
     added upFront."
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3667
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3668
    |h|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3669
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3670
    buttonPanel addSubView:aButton before:someOtherButtonOrNil.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3671
    buttonPanel subViews size > 1 ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3672
	buttonPanel horizontalLayout:#fitSpace.
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3673
    ].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3674
    (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3675
	 buttonPanel topInset:h negated
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3676
    ].
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3677
    needResize := true.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3678
    ^ aButton
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3679
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3680
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3681
     |dialog|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3682
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3683
     dialog := DialogBox new.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3684
     dialog addAbortButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3685
     dialog addOkButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3686
     dialog addButton:(Button 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3687
			label:'foo' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3688
			action:[dialog hide. Transcript showCR:'foo'])
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3689
		before:(dialog okButton).
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3690
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3691
     dialog accepted ifTrue:[Transcript showCR:'yes'].
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3692
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3693
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3694
     |dialog|
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3695
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3696
     dialog := DialogBox new.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3697
     dialog addAbortButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3698
     dialog addOkButton.
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3699
     dialog addButton:(Button 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3700
			label:'foo' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3701
			action:[dialog hide. Transcript showCR:'foo'])
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3702
		before:nil.
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3703
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3704
     dialog accepted ifTrue:[Transcript showCR:'yes'].
353
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3705
    "
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3706
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3707
    "Modified: 9.2.1996 / 22:13:51 / cg"
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3708
    "Created: 10.2.1996 / 16:04:35 / cg"
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3709
!
f93d08174b61 added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
  3710
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3711
addHelpButtonFor:pathToHelpText 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3712
    "add a help button to the buttonPanel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3713
     The argument, pathToHelpText should specify the path to the help
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3714
     text under either the doc/online/<language> or the help/<language>
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3715
     directory."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3716
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3717
    |helpButton|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3718
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3719
    helpButton := Button label:(resources string:'help').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3720
    helpButton action:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3721
	self withWaitCursorDo:[HTMLDocumentView openFullOnHelpFile:pathToHelpText]].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3722
    ^ self addButton:helpButton before:nil.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3723
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3724
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3725
     |box|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3726
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3727
     box := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3728
     box 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3729
	addHelpButtonFor:'Launcher/compilerSettings.html';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3730
	addAbortButton; 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3731
	addOkButton.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3732
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3733
     box open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3734
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3735
659
423ebd648403 use new documentView
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3736
    "Modified: 20.5.1996 / 20:30:55 / cg"
831
8af010be0a02 Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents: 807
diff changeset
  3737
    "Modified: 9.9.1996 / 22:40:21 / stefan"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3738
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3739
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3740
addOkButton
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3741
    "create an okButton - to be sent from redefined initialize
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3742
     methods in subclasses or when creating a box programmatically.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3743
     Returns the button."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3744
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3745
    ^ self addOkButtonLabelled:nil
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3746
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3747
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3748
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3749
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3750
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3751
     dialog addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3752
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3753
     dialog accepted ifTrue:[Transcript showCR:'yes'].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3754
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3755
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3756
    "Modified: 9.2.1996 / 21:37:02 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3757
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3758
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3759
addOkButton:aButton 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3760
    "add an already created okButton - to be sent from redefined initialize
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3761
     methods in subclasses or when creating a box programmatically.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3762
     Returns the button."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3763
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3764
    okButton := aButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3765
    aButton model:self; change:#okPressed.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3766
    ^ self addButton:aButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3767
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3768
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3769
     |dialog b|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3770
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3771
     b := Button label:((Image fromFile:'garfield.gif') magnifiedBy:0.5).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3772
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3773
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3774
     dialog addOkButton:b.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3775
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3776
     dialog accepted ifTrue:[Transcript showCR:'yes'].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3777
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3778
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3779
    "Modified: 17.9.1995 / 20:20:41 / claus"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3780
    "Modified: 9.2.1996 / 21:38:48 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3781
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3782
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3783
addOkButtonLabelled:buttonLabel 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3784
    "create an okButton with a label - to be sent from redefined initialize
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3785
     methods in subclasses or when creating a box programmatically.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3786
     A nil argument creates one with the default text.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3787
     Returns the button."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3788
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3789
    |aButton|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3790
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3791
    aButton := Button okButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3792
    buttonLabel notNil ifTrue:[aButton label:buttonLabel].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3793
    aButton isReturnButton:acceptReturnAsOK.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3794
    ^ self addOkButton:aButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3795
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3796
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3797
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3798
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3799
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3800
     dialog addOkButtonLabelled:'get out of here'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3801
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3802
     dialog accepted ifTrue:[Transcript showCR:'yes'].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3803
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3804
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3805
    "Modified: 9.2.1996 / 21:39:34 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3806
! !
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3807
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3808
!DialogBox methodsFor:'construction-check & comboboxes'!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3809
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3810
addCheckBox:label on:aModel
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3811
    "create a checkBox with label on aModel and add it.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3812
     Returns the box."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3813
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3814
    ^ self addCheckBox:label on:aModel tabable:true
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 check|
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
     check := true asValue.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3820
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3821
     dialog := DialogBox new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3822
     dialog addCheckBox:'on or off' on:check.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3823
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3824
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  3825
     dialog accepted ifTrue:[Transcript showCR:check value].
344
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
    "Modified: 9.2.1996 / 22:15:38 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3829
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  3830
600
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3831
addCheckBox:label on:aModel tabable:tabable
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3832
    "create a checkBox with label on aModel and add it.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3833
     Returns the box."
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3834
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3835
    |b|
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3836
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3837
    b := CheckBox on:aModel.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3838
    b label:label.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3839
    self addComponent:b tabable:tabable.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3840
    ^ b
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3841
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3842
    "
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3843
     |dialog check1 check2 check3|
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3844
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3845
     check1 := true asValue.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3846
     check2 := false asValue.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3847
     check3 := true asValue.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3848
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3849
     dialog := DialogBox new.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3850
     dialog addCheckBox:'on or off' on:check1 tabable:false.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3851
     dialog addHorizontalLine.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3852
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3853
     dialog addCheckBox:'on or off' on:check2 tabable:true.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3854
     dialog addCheckBox:'on or off' on:check3 tabable:true.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3855
     dialog addOkButton.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3856
     dialog open.
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3857
    "
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3858
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3859
    "Modified: 9.2.1996 / 22:16:49 / cg"
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3860
!
0b7fd1d7b0a9 comments
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
  3861
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3862
addComboBoxOn:aModel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3863
    "create a comboBoxView on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3864
     Returns the comboBoxView."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3865
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3866
    ^ self addComboBoxOn:aModel tabable:true
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3867
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3868
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3869
     without a list, the comboBox is disabled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3870
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3871
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3872
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3873
     val := 'some input' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3874
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3875
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3876
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3877
     (box addTextLabel:'combo box example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3878
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3879
     (box addComboBoxOn:val).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3880
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3881
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3882
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3883
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3884
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3885
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3886
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3887
    "with a list, it can be pulled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3888
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3889
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3890
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3891
     val := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3892
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3893
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3894
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3895
     (box addTextLabel:'combo box example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3896
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3897
     (box addComboBoxOn:val) list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3898
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3899
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3900
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3901
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3902
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3903
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3904
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3905
    "Modified: 28.2.1996 / 15:17:39 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3906
    "Created: 4.3.1996 / 17:21:45 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3907
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3908
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3909
addComboBoxOn:aModel tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3910
    "create a comboBoxView on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3911
     Returns the comboBoxView."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3912
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3913
    |f|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3914
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3915
    f := ComboBoxView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3916
    f model:aModel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3917
    self addComponent:f tabable:tabable.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3918
    tabable ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3919
	self addToInputFieldGroup:f editor.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3920
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3921
    ^ f
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3922
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  3923
    "
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3924
     without a list, the comboBox is disabled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3925
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3926
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3927
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3928
     val := 'some input' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3929
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3930
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3931
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3932
     (box addTextLabel:'combo box example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3933
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3934
     (box addComboBoxOn:val tabable:true).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3935
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3936
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3937
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3938
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3939
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3940
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3941
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3942
    "with a list, it can be pulled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3943
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3944
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3945
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3946
     val := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3947
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3948
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3949
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3950
     (box addTextLabel:'combo box example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3951
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3952
     (box addComboBoxOn:val tabable:true) list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3953
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3954
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3955
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3956
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3957
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3958
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3959
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3960
    "Modified: 4.3.1996 / 17:21:57 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3961
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3962
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3963
addComboListOn:aModel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3964
    "create a comboListView on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3965
     Returns the comboListView."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3966
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3967
    ^ self addComboListOn:aModel tabable:true 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3968
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3969
    "without a list, the comboList is disabled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3970
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3971
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3972
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3973
     val := 'some input' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3974
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3975
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3976
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3977
     (box addTextLabel:'combo list example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3978
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3979
     (box addComboListOn:val).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3980
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3981
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3982
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  3983
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3984
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3985
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3986
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3987
    "with a list, it can be pulled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3988
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3989
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3990
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3991
     val := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3992
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3993
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3994
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3995
     (box addTextLabel:'combo box example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3996
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3997
     (box addComboListOn:val) list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3998
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  3999
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4000
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4001
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4002
     ].
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
    "Created: 28.2.1996 / 15:16:34 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4006
    "Modified: 4.3.1996 / 17:22:59 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4007
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4008
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4009
addComboListOn:aModel tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4010
    "create a comboListView on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4011
     Returns the comboListView."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4012
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4013
    |f|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4014
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4015
    f := ComboListView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4016
    f model:aModel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4017
    self addComponent:f tabable:tabable.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4018
    ^ f
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4019
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4020
    "without a list, the comboList is disabled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4021
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4022
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4023
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4024
     val := 'some input' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4025
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4026
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4027
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4028
     (box addTextLabel:'combo list example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4029
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4030
     (box addComboListOn:val tabable:true).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4031
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4032
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4033
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4034
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4035
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4036
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4037
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4038
    "with a list, it can be pulled:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4039
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4040
     |box val|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4041
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4042
     val := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4043
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4044
     box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4045
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4046
     (box addTextLabel:'combo box example') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4047
     box addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4048
     (box addComboListOn:val tabable:true) list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4049
     box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4050
     box open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4051
     box accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4052
	Transcript showCR:val value
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4053
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4054
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4055
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4056
    "Created: 28.2.1996 / 15:16:34 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4057
    "Modified: 4.3.1996 / 17:23:38 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4058
! !
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4059
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4060
!DialogBox methodsFor:'construction-inputfields'!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4061
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4062
addFilenameInputFieldOn:aModel in:aDirectory tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4063
    "create a fileName input field on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4064
     Returns the field. This is much like a normal input field,
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4065
     but supports filename completion."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4066
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4067
    |f|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4068
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4069
    f := FilenameEditField new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4070
    aDirectory notNil ifTrue:[f directory:aDirectory].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4071
    f model:aModel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4072
    self addInputField:f tabable:tabable.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4073
    ^ f
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4074
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4075
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4076
addInputField:aField
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4077
    "add an already created input field.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4078
     Returns the field."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4079
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4080
    ^ self addInputField:aField tabable:true
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4081
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4082
    "Modified: 9.2.1996 / 20:46:16 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4083
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4084
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4085
addInputField:aField tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4086
    "add an already created input field.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4087
     If tabable is true, the field is put into a group, to allow
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4088
     stepping through the fields with #Cursor/#Return keys.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4089
     Returns the field."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4090
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4091
    self addComponent:aField tabable:tabable.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4092
    tabable ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4093
	self addToInputFieldGroup:aField.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4094
    ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4095
    ^ aField
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4096
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  4097
    "Modified: 31.5.1996 / 21:22:29 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4098
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4099
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4100
addInputFieldOn:aModel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4101
    "create an input field on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4102
     Returns the field."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4103
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4104
    ^ self addInputFieldOn:aModel tabable:true
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4105
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4106
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4107
     |dialog model field|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4108
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4109
     model := '' asValue.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4110
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4111
     dialog := DialogBox new.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4112
     (dialog addTextLabel:'enter a string') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4113
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4114
     field := dialog addInputFieldOn:model.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4115
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4116
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4117
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4118
     dialog accepted ifTrue:[Transcript showCR:model value].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4119
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4120
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4121
    "Modified: 9.2.1996 / 21:34:14 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4122
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4123
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4124
addInputFieldOn:aModel tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4125
    "create an input field on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4126
     If tabable is false, the field cannot be tabbed into
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4127
     and return does not close the box.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4128
     (pointer must be moved into it).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4129
     Returns the field."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4130
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4131
    |f|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4132
913
d3318d34a1d0 More #positionOffset fixes.
Stefan Vogel <sv@exept.de>
parents: 912
diff changeset
  4133
    f := EditField model:aModel.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4134
    self addInputField:f tabable:tabable.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4135
    ^ f
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4136
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4137
    " a non-tabable field:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4138
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4139
     |dialog model field|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4140
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4141
     model := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4142
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4143
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4144
     (dialog addTextLabel:'enter a string') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4145
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4146
     field := dialog addInputFieldOn:model tabable:false.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4147
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4148
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4149
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4150
     dialog accepted ifTrue:[Transcript showCR:model value].
593
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
    "Modified: 9.2.1996 / 21:36:16 / cg"
913
d3318d34a1d0 More #positionOffset fixes.
Stefan Vogel <sv@exept.de>
parents: 912
diff changeset
  4154
    "Modified: 3.1.1997 / 10:24:04 / stefan"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4155
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4156
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4157
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
  4158
    "add a label and an inputField side-by-side.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4159
     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
  4160
     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
  4161
     The inputField gets model as its model.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4162
     Return the inputField."
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4163
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4164
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4165
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4166
	addLabelledField:(EditField on:model) label:labelString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4167
	adjust:labelAdjust
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4168
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4169
	from:leftX to:rightX
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4170
	separateAtX:relativeX.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4171
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4172
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4173
     |dialog model field|
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4174
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4175
     model := '' asValue.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4176
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4177
     dialog := DialogBox new.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4178
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4179
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4180
		addLabelledInputField:'enter a string' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4181
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4182
		on:model 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4183
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4184
		separateAtX:0.3.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4185
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4186
     dialog addAbortButton; addOkButton.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4187
     dialog open.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4188
     dialog accepted ifTrue:[Transcript showCR:model value].
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4189
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4190
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4191
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4192
     |dialog model1 model2 field|
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4193
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4194
     model1 := '' asValue.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4195
     model2 := '' asValue.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4196
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4197
     dialog := DialogBox new.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4198
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4199
     dialog addTextLabel:'a two-input box'.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4200
     dialog addHorizontalLine.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4201
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4202
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4203
		addLabelledInputField:'string1:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4204
		adjust:#right 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4205
		on:model1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4206
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4207
		separateAtX:0.4.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4208
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4209
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4210
		addLabelledInputField:'string2:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4211
		adjust:#right 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4212
		on:model2 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4213
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4214
		separateAtX:0.4.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4215
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4216
     dialog addAbortButton; addOkButton.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4217
     dialog open.
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4218
     dialog accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4219
	Transcript showCR:model1 value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4220
	Transcript showCR:model2 value.
745
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4221
     ].
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4222
    "
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4223
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4224
    "Modified: 19.4.1996 / 17:39:46 / cg"
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4225
    "Created: 3.6.1996 / 11:04:23 / cg"
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4226
!
9838e65744d0 allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  4227
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4228
addLabelledInputField:labelString adjust:labelAdjust on:model tabable:tabable separateAtX:relativeX
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4229
    "add a label and an inputField side-by-side.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4230
     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
  4231
     The labels string is defined by labelString and adjusted according to labelAdjust.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4232
     The inputField gets model as its model.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4233
     Return the inputField."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4234
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4235
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4236
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4237
	addLabelledField:(EditField on:model) label:labelString 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4238
	adjust:labelAdjust
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4239
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4240
	separateAtX:relativeX.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4241
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4242
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4243
     |dialog model field|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4244
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4245
     model := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4246
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4247
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4248
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4249
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4250
		addLabelledInputField:'enter a string' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4251
		adjust:#left 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4252
		on:model 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4253
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4254
		separateAtX:0.3.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4255
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4256
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4257
     dialog open.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4258
     dialog accepted ifTrue:[Transcript showCR:model value].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4259
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4260
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4261
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4262
     |dialog model1 model2 field|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4263
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4264
     model1 := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4265
     model2 := '' asValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4266
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4267
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4268
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4269
     dialog addTextLabel:'a two-input box'.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4270
     dialog addHorizontalLine.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4271
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4272
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4273
		addLabelledInputField:'string1:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4274
		adjust:#right 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4275
		on:model1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4276
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4277
		separateAtX:0.4.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4278
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4279
     field := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4280
		addLabelledInputField:'string2:' 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4281
		adjust:#right 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4282
		on:model2 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4283
		tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4284
		separateAtX:0.4.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4285
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4286
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4287
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4288
     dialog accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4289
	Transcript showCR:model1 value.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4290
	Transcript showCR:model2 value.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4291
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4292
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4293
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4294
    "Created: 13.4.1996 / 13:41:31 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4295
    "Modified: 19.4.1996 / 17:39:46 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4296
! !
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4297
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4298
!DialogBox methodsFor:'construction-layout'!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4299
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4300
addHorizontalLine
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4301
    "add a horizontal line as separator"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4302
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4303
    ^ self addComponent:(Separator new extent:1.0 @ 5).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4304
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4305
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4306
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4307
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4308
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4309
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4310
	addTextLabel:'some title string';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4311
	addHorizontalLine;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4312
	addTextLabel:'more text';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4313
	addOkButton;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4314
	open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4315
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4316
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4317
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4318
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4319
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4320
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4321
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4322
	addTextLabel:'some title string';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4323
	addHorizontalLine;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4324
	addTextLabel:'more text'.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4325
     (dialog addHorizontalLine) width:20.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4326
     dialog addTextLabel:'more text'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4327
     (dialog addHorizontalLine) width:20.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4328
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4329
	addTextLabel:'more text';
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4330
	addHorizontalLine;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4331
	addOkButton;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4332
	open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4333
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4334
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4335
    "Modified: 19.4.1996 / 15:11:30 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4336
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4337
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4338
addVerticalSpace
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4339
    "add a default vertical space (1 mm)"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4340
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4341
    self addVerticalSpace:(ViewSpacing).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4342
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4343
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4344
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4345
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4346
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4347
     dialog addTextLabel:'some title string'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4348
     dialog addVerticalSpace.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4349
     dialog addTextLabel:'more text'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4350
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4351
     dialog addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4352
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4353
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4354
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4355
    "Modified: 9.2.1996 / 21:41:10 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4356
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4357
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4358
addVerticalSpace:nPixel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4359
    "add some pixels of space to the next component"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4360
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4361
    yPosition := yPosition + nPixel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4362
    needResize := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4363
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4364
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4365
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4366
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4367
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4368
     dialog addTextLabel:'some title string'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4369
     dialog addVerticalSpace:50.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4370
     dialog addTextLabel:'more text'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4371
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4372
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4373
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4374
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4375
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4376
    "Modified: 9.2.1996 / 21:41:23 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4377
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4378
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4379
leftIndent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4380
    "return the current indent 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4381
     (current x position - thats where the next component will be located)."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4382
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4383
    ^ leftIndent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4384
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4385
    "Modified: 27.1.1996 / 18:21:31 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4386
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4387
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4388
leftIndent:aNumber 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4389
    "set the left indent (current x position - thats where the next component
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4390
     will be located)."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4391
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4392
    leftIndent := aNumber.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4393
    needResize := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4394
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4395
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4396
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4397
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4398
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4399
     (dialog addTextLabel:'label1') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4400
     dialog leftIndent:20.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4401
     (dialog addTextLabel:'label2') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4402
     dialog leftIndent:40.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4403
     (dialog addTextLabel:'label3') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4404
     dialog leftIndent:60.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4405
     (dialog addTextLabel:'label4') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4406
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4407
     dialog addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4408
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4409
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4410
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4411
    "Modified: 9.2.1996 / 21:42:20 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4412
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4413
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4414
rightIndent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4415
    "return the current right indent."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4416
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4417
    ^ rightIndent
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: 27.1.1996 / 18:21:31 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4420
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4421
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4422
rightIndent:aNumber 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4423
    "set the right indent"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4424
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4425
    rightIndent := aNumber.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4426
    needResize := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4427
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4428
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4429
     |dialog|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4430
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4431
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4432
     (dialog addTextLabel:'label1') adjust:#right.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4433
     dialog rightIndent:20.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4434
     (dialog addTextLabel:'label2') adjust:#right.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4435
     dialog rightIndent:40.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4436
     (dialog addTextLabel:'label3') adjust:#right.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4437
     dialog rightIndent:60.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4438
     (dialog addTextLabel:'label4') adjust:#right.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4439
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4440
     dialog addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4441
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4442
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4443
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4444
    "Modified: 9.2.1996 / 21:42:46 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4445
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4446
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4447
stickAtBottomWithFixHeight:aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4448
    "arrange for a component to be positioned at a constant offset
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4449
     from the bottom of the box and its height to remain the same.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4450
     This will keep the component at a constant distance from the bottom
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4451
     (without this setup, it would stay at a constant offset from the top)"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4452
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4453
    self resize.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4454
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4455
    aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4456
	topInset:(self height - aComponent top) negated;
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4457
	bottomInset:(self height - aComponent bottom); 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4458
	origin:0.0 @ 1.0; corner:1.0 @ 1.0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4459
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4460
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4461
     compare the resizing behavior of:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4462
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4463
	|box|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4464
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4465
	box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4466
	box addTextLabel:'hello'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4467
	box addTextLabel:'hello2'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4468
	box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4469
	box show
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4470
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4471
     with:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4472
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4473
	|box l2|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4474
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4475
	box := Dialog new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4476
	box addTextLabel:'hello'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4477
	l2 := box addTextLabel:'hello2'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4478
	box addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4479
	box stickAtBottomWithFixHeight:l2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4480
	box show
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4481
   "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4482
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4483
    "Created: 27.1.1996 / 17:17:41 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4484
    "Modified: 27.1.1996 / 18:29:03 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4485
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4486
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4487
stickAtBottomWithVariableHeight:aComponent
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4488
    "arrange for a component to be positioned at a constant offset
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4489
     from the bottom of the box and its height to be adjusted.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4490
     This will resize the component for a constant distance from the top,
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4491
     and the bottom.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4492
     (without this setup, its height would remain constant)"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4493
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4494
    self resize.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4495
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4496
    aComponent
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4497
	bottomInset:(self height - aComponent bottom); 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4498
	corner:1.0@1.0.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4499
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4500
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4501
     compare the resizing behavior of:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4502
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4503
	|box|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4504
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4505
	box := Dialog new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4506
	box addTextLabel:'hello'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4507
	(box addComponent:(SelectionInListView new)) level:-1.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4508
	box addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4509
	box show
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4510
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4511
     with:
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4512
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4513
	|box list|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4514
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4515
	box := Dialog new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4516
	box addTextLabel:'hello'.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4517
	list := (box addComponent:(SelectionInListView new)) level:-1.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4518
	box addOkButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4519
	box stickAtBottomWithVariableHeight:list.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4520
	box show
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
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4523
    "Modified: 27.4.1996 / 18:34:20 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4524
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4525
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4526
yPosition 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4527
    "return the current y position (thats where the next component
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4528
     will be located)."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4529
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4530
    ^ yPosition 
120
claus
parents: 118
diff changeset
  4531
!
claus
parents: 118
diff changeset
  4532
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4533
yPosition:aNumber 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4534
    "set the current y position (thats where the next component
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4535
     will be located)."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4536
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4537
    yPosition := aNumber.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4538
    needResize := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4539
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4540
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4541
     |dialog pos|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4542
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4543
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4544
     pos := dialog yPosition.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4545
     (dialog addTextLabel:'label1') width:0.5.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4546
     dialog yPosition:pos.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4547
     (dialog addTextLabel:'label2') width:0.5; left:0.5.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4548
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4549
     dialog addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4550
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4551
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4552
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4553
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4554
     |dialog pos|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4555
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4556
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4557
     pos := dialog yPosition.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4558
     #('one' 'two' 'three' 'four') 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4559
     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
  4560
	 dialog yPosition:pos.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4561
	(dialog addComponent:(Button label:lbl) tabable:true)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4562
		width:0.25; left:x.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4563
     ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4564
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4565
     dialog addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4566
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4567
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4568
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4569
    "Modified: 9.2.1996 / 21:46:40 / cg"
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
!DialogBox methodsFor:'construction-lists'!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4573
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4574
addListBoxOn:aModel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4575
    "add a selectionInListView to the box.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4576
     The listViews ScrollWrapper is returned"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4577
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4578
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4579
	addListBoxOn:aModel 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4580
	withNumberOfLines:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4581
	hScrollable:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4582
	vScrollable:true. 
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4583
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4584
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4585
     |dialog model listView|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4586
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4587
     model := SelectionInList new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4588
     model list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4589
     model selectionIndex:2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4590
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4591
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4592
     (dialog addTextLabel:'select any') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4594
     listView := dialog addListBoxOn:model.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4595
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4596
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4597
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4598
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4599
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4600
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4601
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4602
    "Modified: 27.4.1996 / 18:27:58 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4603
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4604
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4605
addListBoxOn:aModel class:aListViewClass
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4606
    "create & add an instance of aListViewClass to the box.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4607
     The listViews ScrollWrapper is returned"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4608
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4609
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4610
	addListBoxOn:aModel
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4611
	class:aListViewClass
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4612
	withNumberOfLines:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4613
	hScrollable:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4614
	vScrollable:true.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4615
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4616
    "Created: 19.4.1996 / 13:06:14 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4617
    "Modified: 27.4.1996 / 18:27:53 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4618
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4619
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4620
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4621
    "create and add an instance of aListViewClass to the box.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4622
     The list has numLines (if nonNil) number of lines shown.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4623
     The listViews ScrollWrapper is returned"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4624
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4625
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4626
	addListBoxOn:aModel
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4627
	class:aListViewClass
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4628
	withNumberOfLines:numLines 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4629
	hScrollable:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4630
	vScrollable:true.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4631
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4632
    "Created: 19.4.1996 / 13:05:05 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4633
    "Modified: 27.4.1996 / 18:27:48 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4634
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4635
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4636
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
  4637
    "add an instance of aListViewClass (selectionInListView) to the box.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4638
     The list has numLines (if nonNil) number of lines shown.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4639
     If scrolled, the ScrollWrapper is returned - otherwise the listView."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4640
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4641
    |l|
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4642
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4643
    l := self addTextBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4644
    l doubleClickAction:[:name | self okPressed].
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4645
    ^ l
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4646
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4647
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4648
     |dialog listView|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4649
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4650
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4651
     (dialog addTextLabel:'select any') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4652
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4653
     listView := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4654
			addListBoxOn:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4655
			class:FileSelectionList
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4656
			withNumberOfLines:10 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4657
			hScrollable:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4658
			vScrollable:false.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4659
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4660
     listView directory:'/etc'.
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 addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4663
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4664
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4665
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView selectionValue].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4666
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4667
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4668
    "Created: 22.2.1996 / 15:40:07 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4669
    "Modified: 27.4.1996 / 18:26:15 / cg"
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4670
    "Modified: 15.6.1996 / 00:31:20 / stefan"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4671
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4672
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4673
addListBoxOn:aModel withNumberOfLines:numLines
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4674
    "add a selectionInListView to the box.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4675
     The list has numLines (if nonNil) number of lines shown.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4676
     The listViews ScrollWrapper is returned"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4677
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4678
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4679
	addListBoxOn:aModel 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4680
	withNumberOfLines:numLines 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4681
	hScrollable:false 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4682
	vScrollable:true. 
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4683
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4684
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4685
     |dialog model listView|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4686
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4687
     model := SelectionInList new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4688
     model list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4689
     model selectionIndex:2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4690
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4691
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4692
     (dialog addTextLabel:'select any') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4693
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4694
     listView := dialog addListBoxOn:model withNumberOfLines:3.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4695
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4696
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4697
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4698
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4699
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4700
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4701
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4702
    "Created: 22.2.1996 / 15:40:07 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4703
    "Modified: 27.4.1996 / 18:27:42 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4704
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4705
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4706
addListBoxOn:aModel withNumberOfLines:numLines hScrollable:hs vScrollable:vs
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4707
    "add a selectionInListView to the box.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4708
     The list has numLines (if nonNil) number of lines shown.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4709
     If scrolled, the ScrollWrapper is returned - otherwise the listView."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4710
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4711
    ^ self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4712
	addListBoxOn:aModel 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4713
	class:SelectionInListView
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4714
	withNumberOfLines:numLines 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4715
	hScrollable:hs 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4716
	vScrollable:vs
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4717
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4718
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4719
     |dialog model listView|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4720
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4721
     model := SelectionInList new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4722
     model list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4723
     model selectionIndex:2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4724
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4725
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4726
     (dialog addTextLabel:'select any') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4727
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4728
     listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:true vScrollable:true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4729
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4730
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4731
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4732
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4733
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4734
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4735
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4736
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4737
     |dialog model listView|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4738
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4739
     model := SelectionInList new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4740
     model list:#('one' 'two' 'three' 'four').
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4741
     model selectionIndex:2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4742
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4743
     dialog := DialogBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4744
     (dialog addTextLabel:'select any') adjust:#left.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4745
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4746
     listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:false vScrollable:false.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4747
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4748
     dialog addAbortButton; addOkButton.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4749
     dialog open.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4750
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  4751
     dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4752
    "
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4753
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4754
    "Created: 22.2.1996 / 15:40:07 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4755
    "Modified: 27.4.1996 / 18:26:36 / cg"
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4756
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4757
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4758
addPopUpList:labelString on:aModel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4759
    "create a popUpList with a label on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4760
     Returns the box."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4761
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4762
    ^ self addPopUpList:labelString on:aModel tabable:true
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4763
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4764
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4765
addPopUpList:labelString on:aModel tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4766
    "create a popUpList on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4767
     Returns the popUpList."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4768
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4769
    |p box l|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4770
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4771
    p := PopUpList on:aModel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4772
    p resize; sizeFixed:true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4773
    labelString notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4774
	box := HorizontalPanelView new.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4775
	box borderWidth:0; horizontalLayout:#rightSpace.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4776
	box add:(l := Label label:labelString).
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4777
	l borderWidth:0.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4778
	box add:p.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4779
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4780
	box := p.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4781
    ].        
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4782
    self addComponent:box tabable:tabable tabbedComponent:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4783
    ^ p
735
2552463a8f34 place popUp at right (without extra space)
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
  4784
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  4785
    "Modified: 31.5.1996 / 21:25:17 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4786
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4787
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4788
addPopUpListOn:aModel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4789
    "create a popUpList on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4790
     Returns the box."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4791
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4792
    ^ self addPopUpList:nil on:aModel tabable:true
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4793
!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4794
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4795
addPopUpListOn:aModel tabable:tabable
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4796
    "create a popUpList on aModel and add it.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4797
     Returns the popUpList."
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4798
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4799
    ^ self addPopUpList:nil on:aModel tabable:tabable
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4800
!
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4801
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4802
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
  4803
    "add an instance of aListViewClass to the box.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4804
     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
  4805
     If scrolled, the ScrollWrapper is returned - otherwise the listView."
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4806
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4807
    |l scr h dH|
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4808
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4809
    l := aListViewClass new.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4810
    l model:aModel.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4811
877
b451fa6920d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  4812
    (vs or:[hs]) ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4813
	hs ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4814
	    scr := HVScrollableView forView:l miniScrollerH:true .
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4815
	] ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4816
	    scr := ScrollableView forView:l
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4817
	].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4818
	scr resize.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4819
	"/ Transcript show:scr height; show:' '; showCR:l height.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4820
	dH := scr height - l height.
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4821
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4822
	l level:-1.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4823
	scr := l.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4824
	dH := 0.
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4825
    ].
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4826
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4827
    numLines notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4828
	h := l heightForLines:numLines.
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4829
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4830
	h := l preferredExtent y
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4831
    ].
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4832
    self addComponent:scr withHeight:(h + dH).
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4833
    ^ scr
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4834
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4835
    "
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4836
     |dialog listView|
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4837
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4838
     dialog := DialogBox new.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4839
     (dialog addTextLabel:'select any') adjust:#left.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4840
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4841
     listView := dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4842
			addTextBoxOn:nil 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4843
			class:EditTextView
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4844
			withNumberOfLines:10 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4845
			hScrollable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4846
			vScrollable:true.
766
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4847
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4848
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4849
     dialog addAbortButton; addOkButton.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4850
     dialog open.
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4851
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4852
     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
  4853
    "
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4854
9d223713d4fc Allow text boxes as elements.
Stefan Vogel <sv@exept.de>
parents: 745
diff changeset
  4855
    "Created: 14.6.1996 / 23:33:47 / stefan"
877
b451fa6920d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  4856
    "Modified: 8.11.1996 / 15:31:15 / cg"
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4857
! !
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4858
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4859
!DialogBox methodsFor:'construction-rows & columns'!
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
  4860
130
claus
parents: 128
diff changeset
  4861
addColumn:aRow fromX:leftX toX:rightX collect:aBlock
claus
parents: 128
diff changeset
  4862
    "add some elements in a vertical column.
claus
parents: 128
diff changeset
  4863
     Equally space elements as returned from aBlock."
claus
parents: 128
diff changeset
  4864
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4865
    self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4866
	addColumn:aRow 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4867
	fromX:leftX toX:rightX 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4868
	collect:aBlock 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4869
	tabable:false
130
claus
parents: 128
diff changeset
  4870
claus
parents: 128
diff changeset
  4871
    "
claus
parents: 128
diff changeset
  4872
     |dialog|
claus
parents: 128
diff changeset
  4873
claus
parents: 128
diff changeset
  4874
     dialog := Dialog new.
claus
parents: 128
diff changeset
  4875
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4876
	addColumn:#('label1' 'label2' 'lbl3' 'l4' 'label5')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4877
	fromX:0.0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4878
	toX:1.0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4879
	collect:[:label | Label label:label].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4880
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4881
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4882
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4883
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4884
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4885
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4886
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4887
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4888
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4889
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4890
	addColumn:#('label1' 'label2' 'label3' 'label4' 'label5')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4891
	fromX:0.25 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4892
	toX:0.75
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4893
	collect:[:label | (Label label:label) adjust:#left].
130
claus
parents: 128
diff changeset
  4894
claus
parents: 128
diff changeset
  4895
     dialog addOkButton.
claus
parents: 128
diff changeset
  4896
     dialog open.
claus
parents: 128
diff changeset
  4897
    "
claus
parents: 128
diff changeset
  4898
claus
parents: 128
diff changeset
  4899
    "
claus
parents: 128
diff changeset
  4900
     |dialog y|
claus
parents: 128
diff changeset
  4901
claus
parents: 128
diff changeset
  4902
     dialog := Dialog new.
claus
parents: 128
diff changeset
  4903
     y := dialog yPosition.
claus
parents: 128
diff changeset
  4904
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4905
	addColumn:#('a1' 'b1' 'c1' 'd1')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4906
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4907
	toX:(1/3) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4908
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  4909
claus
parents: 128
diff changeset
  4910
     dialog yPosition:y.
claus
parents: 128
diff changeset
  4911
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4912
	addColumn:#('a2' 'b2' 'c2' 'd2')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4913
	fromX:(1/3)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4914
	toX:(2/3) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4915
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  4916
claus
parents: 128
diff changeset
  4917
     dialog yPosition:y.
claus
parents: 128
diff changeset
  4918
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4919
	addColumn:#('a3' 'b3' 'c3' 'd3')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4920
	fromX:(2/3)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4921
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4922
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  4923
claus
parents: 128
diff changeset
  4924
     dialog addOkButton.
claus
parents: 128
diff changeset
  4925
     dialog open.
claus
parents: 128
diff changeset
  4926
    "
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4927
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4928
    "Modified: 9.2.1996 / 22:22:12 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4929
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4930
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4931
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4932
    "add some elements in a vertical column.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4933
     Equally space elements as returned from aBlock."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4934
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4935
    self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4936
	addColumn:aRow 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4937
	fromX:leftX toX:rightX 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4938
	collect:aBlock 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4939
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4940
	horizontalLayout:#fitSpace 
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4941
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4942
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4943
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4944
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4945
     values := (1 to:4) collect:[:dummy | '' asValue].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4946
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4947
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4948
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4949
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4950
	addColumn:#('one' 'two' 'three' 'four')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4951
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4952
	toX:0.3 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4953
	collect:[:label | Label label:label].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4954
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4955
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4956
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4957
	addColumn:values
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4958
	fromX:0.3
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4959
	toX:1.0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4960
	collect:[:value | EditField on:value]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4961
	tabable:true.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4962
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4963
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4964
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4965
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4966
     dialog accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4967
	Transcript showCR:(values collect:[:holder | holder value])
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4968
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4969
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4970
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4971
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4972
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4973
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4974
     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
  4975
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4976
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4977
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4978
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4979
	addColumn:(1 to:4)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4980
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4981
	toX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4982
	collect:[:idx | CheckToggle on:(values at:idx)]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4983
	tabable:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4984
	horizontalLayout:#center.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4985
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4986
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4987
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4988
	addColumn:(5 to:8) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4989
	fromX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4990
	toX:1.0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4991
	collect:[:idx | CheckToggle on:(values at:idx)]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4992
	tabable:true
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4993
	horizontalLayout:#center.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4994
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4995
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4996
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4997
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  4998
     dialog accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  4999
	Transcript showCR:(values collect:[:holder | holder value])
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5000
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5001
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5002
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5003
    "Created: 9.2.1996 / 21:51:47 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5004
    "Modified: 9.2.1996 / 22:22:02 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5005
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5006
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5007
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
  5008
    "add some elements in a vertical column.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5009
     Equally space elements as returned from aBlock."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5010
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5011
    |helper component|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5012
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5013
    helper := VerticalPanelView new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5014
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5015
    aRow do:[:el |
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5016
	component := aBlock value:el.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5017
	helper add:component.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5018
	component resize.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5019
	tabable ifTrue:[self makeTabable:component].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5020
    ].    
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5021
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5022
    helper resize.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5023
    self addComponent:helper.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5024
    width < helper preferredExtent x ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5025
	self width:helper preferredExtent x.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5026
	"/ Transcript show:'w now: '; showCR:helper preferredExtent x
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5027
    ].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5028
    helper horizontalLayout:hLayout.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5029
    helper left:leftX asFloat;
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5030
	   right:rightX asFloat;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5031
	   leftInset:leftIndent;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5032
	   rightInset:rightIndent.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5033
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5034
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5035
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5036
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5037
     values := (1 to:4) collect:[:dummy | '' asValue].
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5038
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5039
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5040
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5041
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5042
	addColumn:#('one' 'two' 'three' 'four')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5043
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5044
	toX:0.3 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5045
	collect:[:label | Label label:label].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5046
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5047
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5048
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5049
	addColumn:values
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5050
	fromX:0.3
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5051
	toX:1.0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5052
	collect:[:value | EditField on:value]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5053
	tabable:true.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5054
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5055
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5056
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5057
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5058
     dialog accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5059
	Transcript showCR:(values collect:[:holder | holder value])
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5060
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5061
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5062
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5063
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5064
     |dialog y values|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5065
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5066
     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
  5067
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5068
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5069
     y := dialog yPosition.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5070
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5071
	addColumn:(1 to:4)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5072
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5073
	toX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5074
	collect:[:idx | CheckToggle on:(values at:idx)].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5075
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5076
     dialog yPosition:y.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5077
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5078
	addColumn:(5 to:8) 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5079
	fromX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5080
	toX:1.0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5081
	collect:[:idx | CheckToggle on:(values at:idx)]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5082
	tabable:true.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5083
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5084
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5085
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5086
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5087
     dialog accepted ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5088
	Transcript showCR:(values collect:[:holder | holder value])
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5089
     ]
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5090
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5091
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5092
    "Modified: 9.2.1996 / 22:02:22 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5093
    "Created: 9.2.1996 / 22:20:31 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5094
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5095
130
claus
parents: 128
diff changeset
  5096
addRow:aCol fromX:leftX toX:rightX collect:aBlock
claus
parents: 128
diff changeset
  5097
    "add some elements in a horizontal row.
claus
parents: 128
diff changeset
  5098
     Equally space elements as returned from aBlock.
claus
parents: 128
diff changeset
  5099
     Advance y."
claus
parents: 128
diff changeset
  5100
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5101
    self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5102
	addRow:aCol 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5103
	fromX:leftX toX:rightX 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5104
	collect:aBlock 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5105
	tabable:true 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5106
	horizontalLayout:#spread 
130
claus
parents: 128
diff changeset
  5107
claus
parents: 128
diff changeset
  5108
    "
claus
parents: 128
diff changeset
  5109
     |dialog|
claus
parents: 128
diff changeset
  5110
claus
parents: 128
diff changeset
  5111
     dialog := Dialog new.
claus
parents: 128
diff changeset
  5112
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5113
	addRow:#('a' 'b' 'c' 'd')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5114
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5115
	toX:1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5116
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  5117
claus
parents: 128
diff changeset
  5118
     dialog addOkButton.
claus
parents: 128
diff changeset
  5119
     dialog open.
claus
parents: 128
diff changeset
  5120
    "
claus
parents: 128
diff changeset
  5121
claus
parents: 128
diff changeset
  5122
    "
claus
parents: 128
diff changeset
  5123
     |dialog|
claus
parents: 128
diff changeset
  5124
claus
parents: 128
diff changeset
  5125
     dialog := Dialog new.
claus
parents: 128
diff changeset
  5126
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5127
	addRow:#('a1' 'b1' 'c1' 'd1')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5128
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5129
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5130
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  5131
claus
parents: 128
diff changeset
  5132
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5133
	addRow:#('a2' 'b2' 'c2' 'd2')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5134
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5135
	toX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5136
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  5137
claus
parents: 128
diff changeset
  5138
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5139
	addRow:#('a3' 'b3' 'c3' 'd3')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5140
	fromX:0.5
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5141
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5142
	collect:[:label | Label label:label].
130
claus
parents: 128
diff changeset
  5143
claus
parents: 128
diff changeset
  5144
     dialog addOkButton.
claus
parents: 128
diff changeset
  5145
     dialog open.
claus
parents: 128
diff changeset
  5146
    "
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5147
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5148
    "Modified: 9.2.1996 / 22:25:16 / cg"
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
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5152
    "add some elements in a horizontal row.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5153
     Equally space elements as returned from aBlock.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5154
     Advance y."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5155
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5156
    self 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5157
	addRow:aCol 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5158
	fromX:leftX toX:rightX 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5159
	collect:aBlock 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5160
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5161
	horizontalLayout:#spread
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5162
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5163
    "Created: 9.2.1996 / 22:25:35 / cg"
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5164
!
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5165
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5166
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
  5167
    "add some elements in a horizontal row.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5168
     Equally space elements as returned from aBlock.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5169
     Advance y."
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5170
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5171
    ^ self
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5172
	addRow:aCol 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5173
	fromX:leftX toX:rightX 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5174
	collect:aBlock 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5175
	tabable:tabable 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5176
	horizontalLayout:hLayout
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5177
	verticalLayout:#fit
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5178
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5179
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5180
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5181
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5182
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5183
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5184
	addRow:#('a' 'b' 'c' 'd')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5185
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5186
	toX:1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5187
	collect:[:label | Label label:label]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5188
	tabable:false
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5189
	horizontalLayout:#fit.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5190
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5191
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5192
     dialog open.
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
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
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5197
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5198
     dialog := Dialog new.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5199
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5200
	addRow:#('one' 'two' 'three' 'four')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5201
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5202
	toX:1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5203
	collect:[:label | Button label:label]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5204
	tabable:false
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5205
	horizontalLayout:#fit.
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5206
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5207
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5208
     dialog open.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5209
    "
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
    "
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5212
     |dialog|
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5213
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5214
     dialog := Dialog new.
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
	addRow:#('a1' 'b1' 'c1' 'd1')
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:1 
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 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5222
	addRow:#('a2' 'b2' 'c2' 'd2')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5223
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5224
	toX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5225
	collect:[:label | Label label:label].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5226
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5227
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5228
	addRow:#('a3' 'b3' 'c3' 'd3')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5229
	fromX:0.5
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5230
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5231
	collect:[:label | Label label:label].
344
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5232
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5233
     dialog addOkButton.
f0532d8a40f8 more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
  5234
     dialog open.
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
    "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
  5238
    "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
  5239
!
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5240
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5241
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
  5242
    "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
  5243
     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
  5244
     Advance y."
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5245
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5246
    |helper component|
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5247
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5248
    helper := HorizontalPanelView new.
792
c6953d727789 care for 2D look
Claus Gittinger <cg@exept.de>
parents: 766
diff changeset
  5249
    helper borderWidth:0.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5250
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5251
    aCol do:[:el |
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5252
	component := aBlock value:el.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5253
	component resize.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5254
	helper add:component.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5255
	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
  5256
    ].    
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5257
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5258
    helper resize.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5259
    self addComponent:helper.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5260
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5261
    width < helper preferredExtent x ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5262
	self width:helper preferredExtent x.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5263
	"/ 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
  5264
    ].
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5265
    hLayout notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5266
	helper horizontalLayout:hLayout.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5267
    ].
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5268
    vLayout notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5269
	helper verticalLayout:vLayout.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5270
    ].
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5271
    helper left:leftX asFloat;
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5272
	   right:rightX asFloat.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5273
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5274
    "
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5275
     |dialog|
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5276
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5277
     dialog := Dialog new.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5278
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5279
	addRow:#('a' 'b' 'c' 'd')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5280
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5281
	toX:1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5282
	collect:[:label | Label label:label]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5283
	tabable:false
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5284
	horizontalLayout:#fit.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5285
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5286
     dialog addOkButton.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5287
     dialog open.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5288
    "
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5289
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5290
    "
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5291
     |dialog|
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5292
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5293
     dialog := Dialog new.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5294
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5295
	addRow:#('one' 'two' 'three' 'four')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5296
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5297
	toX:1
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5298
	collect:[:label | Button label:label]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5299
	tabable:false
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5300
	horizontalLayout:#fit.
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5301
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5302
     dialog addOkButton.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5303
     dialog open.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5304
    "
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5305
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5306
    "
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5307
     |dialog|
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5308
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5309
     dialog := Dialog new.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5310
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5311
	addRow:#('a1' 'b1' 'c1' 'd1')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5312
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5313
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5314
	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
  5315
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5316
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5317
	addRow:#('a2' 'b2' 'c2' 'd2')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5318
	fromX:0
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5319
	toX:0.5 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5320
	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
  5321
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5322
     dialog 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5323
	addRow:#('a3' 'b3' 'c3' 'd3')
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5324
	fromX:0.5
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5325
	toX:1 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5326
	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
  5327
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5328
     dialog addOkButton.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5329
     dialog open.
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5330
    "
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5331
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5332
    "Created: 31.5.1996 / 20:45:31 / cg"
792
c6953d727789 care for 2D look
Claus Gittinger <cg@exept.de>
parents: 766
diff changeset
  5333
    "Modified: 17.7.1996 / 12:06:08 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5334
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5335
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5336
!DialogBox methodsFor:'explicit focus control'!
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5337
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5338
focusOnOk
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5339
    windowGroup focusView:okButton
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5340
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5341
    "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
  5342
! !
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5343
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5344
!DialogBox methodsFor:'initialization'!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5345
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5346
focusSequence
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5347
    "return the elements through which we can step via 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5348
     NextField/PreviousField keys.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5349
     Here we return all tabable fields followed by all buttons in
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5350
     the panel."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5351
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5352
    |fields buttons|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5353
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5354
    tabableElements isNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5355
	fields := #()
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5356
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5357
	fields := tabableElements
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5358
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5359
    buttonPanel notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5360
	buttons := buttonPanel subViews.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5361
	buttons notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5362
	    fields := fields , buttonPanel subViews
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5363
	]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5364
    ].
739
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5365
    ^ fields select:[:aField | aField realized].
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5366
67e04c0c38a7 fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  5367
    "Modified: 31.5.1996 / 22:05:58 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5368
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5369
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5370
initialize
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5371
    |mm|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5372
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5373
    super initialize.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5374
573
3335fee474b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  5375
"/    label := 'Dialog'.
948
dbe2e86d0db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
  5376
    acceptValue := ValueHolder newBoolean.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5377
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5378
    mm := ViewSpacing.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5379
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5380
    acceptReturnAsOK := true.
125
claus
parents: 122
diff changeset
  5381
    acceptOnLeave := true.
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5382
    focusToOKOnLeave := true.
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5383
    hideOnAccept := true.
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  5384
    autoAccept := true.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5385
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5386
    buttonPanel := HorizontalPanelView in:self.
118
claus
parents: 112
diff changeset
  5387
    buttonPanel 
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5388
	origin:(0.0 @ 1.0) corner:(1.0 @ 1.0);
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5389
	bottomInset:mm; 
1614
5aa3dfca0f33 geometry of buttonPanel.
Claus Gittinger <cg@exept.de>
parents: 1575
diff changeset
  5390
	topInset:(font height + mm * 2) negated;
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5391
	borderWidth:0;
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5392
	horizontalLayout:#spread.
118
claus
parents: 112
diff changeset
  5393
122
claus
parents: 121
diff changeset
  5394
    yPosition := ViewSpacing.
312
008267b920d9 allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  5395
    leftIndent := rightIndent := (ViewSpacing // 2).
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5396
    needResize := true.
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5397
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5398
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5399
     |b|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5400
     b := DialogBox new.
118
claus
parents: 112
diff changeset
  5401
     b addAbortButton; 
claus
parents: 112
diff changeset
  5402
       addOkButton; 
claus
parents: 112
diff changeset
  5403
       showAtPointer
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5404
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5405
    "
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5406
     |b|
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5407
     b := DialogBox new.
118
claus
parents: 112
diff changeset
  5408
     b addOkButton; 
claus
parents: 112
diff changeset
  5409
       showAtPointer
claus
parents: 112
diff changeset
  5410
    "
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5411
    "
118
claus
parents: 112
diff changeset
  5412
     |b|
claus
parents: 112
diff changeset
  5413
     b := DialogBox new.
claus
parents: 112
diff changeset
  5414
     b addTextLabel:'hello world';
claus
parents: 112
diff changeset
  5415
       addOkButton; 
claus
parents: 112
diff changeset
  5416
       showAtPointer
claus
parents: 112
diff changeset
  5417
    "
claus
parents: 112
diff changeset
  5418
    "
claus
parents: 112
diff changeset
  5419
     |b|
claus
parents: 112
diff changeset
  5420
     b := DialogBox new.
claus
parents: 112
diff changeset
  5421
     b addTextLabel:'hello world';
claus
parents: 112
diff changeset
  5422
       addVerticalSpace:50; 
claus
parents: 112
diff changeset
  5423
       addOkButton; 
claus
parents: 112
diff changeset
  5424
       showAtPointer
claus
parents: 112
diff changeset
  5425
    "
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5426
1614
5aa3dfca0f33 geometry of buttonPanel.
Claus Gittinger <cg@exept.de>
parents: 1575
diff changeset
  5427
    "Modified: / 23.12.1997 / 10:05:24 / md"
5aa3dfca0f33 geometry of buttonPanel.
Claus Gittinger <cg@exept.de>
parents: 1575
diff changeset
  5428
    "Modified: / 27.7.1998 / 20:16:37 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5429
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5430
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5431
reAdjustGeometry
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5432
    "sent late in snapin processing - gives me a chance
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5433
     to resize for changed font dimensions."
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5434
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5435
    super reAdjustGeometry.
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5436
    okButton notNil ifTrue:[okButton resize].
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5437
    abortButton notNil ifTrue:[abortButton resize].
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5438
    self resize
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5439
! !
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5440
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5441
!DialogBox methodsFor:'private'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5442
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5443
basicAddComponent:aComponent 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5444
    "add a component, dont change its size"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5445
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5446
    addedComponents isNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5447
	addedComponents := OrderedCollection new.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5448
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5449
    addedComponents add:aComponent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5450
    self addSubView:aComponent.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5451
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5452
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5453
hideAndEvaluate:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5454
    "if I am modal, make myself invisible and evaluate aBlock.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5455
     If nonModal, stay up, but also evaluate the block."
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5456
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5457
    (windowGroup notNil and:[windowGroup isModal]) ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5458
	self hide.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5459
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5460
    aBlock notNil ifTrue:[aBlock value]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5461
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5462
    "Modified: 5.9.1995 / 19:06:33 / claus"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5463
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5464
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5465
realize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5466
    "if any inputFields where added, activate the first one"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5467
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5468
    inputFieldGroup notNil ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5469
	inputFieldGroup activateFirst
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5470
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5471
    super realize
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5472
!
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5473
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5474
resize
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5475
    needResize ifTrue:[
314
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  5476
	needResize := false.
705185e7001d no border for textLabels in 2D styles
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  5477
	super resize
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5478
    ]
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5479
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5480
    "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
  5481
    "Modified: 27.1.1996 / 18:25:40 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5482
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5483
120
claus
parents: 118
diff changeset
  5484
!DialogBox methodsFor:'queries'!
118
claus
parents: 112
diff changeset
  5485
121
claus
parents: 120
diff changeset
  5486
accepted
128
claus
parents: 126
diff changeset
  5487
    "after the box has closed:
claus
parents: 126
diff changeset
  5488
	 return true if accepted, false if canceled"
125
claus
parents: 122
diff changeset
  5489
128
claus
parents: 126
diff changeset
  5490
    ^ acceptValue value
121
claus
parents: 120
diff changeset
  5491
!
claus
parents: 120
diff changeset
  5492
120
claus
parents: 118
diff changeset
  5493
positionOffset
claus
parents: 118
diff changeset
  5494
    "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
  5495
     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
  5496
     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
  5497
     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
  5498
     use my superclasses offset."
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5499
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5500
    |idx butt buttons|
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5501
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5502
    buttonPanel notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5503
	buttons := buttonPanel subViews.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5504
	buttons size > 0 ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5505
	    idx := buttons findFirst:[:b | b isReturnButton].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5506
	    idx ~~ 0 ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5507
		butt := buttons at:idx.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5508
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5509
		"get our size (preferredExtent) and compute
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5510
		 origin and extent of buttonPanel and okButton.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5511
		 This is normally done on view realization."
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5512
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5513
		self resize.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5514
		buttonPanel pixelOrigin:buttonPanel computeOrigin.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5515
		buttonPanel pixelExtent:buttonPanel computeExtent.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5516
		buttonPanel setChildPositionsIfChanged.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5517
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5518
		^ (butt originRelativeTo:self) + (butt extent // 2)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5519
	    ]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5520
	]
118
claus
parents: 112
diff changeset
  5521
    ].
913
d3318d34a1d0 More #positionOffset fixes.
Stefan Vogel <sv@exept.de>
parents: 912
diff changeset
  5522
953
050fba15277a DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents: 950
diff changeset
  5523
    ^ super positionOffset
912
310c4970e613 Fix #positionOffset to show 'senders' box with cursor on ok-button.
Stefan Vogel <sv@exept.de>
parents: 884
diff changeset
  5524
913
d3318d34a1d0 More #positionOffset fixes.
Stefan Vogel <sv@exept.de>
parents: 912
diff changeset
  5525
    "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
  5526
    "Modified: 16.1.1997 / 22:00:23 / cg"
118
claus
parents: 112
diff changeset
  5527
!
claus
parents: 112
diff changeset
  5528
130
claus
parents: 128
diff changeset
  5529
preferredExtent 
132
claus
parents: 131
diff changeset
  5530
    "return my preferred extent.
claus
parents: 131
diff changeset
  5531
     That is the max component width, or my current width (default);
claus
parents: 131
diff changeset
  5532
     whichever is larger, by the sum of the components heights."
118
claus
parents: 112
diff changeset
  5533
120
claus
parents: 118
diff changeset
  5534
    |w h p|
118
claus
parents: 112
diff changeset
  5535
797
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 795
diff changeset
  5536
    "/ If I have an explicit preferredExtent ..
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 795
diff changeset
  5537
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
  5538
    preferredExtent notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5539
	^ preferredExtent
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
  5540
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
  5541
120
claus
parents: 118
diff changeset
  5542
    addedComponents notNil ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5543
	w := addedComponents 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5544
		inject:0 
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5545
		into:[:max :element |
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5546
			|eExt prefWidth scale rel relX|
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5547
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5548
			prefWidth := element preferredExtent x.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5549
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5550
			"/ special (for your convenience)
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5551
			"/ if the element has been added with a relative width,
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5552
			"/ scale it to get at least its preferred width
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5553
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5554
			(rel := element relativeExtent) notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5555
			    relX := rel x.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5556
			    (relX isNil or:[relX isInteger]) ifFalse:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5557
				prefWidth := (prefWidth * (1 / relX)) rounded
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5558
			    ].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5559
			].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5560
			eExt := prefWidth + (element borderWidth * 2). "/ max:element extent x.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5561
			max max:(eExt + element leftInset + element rightInset)].
120
claus
parents: 118
diff changeset
  5562
    ] ifFalse:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5563
	w := super preferredExtent x.
120
claus
parents: 118
diff changeset
  5564
    ].
132
claus
parents: 131
diff changeset
  5565
    w := w max:width.
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5566
    h := yPosition + ViewSpacing.
118
claus
parents: 112
diff changeset
  5567
130
claus
parents: 128
diff changeset
  5568
    buttonPanel subViews size ~~ 0 ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5569
	p := buttonPanel preferredExtent.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5570
	w := w max:p x.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5571
	h := h
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5572
	     + p y
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5573
	     + ViewSpacing.
120
claus
parents: 118
diff changeset
  5574
    ].
118
claus
parents: 112
diff changeset
  5575
120
claus
parents: 118
diff changeset
  5576
"/    okButton isNil ifTrue:[
130
claus
parents: 128
diff changeset
  5577
"/        ^ super preferredExtent
120
claus
parents: 118
diff changeset
  5578
"/    ].
130
claus
parents: 128
diff changeset
  5579
"/    p := buttonPanel preferredExtent.
120
claus
parents: 118
diff changeset
  5580
"/    w := p x.
claus
parents: 118
diff changeset
  5581
"/    h := ViewSpacing
claus
parents: 118
diff changeset
  5582
"/         + p y
claus
parents: 118
diff changeset
  5583
"/         + ViewSpacing.
claus
parents: 118
diff changeset
  5584
"/
claus
parents: 118
diff changeset
  5585
    ^ w @ h
310
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5586
797
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 795
diff changeset
  5587
    "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
  5588
! !
4bbc8deffc8c allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents: 307
diff changeset
  5589
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5590
!DialogBox methodsFor:'user actions'!
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5591
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5592
abortPressed
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5593
    "sent by the cancel button; user pressed abort button
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5594
     - hide myself and evaluate okAction"
121
claus
parents: 120
diff changeset
  5595
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5596
    abortButton turnOffWithoutRedraw.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5597
    acceptValue value:false.
121
claus
parents: 120
diff changeset
  5598
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5599
    "/ actually, only hides if I have been opened modal
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5600
    self hideAndEvaluate:abortAction
121
claus
parents: 120
diff changeset
  5601
!
claus
parents: 120
diff changeset
  5602
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5603
doAccept
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5604
    "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
  5605
     then set my accept value to true.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5606
     This is confusing: this method was originally called #accept,
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5607
     but renamed for compatibility with ST-80, where #accept returns the
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5608
     accept-valueHolder (which looks like a bad name to me ...)."
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5609
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  5610
    autoAccept ifTrue:[    
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5611
	addedComponents notNil ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5612
	    addedComponents do:[:aComponent |
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5613
		(aComponent respondsTo:#accept) ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5614
		    aComponent accept
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5615
		]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5616
	    ]
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5617
	].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5618
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5619
    acceptValue value:true.
469
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  5620
1d86f97ab2e5 autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents: 436
diff changeset
  5621
    "Modified: 4.3.1996 / 12:14:56 / cg"
128
claus
parents: 126
diff changeset
  5622
!
claus
parents: 126
diff changeset
  5623
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5624
keyPress:aKey x:x y:y
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5625
    "return-key dublicates ok-function if acceptReturnAsOK is true"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5626
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  5627
    <resource: #keyboard (#Return)>
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  5628
307
d3fe810390cb changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  5629
    (aKey == #Return) ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5630
	(okButton notNil and:[okButton isReturnButton]) ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5631
	    ^ self okPressed
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5632
	].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5633
	(abortButton notNil and:[abortButton isReturnButton]) ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5634
	    ^ self abortPressed
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5635
	].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5636
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5637
    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
  5638
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
  5639
    "Modified: 7.3.1996 / 13:15:09 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5640
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5641
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5642
lastFieldLeft
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5643
    "if the dialog involves input fields, this is called
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5644
     when the last field is left by Return-key or NextField-key"
120
claus
parents: 118
diff changeset
  5645
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5646
    acceptOnLeave ifTrue:[
1401
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5647
	acceptReturnAsOK ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5648
	    focusToOKOnLeave ifTrue:[
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5649
		self focusOnOk.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5650
		^ self.
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5651
	    ].
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5652
	    self okPressed
9ab32fbd0895 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  5653
	]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5654
    ].
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5655
    inputFieldGroup activateFirst
357
732f59def851 care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
  5656
551
91ed5dd2b915 shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
  5657
    "Modified: 19.4.1996 / 17:09:02 / cg"
76
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5658
!
81e3409404d2 Initial revision
claus
parents:
diff changeset
  5659
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5660
okPressed
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5661
    "sent by the okButton; user pressed ok-button
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5662
     - make myself invisible and if an action was specified do it"
128
claus
parents: 126
diff changeset
  5663
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5664
    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
  5665
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5666
    self doAccept.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
  5667
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5668
    acceptCheck notNil ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  5669
	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
  5670
    ].
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5671
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5672
    hideOnAccept ifTrue:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  5673
	"/ actually, only hides if I have been opened modal
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  5674
	self hideAndEvaluate:okAction.
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5675
    ] ifFalse:[
302
d7fb38f963ae added example with passwordCharacter
ah
parents: 280
diff changeset
  5676
	okAction value
280
f7d45bfb6d13 fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
  5677
    ]
128
claus
parents: 126
diff changeset
  5678
! !
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  5679
846
75c5dc601522 added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
  5680
!DialogBox class methodsFor:'documentation'!
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  5681
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  5682
version
1624
bc716c00b226 added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents: 1614
diff changeset
  5683
    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.116 1998-07-28 19:41:23 cg Exp $'
240
75a3b67bd91d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
  5684
! !
498
1c4fbbcc9362 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  5685
DialogBox initialize!