EditField.st
author Claus Gittinger <cg@exept.de>
Thu, 09 Nov 2017 20:09:30 +0100
changeset 6225 0122e4e6c587
parent 6222 b5ed5993de3e
child 6233 c0f9db3466e9
permissions -rw-r--r--
#FEATURE by cg class: GenericToolbarIconLibrary class added: #hideFilter16x16Icon
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1990 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 47
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
2193
58666d1d312c Channels moved to superclass (#destroy)
Stefan Vogel <sv@exept.de>
parents: 2130
diff changeset
    12
"{ Package: 'stx:libwidg' }"
58666d1d312c Channels moved to superclass (#destroy)
Stefan Vogel <sv@exept.de>
parents: 2130
diff changeset
    13
5240
331c5840649e class: EditField
Claus Gittinger <cg@exept.de>
parents: 5122
diff changeset
    14
"{ NameSpace: Smalltalk }"
331c5840649e class: EditField
Claus Gittinger <cg@exept.de>
parents: 5122
diff changeset
    15
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    16
EditTextView subclass:#EditField
316
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
    17
	instanceVariableNames:'leaveAction enabled clickAction crAction tabAction converter
209
7a6db7fac566 dont allow multiline selections in EditField
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
    18
		leaveKeys immediateAccept acceptOnLeave acceptOnReturn
979
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
    19
		lengthLimit entryCompletionBlock entryCompletionCharacter
2130
40515380f762 moved control over how-to-move-the-cursor when updating text
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
    20
		passwordCharacter autoScrollHorizontally acceptOnTab
3216
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
    21
		acceptOnLostFocus acceptOnPointerLeave acceptIfUnchanged leaveKey
4720
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
    22
		doubleClickAction emptyFieldReplacementText leaveKeyActions'
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
    23
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
4013
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
    24
		DefaultSelectionForegroundColor DefaultSelectionBackgroundColor
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
    25
		DefaultBorderColor DefaultBorderWidth DefaultLevel'
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
    26
	poolDictionaries:''
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
    27
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    28
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    29
892
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
    30
!EditField class methodsFor:'documentation'!
19
a696fb528758 *** empty log message ***
claus
parents: 7
diff changeset
    31
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    32
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    33
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    34
 COPYRIGHT (c) 1990 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 47
diff changeset
    35
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    36
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    37
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    38
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    39
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    40
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    41
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    42
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    43
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    44
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    45
19
a696fb528758 *** empty log message ***
claus
parents: 7
diff changeset
    46
documentation
a696fb528758 *** empty log message ***
claus
parents: 7
diff changeset
    47
"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    48
    an editable text-field. Realized by using an EditTextView,
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    49
    and forcing its size to 1 line - disabling cursor movement
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
    50
    in the vertical direction.
121
claus
parents: 120
diff changeset
    51
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    52
    Basically, an editField is an editor for a single line text,
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    53
    and provides the usual access protocol as defined in its superClasses
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    54
    (especially: #contents / #contents:).
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    55
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    56
    The above underlying internal mechanism can be used for fields which
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    57
    are passive; i.e. into which text can be entered and the value (string)
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    58
    is extracted actively by someone else.
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    59
2737
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    60
    accepting:
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    61
      The opposite way to use editFields is to connect them to a model
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    62
      and let the field notify changes to it.
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    63
      This notification is called ``accepting''.
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    64
      Unless accepted, the models value is not updated from the editFields contents
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    65
      this default is the normal operation and way things should work, since most
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    66
      uses of editFields are not interested in every individual change
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    67
      (i.e. getting each keyStroke when a long number is entered).
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    68
      The default behavior is to ``accept'' when either return or a cursorUp/Down
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    69
      key is pressed in a field.
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    70
      However, the field can setup to accept/not accept on leave, on return
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    71
      or on each individual key input.
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    72
      See the methods #acceptOnLeave: / #acceptOnReturn: / #immediateAccept.
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    73
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    74
      In addition, the set of keys which are considered ``leaveKeys'' can be
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    75
      specified by #leaveKeys: (in case you need keys other than Return, CursorUp/Down).
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    76
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    77
    models value vs. field contents:
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    78
      Although the field internally keeps its contents as some string object,
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    79
      the application may prefer to think of numbers, floats, yes/no values etc.
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    80
      To support this, a converter may defined, which is responsible for conversion of
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    81
      strings to/from the models domain value.
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    82
      If present (i.e. nonNil), the converter is asked to convert a string to the models
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    83
      domain with #readValueFrom:aString and vice versa, a value to a string by #printStringFor:.
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    84
      The PrintConverter class already provides a number of standard conversions, see the examples.
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    85
      To access a converted value directly (i.e. not via the model), use #editValue.
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    86
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    87
    grouping:
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    88
      Individual fields do not know about being included in a group. This must be arranged on the
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    89
      outside, by placing multiple fields into an EnterFieldGroup.
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    90
      This groupObject keeps a reference to one active field, and forwards input from any other
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    91
      field to the active one. Also have a look at the examples for this.
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    92
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    93
    input completion:
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    94
      To support input completion (i.e. filename completion, classname completion etc.),
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    95
      a completionBlock can be defined which (if non-nil) is evaluated when the completion-key
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    96
      is pressed and its value is taken as the new field-contents. 
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    97
      The physical completion-key is the Tab key (this one cannot be defined by
64329a4d4dd5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2709
diff changeset
    98
      the keyboardTranslation mechanism, since that would disable the Tab-key on regular text views.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    99
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   100
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   101
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   102
    [Instance variables:]
121
claus
parents: 120
diff changeset
   103
claus
parents: 120
diff changeset
   104
      leaveAction    <Block | nil>              if non-nil, this is evaluated with
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   105
                                                the key (#Return, #CursorUp etc.) when
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   106
                                                the field is left via keyboard keys.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   107
                                                (fieldGroups use this to decide which
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   108
                                                 field has to be enabled next)
121
claus
parents: 120
diff changeset
   109
claus
parents: 120
diff changeset
   110
      enabled        <Boolean>                  if false, input is ignored.
claus
parents: 120
diff changeset
   111
316
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
   112
      clickAction    <Block | nil>              action performed if the field is
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   113
                                                clicked upon.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   114
                                                (this is used by the group to
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   115
                                                 set the active field to the clicked upon field)
121
claus
parents: 120
diff changeset
   116
claus
parents: 120
diff changeset
   117
      crAction       <Block | nil>              if non-nil, keyboard input of a cr are not
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   118
                                                handled specially, instead this block is evaluated
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   119
                                                (however, this block can perform additional checks and send
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   120
                                                 a #accept then)
121
claus
parents: 120
diff changeset
   121
claus
parents: 120
diff changeset
   122
      tabAction      <Block | nil>              if non-nil, keyboard input of a tab character
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   123
                                                is not entered into the text, instead this block
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   124
                                                is evaluated. Also, no input completion is performed if
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   125
                                                tabAction is nonNil.
121
claus
parents: 120
diff changeset
   126
claus
parents: 120
diff changeset
   127
      converter      <PrintConverter | nil>     if non-nil, this is supposed to convert between
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   128
                                                the object and its printed representation and vice versa.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   129
                                                Defaults to nil i.e. assume that strings are edited.
121
claus
parents: 120
diff changeset
   130
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   131
      leaveKeys      <Collection>               keys which are interpreted as 'leaving the field'
122
claus
parents: 121
diff changeset
   132
125
claus
parents: 122
diff changeset
   133
      immediateAccept   <Boolean>               if true, every change of the text is immediately
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   134
                                                forwarded to the model/acceptBlock. If false,
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   135
                                                the changed value is only stored in the model
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   136
                                                if the field is left or accepted.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   137
                                                Default is false.
122
claus
parents: 121
diff changeset
   138
claus
parents: 121
diff changeset
   139
      acceptOnLeave  <Boolean>                  if true, leaving the field (via cursor keys)
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   140
                                                automatically accepts the value into the model.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   141
                                                Default is true.
122
claus
parents: 121
diff changeset
   142
claus
parents: 121
diff changeset
   143
      acceptOnReturn <Boolean>                  if true, leaving the field via return
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   144
                                                automatically accepts the value into the model.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   145
                                                Default is true.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   146
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   147
      acceptOnTab    <Boolean>                  if true, the Tab key accepts and leaves the field.
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   148
                                                If false, Tabs are entered into the contents field like
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   149
                                                ordinary non-control keys.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   150
                                                AcceptOnTab is ignored if the entryCompletion block is nonNil.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   151
                                                Default is true.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   152
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   153
      lengthLimit    <Number>                   the max. number of allowed characters
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   154
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   155
      entryCompletionBlock <BlockOrNil>         if non-nil, this is evaluated to complete the entry
978
6e678fdc6e5b allow non-Tab as entryCompleter; care for immediateAccept after completion
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   156
                                                when <entryCompletionCharacter> is pressed.
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   157
                                                Entry completion is used with Filenamefields or in the
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   158
                                                browser for classname/selector completion.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   159
                                                Setting a nonNil entryCompletion disables acceptOnTab.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   160
2130
40515380f762 moved control over how-to-move-the-cursor when updating text
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
   161
      entryCompletionCharacter <CharacterOrNil> if non-nil AND entryCompletionBlock is nonNil, that one
40515380f762 moved control over how-to-move-the-cursor when updating text
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
   162
                                                is evaluated for completion. Typically used to complete
40515380f762 moved control over how-to-move-the-cursor when updating text
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
   163
                                                a fileName (also, classNames in the browser)
40515380f762 moved control over how-to-move-the-cursor when updating text
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
   164
                                                Default is #Tab.
978
6e678fdc6e5b allow non-Tab as entryCompleter; care for immediateAccept after completion
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   165
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   166
      passwordCharacter     <CharacterOrNil>    if non-nil, typed input is replaced by this character
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   167
                                                for display. Used for secret-input fields (such as password entry).
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   168
                                                Default is nil.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   169
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   170
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   171
    [author:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   172
        Claus Gittinger
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   173
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   174
    [see also:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   175
        DialogBox
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   176
        EnterFieldGroup
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   177
        EnterBox EnterBox2
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   178
        FilenameEditField EditTextView
19
a696fb528758 *** empty log message ***
claus
parents: 7
diff changeset
   179
"
120
claus
parents: 118
diff changeset
   180
!
claus
parents: 118
diff changeset
   181
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   182
examples
120
claus
parents: 118
diff changeset
   183
"
122
claus
parents: 121
diff changeset
   184
    see more examples in EnterFieldGroup>>examples.
claus
parents: 121
diff changeset
   185
claus
parents: 121
diff changeset
   186
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   187
    Step-by-step introduction:
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   188
120
claus
parents: 118
diff changeset
   189
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   190
    basic field in some view:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   191
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   192
        |top field|
120
claus
parents: 118
diff changeset
   193
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   194
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   195
        top extent:200@100.
120
claus
parents: 118
diff changeset
   196
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   197
        field := EditField origin:0.0@0.0 in:top.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   198
        field width:1.0.                                'let its height as-is'.
120
claus
parents: 118
diff changeset
   199
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   200
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   201
                                                                        [exEnd]
120
claus
parents: 118
diff changeset
   202
122
claus
parents: 121
diff changeset
   203
125
claus
parents: 122
diff changeset
   204
    forward input in topView to the field:
claus
parents: 122
diff changeset
   205
    (currently, the field does not know this - therefore,
claus
parents: 122
diff changeset
   206
     its been told here ... this may change)
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   207
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   208
        |top field|
122
claus
parents: 121
diff changeset
   209
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   210
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   211
        top extent:200@100.
122
claus
parents: 121
diff changeset
   212
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   213
        field := EditField origin:0.0@0.0 in:top.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   214
        field width:1.0.                                'let its height as-is'.
122
claus
parents: 121
diff changeset
   215
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   216
        top delegate:(KeyboardForwarder toView:field).
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   217
        field hasKeyboardFocus:true.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   218
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   219
                                                                        [exEnd]
122
claus
parents: 121
diff changeset
   220
claus
parents: 121
diff changeset
   221
125
claus
parents: 122
diff changeset
   222
    to make it look better: set some inset:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   223
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   224
        |top field spacing|
120
claus
parents: 118
diff changeset
   225
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   226
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   227
        top extent:200@100.
120
claus
parents: 118
diff changeset
   228
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   229
        spacing := View viewSpacing.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   230
        field := EditField origin:(0.0 @ spacing) in:top.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   231
        field width:1.0.                                        'let its height as-is'.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   232
        field leftInset:spacing; rightInset:spacing.
120
claus
parents: 118
diff changeset
   233
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   234
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   235
                                                                        [exEnd]
120
claus
parents: 118
diff changeset
   236
122
claus
parents: 121
diff changeset
   237
120
claus
parents: 118
diff changeset
   238
    give it an initial contents:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   239
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   240
        |top field|
120
claus
parents: 118
diff changeset
   241
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   242
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   243
        top extent:200@100.
120
claus
parents: 118
diff changeset
   244
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   245
        field := EditField origin:(0.0 @ 0.0) in:top.
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   246
        field width:1.0.
120
claus
parents: 118
diff changeset
   247
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   248
        field editValue:'hello world'.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   249
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   250
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   251
                                                                        [exEnd]
120
claus
parents: 118
diff changeset
   252
122
claus
parents: 121
diff changeset
   253
125
claus
parents: 122
diff changeset
   254
    have it preselected:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   255
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   256
        |top field|
120
claus
parents: 118
diff changeset
   257
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   258
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   259
        top extent:200@100.
120
claus
parents: 118
diff changeset
   260
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   261
        field := EditField origin:(0.0 @ 0.0) in:top.
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   262
        field width:1.0.
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   263
        field editValue:'hello world' selected:true.
120
claus
parents: 118
diff changeset
   264
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   265
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   266
                                                                         [exEnd]
120
claus
parents: 118
diff changeset
   267
122
claus
parents: 121
diff changeset
   268
120
claus
parents: 118
diff changeset
   269
    have part of it preselected:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   270
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   271
        |top field|
120
claus
parents: 118
diff changeset
   272
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   273
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   274
        top extent:200@100.
120
claus
parents: 118
diff changeset
   275
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   276
        field := EditField origin:(0.0 @ 0.0) in:top.
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   277
        field width:1.0.
120
claus
parents: 118
diff changeset
   278
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   279
        field editValue:'hello world'.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   280
        field selectFromCharacterPosition:1 to:5.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   281
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   282
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   283
                                                                        [exEnd]
120
claus
parents: 118
diff changeset
   284
122
claus
parents: 121
diff changeset
   285
125
claus
parents: 122
diff changeset
   286
    set a size limit:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   287
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   288
        |top field|
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   289
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   290
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   291
        top extent:200@100.
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   292
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   293
        field := EditField origin:(0.0 @ 0.0) in:top.
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   294
        field width:1.0.
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   295
        field editValue:'hello'.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   296
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   297
        field maxChars:8.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   298
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   299
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   300
                                                                        [exEnd]
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   301
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   302
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   303
    set a size limit, initial width and stop it from scrolling
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   304
    notice: you may prefer a constant-pitch font (such as courier):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   305
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   306
        |top field|
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   307
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   308
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   309
        top extent:200@100.
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   310
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   311
        field := EditField origin:(0.0 @ 0.0) in:top.
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   312
        field innerWidth:(field font widthOf:'00000000').
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   313
        field editValue:'12345678'.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   314
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   315
        field maxChars:8.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   316
        field autoScroll:false.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   317
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   318
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   319
                                                                        [exEnd]
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   320
125
claus
parents: 122
diff changeset
   321
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   322
    enable / disable:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   323
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   324
        |top panel check field ena|
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   325
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   326
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   327
        top extent:200@100.
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   328
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   329
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   330
        panel borderWidth:0.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   331
        panel horizontalLayout:#left.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   332
        panel horizontalInset:View viewSpacing.
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   333
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   334
        check := CheckBox label:'enable' in:panel.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   335
        check turnOn.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   336
        check action:[:onOff | onOff ifTrue:[field enable] ifFalse:[field disable]].
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   337
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   338
        panel add:(View new height:30; borderWidth:0).
125
claus
parents: 122
diff changeset
   339
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   340
        field := EditField in:panel.
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   341
        field width:1.0.
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   342
        field editValue:'hello'.
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   343
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   344
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   345
                                                                        [exEnd]
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   346
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   347
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   348
    enable / disable using a channel:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   349
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   350
        |top panel check field ena|
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   351
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   352
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   353
        top extent:200@100.
125
claus
parents: 122
diff changeset
   354
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   355
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   356
        panel borderWidth:0.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   357
        panel horizontalLayout:#left.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   358
        panel horizontalInset:View viewSpacing.
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   359
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   360
        ena := true asValue.
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   361
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   362
        check := CheckBox label:'enable' in:panel.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   363
        check model:ena.
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   364
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   365
        panel add:(View new height:30; borderWidth:0).
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   366
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   367
        field := EditField in:panel.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   368
        field enableChannel:ena.
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   369
        field width:1.0.
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   370
        field editValue:'hello'.
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   371
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   372
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   373
                                                                        [exEnd]
125
claus
parents: 122
diff changeset
   374
claus
parents: 122
diff changeset
   375
121
claus
parents: 120
diff changeset
   376
    use a converter:
125
claus
parents: 122
diff changeset
   377
      - numbers (default to 0):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   378
                                                                        [exBegin]
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   379
        |top field spacing|
121
claus
parents: 120
diff changeset
   380
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   381
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   382
        top extent:200@100.
121
claus
parents: 120
diff changeset
   383
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   384
        spacing := View viewSpacing.
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   385
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   386
        field := EditField origin:0.0 @ spacing in:top.
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   387
        field width:1.0.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   388
        field horizontalInset:spacing.
121
claus
parents: 120
diff changeset
   389
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   390
        field converter:(PrintConverter new initForNumber).
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   391
        field editValue:1234.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   392
        field acceptAction:[:value | Transcript showCR:value].
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   393
        field crAction:[field accept. top destroy].
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   394
        top open.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   395
                                                                        [exEnd]
121
claus
parents: 120
diff changeset
   396
claus
parents: 120
diff changeset
   397
      - dates:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   398
                                                                        [exBegin]
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   399
        |top field spacing|
121
claus
parents: 120
diff changeset
   400
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   401
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   402
        top extent:200@100.
121
claus
parents: 120
diff changeset
   403
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   404
        spacing := View viewSpacing.
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   405
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   406
        field := EditField origin:0.0 @ spacing in:top.
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   407
        field width:1.0.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   408
        field horizontalInset:spacing.
121
claus
parents: 120
diff changeset
   409
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   410
        field converter:(PrintConverter new initForDate).
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   411
        field editValue:Date today.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   412
        field acceptAction:[:value | Transcript showCR:value class name , ' ' , value printString].
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   413
        field crAction:[field accept. top destroy].
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   414
        top open.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   415
                                                                        [exEnd]
121
claus
parents: 120
diff changeset
   416
122
claus
parents: 121
diff changeset
   417
125
claus
parents: 122
diff changeset
   418
    setting immediateAccept, makes the field update with every key:
claus
parents: 122
diff changeset
   419
claus
parents: 122
diff changeset
   420
      - immediate accept numbers, defaulting to nil:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   421
                                                                        [exBegin]
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   422
        |top field spacing|
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   423
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   424
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   425
        top extent:200@100.
121
claus
parents: 120
diff changeset
   426
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   427
        spacing := View viewSpacing.
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   428
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   429
        field := EditField origin:0.0 @ spacing in:top.
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   430
        field width:1.0.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   431
        field horizontalInset:spacing.
121
claus
parents: 120
diff changeset
   432
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   433
        field converter:(PrintConverter new initForNumberOrNil).
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   434
        field immediateAccept:true.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   435
        field editValue:1234.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   436
        field acceptAction:[:value | Transcript showCR:value].
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   437
        field crAction:[field accept. top destroy].
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   438
        top open.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   439
                                                                        [exEnd]
121
claus
parents: 120
diff changeset
   440
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   441
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   442
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   443
    grouping multiple fields, and forward keyPres from the outer view to the active field
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   444
    (i.e. actually: to the group):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   445
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   446
        |top field1 field2 field3 group|
121
claus
parents: 120
diff changeset
   447
122
claus
parents: 121
diff changeset
   448
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   449
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   450
        top extent:200@100.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   451
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   452
        field1 := EditField origin:(0.0 @ 0.0) in:top.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   453
        field1 width:1.0.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   454
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   455
        field2 := EditField origin:(0.0 @ 0.0) in:top.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   456
        field2 width:0.5.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   457
        field2 topInset:(field1 height); bottomInset:(field1 height negated).
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   458
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   459
        field3 := EditField origin:(0.5 @ 0.0) in:top.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   460
        field3 width:0.5.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   461
        field3 topInset:(field1 height); bottomInset:(field1 height negated).
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   462
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   463
        group := EnterFieldGroup new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   464
        group add:field1; add:field2; add:field3.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   465
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   466
        top delegate:(KeyboardForwarder to:group).
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   467
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   468
        top open.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   469
                                                                        [exEnd]
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   470
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   471
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   472
    in addition: tell the group to close when the last field is left:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   473
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   474
        |top field1 field2 field3 group|
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   475
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   476
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   477
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   478
        top extent:200@100.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   479
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   480
        field1 := EditField origin:(0.0 @ 0.0) in:top.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   481
        field1 width:1.0.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   482
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   483
        field2 := EditField origin:(0.0 @ 0.0) in:top.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   484
        field2 width:0.5.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   485
        field2 topInset:(field1 height); bottomInset:(field1 height negated).
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   486
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   487
        field3 := EditField origin:(0.5 @ 0.0) in:top.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   488
        field3 width:0.5.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   489
        field3 topInset:(field1 height); bottomInset:(field1 height negated).
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   490
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   491
        group := EnterFieldGroup new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   492
        group add:field1; add:field2; add:field3.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   493
        group leaveAction:[top destroy].
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   494
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   495
        top delegate:(KeyboardForwarder to:group).
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   496
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   497
        top open.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   498
                                                                        [exEnd]
127
claus
parents: 125
diff changeset
   499
claus
parents: 125
diff changeset
   500
120
claus
parents: 118
diff changeset
   501
    use a model:
claus
parents: 118
diff changeset
   502
    (see changing model value in inspector when return is pressed in the field)
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   503
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   504
        |top field model|
120
claus
parents: 118
diff changeset
   505
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   506
        model := 'hello world' asValue.
120
claus
parents: 118
diff changeset
   507
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   508
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   509
        top extent:200@100.
120
claus
parents: 118
diff changeset
   510
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   511
        field := EditField origin:(0.0 @ 0.0) in:top.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   512
        field width:1.0.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   513
        field model:model.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   514
        field acceptOnReturn:true.
120
claus
parents: 118
diff changeset
   515
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   516
        top open.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   517
        model inspect.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   518
                                                                        [exEnd]
121
claus
parents: 120
diff changeset
   519
122
claus
parents: 121
diff changeset
   520
892
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   521
    like above, but also accept the value, when the focus is changed
894
210626ca9586 example
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
   522
    (i.e. out of the input field):
892
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   523
    (see changing model value in inspector)
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   524
                                                                        [exBegin]
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   525
        |top field model|
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   526
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   527
        model := 'hello world' asValue.
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   528
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   529
        top := StandardSystemView new.
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   530
        top extent:200@100.
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   531
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   532
        field := EditField origin:(0.0 @ 0.0) in:top.
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   533
        field width:1.0.
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   534
        field model:model.
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   535
        field acceptOnLostFocus:true.
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   536
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   537
        top open.
894
210626ca9586 example
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
   538
        InspectorView openOn:model monitor:'value'.
892
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   539
                                                                        [exEnd]
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   540
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   541
127
claus
parents: 125
diff changeset
   542
    two views on the same model (each accepts on return):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   543
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   544
        |top1 top2 field1 field2 model|
121
claus
parents: 120
diff changeset
   545
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   546
        model := 'hello world' asValue.
121
claus
parents: 120
diff changeset
   547
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   548
        top1 := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   549
        top1 extent:200@100.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   550
        field1 := EditField origin:(0.0 @ 0.0) in:top1.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   551
        field1 width:1.0.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   552
        field1 model:model.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   553
        field1 acceptOnReturn:true.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   554
        top1 open.
121
claus
parents: 120
diff changeset
   555
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   556
        top2 := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   557
        top2 extent:200@100.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   558
        field2 := EditField origin:(0.0 @ 0.0) in:top2.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   559
        field2 width:1.0.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   560
        field2 model:model.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   561
        field2 acceptOnReturn:true.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   562
        top2 open.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   563
                                                                        [exEnd]
121
claus
parents: 120
diff changeset
   564
127
claus
parents: 125
diff changeset
   565
    two views on the same model (no accept on return):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   566
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   567
        |top1 top2 field1 field2 model|
127
claus
parents: 125
diff changeset
   568
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   569
        model := 'hello world' asValue.
127
claus
parents: 125
diff changeset
   570
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   571
        top1 := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   572
        top1 extent:200@100.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   573
        field1 := EditField origin:(0.0 @ 0.0) in:top1.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   574
        field1 width:1.0.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   575
        field1 model:model; acceptOnReturn:false.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   576
        top1 open.
127
claus
parents: 125
diff changeset
   577
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   578
        top2 := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   579
        top2 extent:200@100.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   580
        field2 := EditField origin:(0.0 @ 0.0) in:top2.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   581
        field2 width:1.0.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   582
        field2 model:model; acceptOnReturn:false.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   583
        top2 open.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   584
                                                                        [exEnd]
127
claus
parents: 125
diff changeset
   585
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   586
    with immediate accept (every key updates the model):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   587
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   588
        |top1 top2 field1 field2 model|
125
claus
parents: 122
diff changeset
   589
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   590
        model := 'hello world' asValue.
125
claus
parents: 122
diff changeset
   591
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   592
        top1 := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   593
        top1 extent:200@100.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   594
        field1 := EditField origin:(0.0 @ 0.0) in:top1.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   595
        field1 width:1.0.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   596
        field1 model:model; immediateAccept:true.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   597
        top1 open.
125
claus
parents: 122
diff changeset
   598
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   599
        top2 := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   600
        top2 extent:200@100.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   601
        field2 := EditField origin:(0.0 @ 0.0) in:top2.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   602
        field2 width:1.0.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   603
        field2 model:model; immediateAccept:true.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   604
        top2 open.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   605
                                                                        [exEnd]
122
claus
parents: 121
diff changeset
   606
121
claus
parents: 120
diff changeset
   607
    just an example; a checkBox and an editField on the same model:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   608
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   609
        |top1 top2 field1 box model|
121
claus
parents: 120
diff changeset
   610
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   611
        model := false asValue.
121
claus
parents: 120
diff changeset
   612
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   613
        top1 := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   614
        top1 extent:200@100.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   615
        field1 := EditField origin:(0.0 @ 0.0) in:top1.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   616
        field1 width:1.0.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   617
        field1 converter:(PrintConverter new initForYesNo).
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   618
        field1 model:model.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   619
        top1 open.
121
claus
parents: 120
diff changeset
   620
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   621
        top2 := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   622
        top2 extent:200@100.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   623
        box := CheckBox on:model.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   624
        box label:'on/off'.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   625
        top2 add:box.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   626
        top2 open.
121
claus
parents: 120
diff changeset
   627
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   628
        model inspect.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   629
                                                                        [exEnd]
125
claus
parents: 122
diff changeset
   630
claus
parents: 122
diff changeset
   631
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   632
    multiple editFields on multiple models (value holders):
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   633
    (the fields are connected by a group to allow tabbing)
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   634
                                                                        [exBegin]
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   635
        |top panel group field1 field2 field3 box
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   636
         v1 v2 v3 spacing|
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   637
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   638
        v1 := true asValue.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   639
        v2 := 'some string' asValue.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   640
        v3 := 1.2 asValue.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   641
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   642
        top := StandardSystemView new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   643
        top extent:200@100.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   644
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   645
        panel := VerticalPanelView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   646
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   647
        spacing := View viewSpacing.
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   648
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   649
        field1 := EditField new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   650
        field1 width:1.0.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   651
        field1 horizontalInset:spacing.
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   652
        field1 converter:(PrintConverter new initForYesNo).
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   653
        field1 model:v1.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   654
        panel add:field1.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   655
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   656
        field2 := EditField new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   657
        field2 width:1.0.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   658
        field2 horizontalInset:spacing.
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   659
        field2 model:v2.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   660
        panel add:field2.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   661
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   662
        field3 := EditField new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   663
        field3 width:1.0.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   664
        field3 horizontalInset:spacing.
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   665
        field3 converter:(PrintConverter new initForNumber).
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   666
        field3 model:v3.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   667
        panel add:field3.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   668
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   669
        group := EnterFieldGroup new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   670
        group add:field1; add:field2; add:field3.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   671
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   672
        top openModal.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   673
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   674
        Transcript showCR:v1 value.
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   675
        Transcript showCR:v2 value.
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   676
        Transcript showCR:v3 value.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   677
                                                                        [exEnd]
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   678
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   679
125
claus
parents: 122
diff changeset
   680
    connecting fields:
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   681
    update field2 whenever field1 is changed.
125
claus
parents: 122
diff changeset
   682
    (normally, the processing below (xChanged) is done in your application
claus
parents: 122
diff changeset
   683
     class, or in a complex model. For the demonstration below, we use
claus
parents: 122
diff changeset
   684
     a Plug to simulate the protocol.)
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   685
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   686
        |application top field1 field2 value1 value2|
125
claus
parents: 122
diff changeset
   687
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   688
        application := Plug new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   689
        application respondTo:#value1Changed
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   690
                         with:[value2 value:(value1 value isNil ifTrue:[nil]
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   691
                                                                ifFalse:[value1 value squared])].
125
claus
parents: 122
diff changeset
   692
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   693
        value1 := 1 asValue.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   694
        value2 := 1 asValue.
125
claus
parents: 122
diff changeset
   695
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   696
        top := Dialog new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   697
        top extent:200@200.
125
claus
parents: 122
diff changeset
   698
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   699
        (top addTextLabel:'some number:') layout:#left.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   700
        top addVerticalSpace.
125
claus
parents: 122
diff changeset
   701
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   702
        (top addInputFieldOn:value1 tabable:false)
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   703
            converter:(PrintConverter new initForNumberOrNil);
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   704
            immediateAccept:true.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   705
        top addVerticalSpace.
125
claus
parents: 122
diff changeset
   706
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   707
        (top addTextLabel:'squared:') layout:#left.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   708
        top addVerticalSpace.
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   709
        (top addInputFieldOn:value2 tabable:false)
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   710
            converter:(PrintConverter new initForNumberOrNil).
125
claus
parents: 122
diff changeset
   711
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   712
        value1 onChangeSend:#value1Changed to:application.
125
claus
parents: 122
diff changeset
   713
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   714
        top openModeless.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   715
                                                                        [exEnd]
125
claus
parents: 122
diff changeset
   716
claus
parents: 122
diff changeset
   717
claus
parents: 122
diff changeset
   718
    two-way connect:
claus
parents: 122
diff changeset
   719
    each field updates the other (notice, that we have to turn off
claus
parents: 122
diff changeset
   720
    onChange: notification, to avoid an endless notification cycle)
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   721
                                                                        [exBegin]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   722
        |application top field1 field2 value1 value2|
125
claus
parents: 122
diff changeset
   723
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   724
        application := Plug new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   725
        application respondTo:#value1Changed
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   726
                         with:[value2 retractInterestsFor:application.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   727
                               value2 value:(value1 value isNil ifTrue:[nil]
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   728
                                                                ifFalse:[value1 value squared]).
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   729
                               value2 onChangeSend:#value2Changed to:application.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   730
                              ].
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   731
        application respondTo:#value2Changed
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   732
                         with:[value1 retractInterestsFor:application.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   733
                               value1 value:(value2 value isNil ifTrue:[nil]
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   734
                                                                ifFalse:[value2 value sqrt]).
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   735
                               value1 onChangeSend:#value1Changed to:application.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   736
                              ].
125
claus
parents: 122
diff changeset
   737
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   738
        value1 := 1 asValue.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   739
        value2 := 1 asValue.
125
claus
parents: 122
diff changeset
   740
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   741
        top := Dialog new.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   742
        top extent:200@200.
125
claus
parents: 122
diff changeset
   743
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   744
        (top addTextLabel:'some number:') layout:#left.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   745
        top addVerticalSpace.
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   746
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   747
        (top addInputFieldOn:value1 tabable:false)
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   748
            converter:(PrintConverter new initForNumberOrNil);
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   749
            immediateAccept:true.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   750
        top addVerticalSpace.
125
claus
parents: 122
diff changeset
   751
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   752
        (top addTextLabel:'squared:') layout:#left.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   753
        top addVerticalSpace.
6167
e9ee9ad33c30 #DOCUMENTATION by mawalch
mawalch
parents: 6139
diff changeset
   754
        (top addInputFieldOn:value2 tabable:false)
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   755
            converter:(PrintConverter new initForNumberOrNil);
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   756
            immediateAccept:true.
125
claus
parents: 122
diff changeset
   757
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   758
        value1 onChangeSend:#value1Changed to:application.
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   759
        value2 onChangeSend:#value2Changed to:application.
125
claus
parents: 122
diff changeset
   760
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   761
        top openModeless.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   762
                                                                        [exEnd]
120
claus
parents: 118
diff changeset
   763
"
19
a696fb528758 *** empty log message ***
claus
parents: 7
diff changeset
   764
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   765
892
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   766
!EditField class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   767
4028
Claus Gittinger <cg@exept.de>
parents: 4013
diff changeset
   768
defaultBorderColor
Claus Gittinger <cg@exept.de>
parents: 4013
diff changeset
   769
    ^ DefaultBorderColor
Claus Gittinger <cg@exept.de>
parents: 4013
diff changeset
   770
!
Claus Gittinger <cg@exept.de>
parents: 4013
diff changeset
   771
Claus Gittinger <cg@exept.de>
parents: 4013
diff changeset
   772
defaultBorderWidth
Claus Gittinger <cg@exept.de>
parents: 4013
diff changeset
   773
    ^ DefaultBorderWidth
Claus Gittinger <cg@exept.de>
parents: 4013
diff changeset
   774
!
Claus Gittinger <cg@exept.de>
parents: 4013
diff changeset
   775
125
claus
parents: 122
diff changeset
   776
defaultLeaveKeys
128
claus
parents: 127
diff changeset
   777
    "return the set of keys which are taken as leave-keys.
claus
parents: 127
diff changeset
   778
     If the field is in an enterFieldGroup, all leave keys will be
claus
parents: 127
diff changeset
   779
     forwarded to the group and possible step to the next/previous field.
claus
parents: 127
diff changeset
   780
     Also, if acceptOnLeave is true, leave keys will store the current
claus
parents: 127
diff changeset
   781
     value into their model (if any)"
claus
parents: 127
diff changeset
   782
125
claus
parents: 122
diff changeset
   783
    ^ #(Return CursorUp CursorDown Next Previous Accept)
claus
parents: 122
diff changeset
   784
!
claus
parents: 122
diff changeset
   785
4507
5d052c1b7f02 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
   786
defaultLevel
5d052c1b7f02 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
   787
    ^ DefaultLevel
5d052c1b7f02 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
   788
!
5d052c1b7f02 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
   789
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   790
defaultNumberOfLines
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   791
    "the number of lines in the field"
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   792
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   793
    ^ 1
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   794
!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   795
59
450ce95a72a4 *** empty log message ***
claus
parents: 47
diff changeset
   796
updateStyleCache
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   797
    "extract values from the styleSheet and cache them in class variables"
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   798
4013
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   799
    <resource: #style (#'editField.foregroundColor' 
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   800
                       #'editField.backgroundColor'
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   801
                       #'editField.selectionForegroundColor' 
4214
d98c74667441 changed: #updateStyleCache
Claus Gittinger <cg@exept.de>
parents: 4212
diff changeset
   802
                       #'editField.selectionBackgroundColor'
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1282
diff changeset
   803
                       #'editField.font')>
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   804
4910
eb2895fdb1d9 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4896
diff changeset
   805
    DefaultForegroundColor := StyleSheet colorAt:'editField.foregroundColor' default:Color black.
eb2895fdb1d9 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4896
diff changeset
   806
    DefaultBackgroundColor := StyleSheet colorAt:'editField.backgroundColor' default:Color white.
1834
2cad8377f2e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
   807
    DefaultSelectionForegroundColor := StyleSheet colorAt:'editField.selectionForegroundColor' default:nil.
2cad8377f2e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
   808
    DefaultSelectionForegroundColor isNil ifTrue:[
2cad8377f2e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
   809
        DefaultSelectionForegroundColor := StyleSheet colorAt:'selection.hilightForegroundColor' default:DefaultBackgroundColor.
2cad8377f2e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
   810
    ].
2cad8377f2e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
   811
    DefaultSelectionBackgroundColor := StyleSheet colorAt:'editField.selectionBackgroundColor' default:nil.
2cad8377f2e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
   812
    DefaultSelectionBackgroundColor isNil ifTrue:[
2cad8377f2e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
   813
        DefaultSelectionBackgroundColor := StyleSheet colorAt:'selection.hilightBackgroundColor' default:DefaultForegroundColor.
2cad8377f2e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
   814
    ].
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1282
diff changeset
   815
    DefaultFont := StyleSheet fontAt:'editField.font' default:nil.
4013
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   816
    DefaultBorderColor := StyleSheet colorAt:'editField.borderColor' default:nil. 
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   817
    DefaultBorderWidth := StyleSheet at:'editField.borderWidth' default:nil.  
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   818
    DefaultLevel := StyleSheet at:'editField.level' default:nil. 
59
450ce95a72a4 *** empty log message ***
claus
parents: 47
diff changeset
   819
450ce95a72a4 *** empty log message ***
claus
parents: 47
diff changeset
   820
    "
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   821
     self updateStyleCache
59
450ce95a72a4 *** empty log message ***
claus
parents: 47
diff changeset
   822
    "
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   823
4214
d98c74667441 changed: #updateStyleCache
Claus Gittinger <cg@exept.de>
parents: 4212
diff changeset
   824
    "Modified: / 19-01-2011 / 22:34:35 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   825
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   826
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   827
!EditField methodsFor:'accepting'!
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   828
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   829
accept
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   830
    "accept the current contents by executing the accept-action and/or
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   831
     changeMessage.
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   832
     Do this only if the contents of the EditField differs
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   833
     from the printed representation of the model."
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   834
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   835
    |string|
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   836
1108
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   837
    acceptEnabled == false ifTrue:[
3046
c2d66c9ba0d8 Send #beep to window instead of device
Stefan Vogel <sv@exept.de>
parents: 2995
diff changeset
   838
        self beep.
1108
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   839
        ^ self
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   840
    ].
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   841
2105
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   842
    (acceptIfUnchanged not
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   843
     and:[model notNil
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   844
     and:[(self convertEditValueToString:model value) = self contents]]) ifTrue:[
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   845
        ^ self
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   846
    ].
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   847
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   848
    super accept.
2105
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   849
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   850
    "a typeconverter can convert different strings to the same value 
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   851
     ('010' asInteger = '10' asInteger).
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   852
     Show the common string representation ('10') of the value"
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   853
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   854
    converter notNil ifTrue:[
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   855
        string := converter printStringFor:self editValue.
1108
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   856
        string ~= self contents ifTrue:[
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   857
            self contents:string.
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   858
            self flash
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
   859
        ].
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   860
    ].
1108
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   861
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   862
    "Modified: 7.3.1997 / 11:06:00 / cg"
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   863
! !
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   864
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   865
!EditField methodsFor:'accessing-behavior'!
125
claus
parents: 122
diff changeset
   866
2105
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   867
acceptIfUnchanged
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   868
    "return the acceptIfUnchanged flag setting.
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   869
     if set (the default), an accept notification is sent on accept,
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   870
     even if the fields value is the same. If cleared,
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   871
     the notification is suppressed, if the fields contents is the same."
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   872
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   873
    ^ acceptIfUnchanged
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   874
!
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   875
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   876
acceptIfUnchanged:aBoolean
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   877
    "if set (the default), an accept notification is sent on accept,
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   878
     even if the fields value is the same. If cleared,
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   879
     the notification is suppressed, if the fields contents is the same."
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   880
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   881
    acceptIfUnchanged := aBoolean
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   882
!
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
   883
2538
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   884
acceptOnLeave
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   885
    "returnr the acceptOnLeave flag. The default is false.
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   886
     If true, leaving the box (via return, cursor etc.) accepts my 
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   887
     string into the valueHolder (if any).
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   888
     (actually, the set of keys can be specified with #leaveKeys:)"
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   889
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   890
     ^ acceptOnLeave 
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   891
!
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   892
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   893
acceptOnLeave:aBoolean
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   894
    "set/clear the acceptOnLeave flag. The default is false.
892
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   895
     If true, leaving the box (via return, cursor etc.) accepts my 
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   896
     string into the valueHolder (if any).
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   897
     (actually, the set of keys can be specified with #leaveKeys:)"
125
claus
parents: 122
diff changeset
   898
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   899
     acceptOnLeave := aBoolean
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   900
892
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   901
    "Modified: 11.12.1996 / 16:47:25 / cg"
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   902
!
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   903
3082
1a438d1ed699 acceptOnLostFocus getter added
penk
parents: 3046
diff changeset
   904
acceptOnLostFocus
1a438d1ed699 acceptOnLostFocus getter added
penk
parents: 3046
diff changeset
   905
    ^ acceptOnLostFocus
1a438d1ed699 acceptOnLostFocus getter added
penk
parents: 3046
diff changeset
   906
!
1a438d1ed699 acceptOnLostFocus getter added
penk
parents: 3046
diff changeset
   907
892
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   908
acceptOnLostFocus:aBoolean
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   909
    "set/clear the acceptOnLostFocus flag. The default is false.
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   910
     If true, a lost focus (via mouse-pointer motion etc.) accepts my 
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   911
     string into the valueHolder (if any)."
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   912
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   913
     acceptOnLostFocus := aBoolean
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   914
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   915
    "Modified: 16.12.1995 / 16:26:45 / cg"
892
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
   916
    "Created: 11.12.1996 / 16:48:00 / cg"
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   917
!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   918
1937
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
   919
acceptOnPointerLeave:aBoolean
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
   920
    "set/clear the acceptOnPointerLeave flag. The default is false.
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
   921
     If true, a pointer leave (via mouse-pointer motion etc.) accepts my 
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
   922
     string into the valueHolder (if any)."
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
   923
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
   924
     acceptOnPointerLeave := aBoolean
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
   925
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
   926
    "Modified: / 16.12.1995 / 16:26:45 / cg"
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
   927
    "Created: / 28.6.1999 / 18:07:38 / cg"
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
   928
!
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
   929
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   930
acceptOnReturn:aBoolean
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   931
    "set/clear the acceptOnReturn flag. The default is false.
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   932
     If true, leaving the box via return accepts my 
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   933
     string into the valueHolder (if any)."
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   934
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   935
     acceptOnReturn := aBoolean
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   936
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   937
    "Modified: 16.12.1995 / 16:25:34 / cg"
125
claus
parents: 122
diff changeset
   938
!
claus
parents: 122
diff changeset
   939
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   940
acceptOnTab:aBoolean
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   941
    "set/clear the acceptOnTab flag. The default is true.
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   942
     If true, a pressed Tab key accepts and leaves the box.
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   943
     If false, the Tab key is treated like any normal input character
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   944
     (i.e. inserted into the contents)."
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   945
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   946
     acceptOnTab := aBoolean
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   947
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   948
    "Created: 24.1.1996 / 13:13:37 / cg"
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   949
!
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
   950
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   951
autoScroll:aBoolean
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   952
    "turn on/off automatic scrolling upon keyboard entry
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   953
     to make the cursor visible."
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   954
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   955
    autoScrollHorizontally := aBoolean
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   956
!
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   957
325
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   958
clickAction:aBlock
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   959
    "define an action to be evaluated when being clicked upon"
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   960
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   961
    clickAction := aBlock
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   962
!
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   963
2792
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   964
converter
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   965
    "return the converter (if any)."
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   966
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   967
    ^ converter
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   968
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   969
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   970
converter:aConverter
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   971
    "set the converter. If non-nil,
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   972
     the converter is applied to the text to convert from the string
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   973
     representation to the actual object value and vice versa.
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   974
     The default converter is nil, meaning no-conversion
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   975
     (i.e. the edited object is the string itself."
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   976
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   977
    converter := aConverter
6192
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   978
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   979
    "
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   980
     |field model|
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   981
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   982
     model := 0.5 asValue.
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   983
     field := EditField new.
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   984
     field model:model.
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   985
     field converter:(PrintConverter new initForNumber).
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   986
     model onChangeEvaluate:[ Transcript showCR: model value ].
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   987
     field open.
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   988
    "
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   989
3d0f6912e305 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6190
diff changeset
   990
    "Modified (comment): / 24-08-2017 / 16:16:20 / cg"
2792
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   991
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   992
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   993
crAction:aBlock
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   994
    "define an action to be evaluated when the return key is pressed."
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   995
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   996
    crAction := aBlock
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
   997
!
125
claus
parents: 122
diff changeset
   998
3216
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
   999
doubleClickAction:aBlock
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1000
    "define an action to be evaluated when being double clicked upon"
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1001
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1002
    doubleClickAction := aBlock
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1003
!
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1004
1034
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1005
enabled
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1006
    "return true, if the field is enabled (i.e. accepts keyboard input)"
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1007
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1008
    ^ enabled ? true 
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1009
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1010
!
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1011
1829
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1012
enabled:aBoolean
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1013
    "enable/disable the field; show/hide the cursor and allow/disallow input"
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1014
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1015
    enabled ~~ aBoolean ifTrue:[
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1016
        enabled := aBoolean.
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1017
        self updateBackground.
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1018
        super cursorShown:aBoolean
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1019
    ]
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1020
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1021
    "Modified: / 3.8.1998 / 17:52:18 / cg"
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1022
    "Created: / 30.3.1999 / 15:19:17 / stefan"
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1023
    "Modified: / 30.3.1999 / 16:00:43 / stefan"
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1024
!
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1025
2993
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1026
entryCompletionBlock
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1027
    "the action to be evaluated when Tab (EntryCompletionCharacter) is pressed.
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1028
     The block gets the current contents and the field itself as optional arguments
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1029
     (i.e. it can be a 0, 1 or 2-arg block)."
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1030
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1031
    "/ read comment in entryCompletionBlockHolder: on why the following kludge is present
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1032
    entryCompletionBlock isBlock ifTrue:[
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1033
        ^ entryCompletionBlock
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1034
    ].
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1035
    ^ entryCompletionBlock value
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1036
!
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1037
2995
45b695aa5065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2994
diff changeset
  1038
entryCompletionBlock:aZeroOneOrTwoArgBlock
2993
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1039
    "define an action to be evaluated when Tab (EntryCompletionCharacter) is pressed.
2628
619483f17989 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  1040
     The block gets the current contents and the field itself as optional arguments
619483f17989 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  1041
     (i.e. it can be a 0, 1 or 2-arg block)."
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1042
2995
45b695aa5065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2994
diff changeset
  1043
    entryCompletionBlock := aZeroOneOrTwoArgBlock
125
claus
parents: 122
diff changeset
  1044
!
claus
parents: 122
diff changeset
  1045
2995
45b695aa5065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2994
diff changeset
  1046
entryCompletionBlockHolder:aZeroOneOrTwoArgBlock
2993
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1047
    "a holder for an action to be evaluated when Tab (EntryCompletionCharacter) is pressed.
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1048
     The block gets the current contents and the field itself as optional arguments
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1049
     (i.e. it can be a 0, 1 or 2-arg block)."
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1050
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1051
    "/ for now (to avoid incompatibilities), misuse the existing
6095
65ed08296dcb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5973
diff changeset
  1052
    "/ entryCompletionBlock and check if it's a holder.
2993
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1053
2995
45b695aa5065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2994
diff changeset
  1054
    entryCompletionBlock := aZeroOneOrTwoArgBlock
6095
65ed08296dcb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5973
diff changeset
  1055
65ed08296dcb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5973
diff changeset
  1056
    "Modified (comment): / 13-02-2017 / 20:09:56 / cg"
2993
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1057
!
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1058
3990
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1059
entryCompletionCharacter
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1060
    "return the value of the instance variable 'entryCompletionCharacter' (automatically generated)"
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1061
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1062
    ^ entryCompletionCharacter
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1063
!
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1064
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1065
immediateAccept:aBoolean
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1066
    "set/clear the immediateAccept flag. The default is false.
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1067
     If true, every pressed key immediately accepts my 
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1068
     string into the valueHolder (if any)."
155
claus
parents: 144
diff changeset
  1069
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1070
     immediateAccept := aBoolean
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1071
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1072
    "Modified: 16.12.1995 / 16:25:57 / cg"
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1073
!
155
claus
parents: 144
diff changeset
  1074
995
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1075
isAcceptOnLeave
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1076
    "return the acceptOnLeave flag. The default is false.
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1077
     If true, leaving the box (via return, cursor etc.) accepts my 
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1078
     string into the valueHolder (if any).
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1079
     (actually, the set of keys can be specified with #leaveKeys:)"
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1080
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1081
     ^ acceptOnLeave 
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1082
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1083
    "Modified: 11.12.1996 / 16:47:25 / cg"
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1084
!
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1085
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1086
isAcceptOnLostFocus
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1087
    "return the acceptOnLostFocus flag. The default is false.
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1088
     If true, a lost focus (via mouse-pointer motion etc.) accepts my 
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1089
     string into the valueHolder (if any)."
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1090
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1091
     ^ acceptOnLostFocus
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1092
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1093
    "Modified: 16.12.1995 / 16:26:45 / cg"
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1094
    "Created: 11.12.1996 / 16:48:00 / cg"
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1095
!
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1096
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1097
isAcceptOnReturn
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1098
    "return the acceptOnReturn flag. The default is false.
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1099
     If true, leaving the box via return accepts my 
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1100
     string into the valueHolder (if any)."
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1101
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1102
     ^ acceptOnReturn 
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1103
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1104
    "Modified: 16.12.1995 / 16:25:34 / cg"
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1105
!
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1106
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1107
isAcceptOnTab
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1108
    "return the acceptOnTab flag. The default is true.
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1109
     If true, a pressed Tab key accepts and leaves the box.
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1110
     If false, the Tab key is treated like any normal input character
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1111
     (i.e. inserted into the contents)."
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1112
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1113
     ^ acceptOnTab
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1114
!
493b62566907 more isXXX queries
ca
parents: 994
diff changeset
  1115
994
72ab84c42334 added #isImmediateAccept
ca
parents: 979
diff changeset
  1116
isImmediateAccept
72ab84c42334 added #isImmediateAccept
ca
parents: 979
diff changeset
  1117
    "return the immediateAccept flag. The default is false.
72ab84c42334 added #isImmediateAccept
ca
parents: 979
diff changeset
  1118
     If true, every pressed key immediately accepts my 
72ab84c42334 added #isImmediateAccept
ca
parents: 979
diff changeset
  1119
     string into the valueHolder (if any)."
72ab84c42334 added #isImmediateAccept
ca
parents: 979
diff changeset
  1120
72ab84c42334 added #isImmediateAccept
ca
parents: 979
diff changeset
  1121
     ^ immediateAccept
72ab84c42334 added #isImmediateAccept
ca
parents: 979
diff changeset
  1122
72ab84c42334 added #isImmediateAccept
ca
parents: 979
diff changeset
  1123
    "Modified: 16.12.1995 / 16:25:57 / cg"
72ab84c42334 added #isImmediateAccept
ca
parents: 979
diff changeset
  1124
!
72ab84c42334 added #isImmediateAccept
ca
parents: 979
diff changeset
  1125
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1126
leaveAction:aBlock
4720
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1127
    "define an action to be evaluated when field is left by a leave-key
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1128
     (by default: return or cursor keys.
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1129
     Actually, the set of keys can be specified with #leaveKeys:
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1130
     On leave, the precedence of actions is:
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1131
       1) explicit leaveAction per key
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1132
       2) this general leaveAction
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1133
       3) tab or return action
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1134
"
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1135
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1136
    leaveAction := aBlock
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1137
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1138
    "Modified: 16.12.1995 / 16:26:36 / cg"
155
claus
parents: 144
diff changeset
  1139
!
claus
parents: 144
diff changeset
  1140
3990
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1141
leaveKey
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1142
    "only valid after the editField has been left via a leaveCharacter.
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1143
     Allows for users of the EditField to advance the selection 
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1144
     (especially: DataSets to select next/prev if editor is left via CrsrUp/Down)"
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1145
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1146
    ^ leaveKey
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1147
!
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1148
1997
f509850c3240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1993
diff changeset
  1149
leaveKeys
1998
634d18238938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  1150
    "return (a copy of) the collection of keys which are interpreted as leaveKeys.
634d18238938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  1151
     I.e. those that make the field inactive and pass the focus to the next field
634d18238938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  1152
     (and accept, if acceptOnLeave is true)"
1997
f509850c3240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1993
diff changeset
  1153
f509850c3240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1993
diff changeset
  1154
    ^ leaveKeys copy
f509850c3240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1993
diff changeset
  1155
!
f509850c3240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1993
diff changeset
  1156
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1157
leaveKeys:aCollectionOfKeySymbols 
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1158
    "define the set of keys which are interpreted as leaveKeys.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1159
     I.e. those that make the field inactive and accept (if acceptOnLeave is true).
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1160
     The default is a set of #CursorUp, #CursorDown, #Next, #Prior and #Return."
155
claus
parents: 144
diff changeset
  1161
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1162
    leaveKeys := aCollectionOfKeySymbols
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1163
!
155
claus
parents: 144
diff changeset
  1164
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1165
makeTabable
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1166
    "arrange for Tab to accept & leave the field
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1167
     If the field is part of a group, the next field gets the
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1168
     input focus"
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1169
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1170
    leaveKeys isNil ifTrue:[
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1171
        leaveKeys := self class defaultLeaveKeys
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1172
    ].
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1173
    leaveKeys := leaveKeys copyWith:#Tab
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1174
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1175
    "Created: 27.4.1996 / 17:09:48 / cg"
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1176
!
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1177
4720
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1178
onKey:aKey leaveWith:aBlock
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1179
    "arrange for aKey to leave the field and evalaute aBlock.
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1180
     On leave, the precedence of actions is:
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1181
       1) explicit leaveAction per key
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1182
       2) general leaveAction
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1183
       3) tab or return action
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1184
     Can be used to arrange for cursorDown to pass focus to another widget."
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1185
4724
10440165e22e class: EditField
Claus Gittinger <cg@exept.de>
parents: 4720
diff changeset
  1186
    leaveKeys := leaveKeys asOrderedCollection.
4720
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1187
    leaveKeys add:aKey.
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1188
    leaveKeyActions isNil ifTrue:[
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1189
        leaveKeyActions := Dictionary new.
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1190
    ].
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1191
    leaveKeyActions at:aKey put:aBlock.
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1192
!
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1193
1609
8a0c1ee30a0a readOnly fields change the backgroundColor to grey.
Claus Gittinger <cg@exept.de>
parents: 1547
diff changeset
  1194
readOnly:aBoolean
8a0c1ee30a0a readOnly fields change the backgroundColor to grey.
Claus Gittinger <cg@exept.de>
parents: 1547
diff changeset
  1195
    "make the text readonly or writable"
8a0c1ee30a0a readOnly fields change the backgroundColor to grey.
Claus Gittinger <cg@exept.de>
parents: 1547
diff changeset
  1196
8a0c1ee30a0a readOnly fields change the backgroundColor to grey.
Claus Gittinger <cg@exept.de>
parents: 1547
diff changeset
  1197
    super readOnly:aBoolean.
1631
f8fae6670540 change viewBackground, when either disabled or readOnly.
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  1198
    self updateBackground.
1609
8a0c1ee30a0a readOnly fields change the backgroundColor to grey.
Claus Gittinger <cg@exept.de>
parents: 1547
diff changeset
  1199
8a0c1ee30a0a readOnly fields change the backgroundColor to grey.
Claus Gittinger <cg@exept.de>
parents: 1547
diff changeset
  1200
    "Created: / 26.7.1998 / 21:23:17 / cg"
1631
f8fae6670540 change viewBackground, when either disabled or readOnly.
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  1201
    "Modified: / 3.8.1998 / 17:52:38 / cg"
1609
8a0c1ee30a0a readOnly fields change the backgroundColor to grey.
Claus Gittinger <cg@exept.de>
parents: 1547
diff changeset
  1202
!
8a0c1ee30a0a readOnly fields change the backgroundColor to grey.
Claus Gittinger <cg@exept.de>
parents: 1547
diff changeset
  1203
1842
b5069ac92167 added #returnKeyIsFocusNext
Claus Gittinger <cg@exept.de>
parents: 1836
diff changeset
  1204
returnKeyIsFocusNext
b5069ac92167 added #returnKeyIsFocusNext
Claus Gittinger <cg@exept.de>
parents: 1836
diff changeset
  1205
    "arrange for the return key to act as a focus-next key"
b5069ac92167 added #returnKeyIsFocusNext
Claus Gittinger <cg@exept.de>
parents: 1836
diff changeset
  1206
3975
73674d16fc63 copy asOrderedCollection -> copyAsOrderedCollection
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1207
    leaveKeys := leaveKeys copyAsOrderedCollection. 
1842
b5069ac92167 added #returnKeyIsFocusNext
Claus Gittinger <cg@exept.de>
parents: 1836
diff changeset
  1208
    leaveKeys remove:#Return ifAbsent:nil
b5069ac92167 added #returnKeyIsFocusNext
Claus Gittinger <cg@exept.de>
parents: 1836
diff changeset
  1209
!
b5069ac92167 added #returnKeyIsFocusNext
Claus Gittinger <cg@exept.de>
parents: 1836
diff changeset
  1210
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1211
tabAction:aBlock
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1212
    "define an action to be evaluated when the tabulator key is pressed."
155
claus
parents: 144
diff changeset
  1213
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1214
    tabAction := aBlock
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1215
!
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1216
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1217
tabKey:aKeySymbol 
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1218
    "arrange for aKeySymbol to accept & leave the field
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1219
     If the field is part of a group, the next field gets the
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1220
     input focus"
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1221
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1222
    leaveKeys isNil ifTrue:[
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1223
        leaveKeys := self class defaultLeaveKeys
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1224
    ].
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1225
    leaveKeys := leaveKeys copyWith:#Tab
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1226
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1227
    "Created: 27.4.1996 / 17:08:54 / cg"
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1228
! !
125
claus
parents: 122
diff changeset
  1229
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1230
!EditField methodsFor:'accessing-contents'!
125
claus
parents: 122
diff changeset
  1231
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1232
contents
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1233
    "return contents as a string
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1234
     - redefined since EditFields hold only one line of text.
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1235
    In your application, please use #editValue; 
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1236
    it uses a converter (if any) and is compatible to ST-80."
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1237
3706
d25f10e7b49b #accept only, if the text field has been modified (DrawAdaptor compatibility)
Stefan Vogel <sv@exept.de>
parents: 3704
diff changeset
  1238
    (list isEmptyOrNil) ifTrue:[^ ''].
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1239
    ^ list at:1
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1240
!
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1241
125
claus
parents: 122
diff changeset
  1242
contents:someText
claus
parents: 122
diff changeset
  1243
    "set the contents from a string
claus
parents: 122
diff changeset
  1244
     - redefined to place the cursor to the end.
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1245
    In your application, please use #editValue: - 
125
claus
parents: 122
diff changeset
  1246
    it uses a converter (if any) and is compatible to ST-80."
claus
parents: 122
diff changeset
  1247
1180
abe00ac05e27 oops - care for nil contents
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  1248
    |newCol txt|
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1249
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1250
    newCol := cursorCol.
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1251
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1252
    someText isNil ifTrue:[
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1253
        txt := ''.
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1254
    ] ifFalse:[
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1255
        txt := someText asString.
1180
abe00ac05e27 oops - care for nil contents
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  1256
    ].
abe00ac05e27 oops - care for nil contents
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  1257
    super contents:txt.
125
claus
parents: 122
diff changeset
  1258
2130
40515380f762 moved control over how-to-move-the-cursor when updating text
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
  1259
    (cursorMovementWhenUpdating == #endOfLine
40515380f762 moved control over how-to-move-the-cursor when updating text
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
  1260
    or:[cursorMovementWhenUpdating == #endOfText
40515380f762 moved control over how-to-move-the-cursor when updating text
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
  1261
    or:[cursorMovementWhenUpdating == #end]]) ifTrue:[
1180
abe00ac05e27 oops - care for nil contents
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  1262
         newCol := (txt size + 1).
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1263
    ] ifFalse:[
2130
40515380f762 moved control over how-to-move-the-cursor when updating text
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
  1264
        (cursorMovementWhenUpdating == #beginOfLine
40515380f762 moved control over how-to-move-the-cursor when updating text
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
  1265
        or:[cursorMovementWhenUpdating == #beginOfText
40515380f762 moved control over how-to-move-the-cursor when updating text
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
  1266
        or:[cursorMovementWhenUpdating == #begin]]) ifTrue:[
1179
7ae3148ca2e4 convert to string.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1267
            newCol := 1
7ae3148ca2e4 convert to string.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1268
        ] ifFalse:[
7ae3148ca2e4 convert to string.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1269
            "/ default: stay where it was
7ae3148ca2e4 convert to string.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1270
        ]
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1271
    ].
125
claus
parents: 122
diff changeset
  1272
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1273
    self cursorCol:newCol.
1179
7ae3148ca2e4 convert to string.
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
  1274
2042
7080474e7966 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
  1275
    "Modified: / 13.11.1999 / 13:50:30 / cg"
125
claus
parents: 122
diff changeset
  1276
!
claus
parents: 122
diff changeset
  1277
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1278
convertEditValueToString:aStringOrObject
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1279
    "convert a aStringOrObject to a printed representation. 
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1280
     If there is a converter, use it to convert
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1281
     the object into a printed representation.
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1282
     Use asString to convert the object,
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1283
     and used directly."
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1284
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1285
    converter notNil ifTrue:[
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1286
        ^ converter printStringFor:aStringOrObject
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1287
    ].
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1288
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1289
    aStringOrObject isNil ifTrue:[
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1290
        ^ ''.
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1291
    ].
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1292
    ^ aStringOrObject asString.
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1293
!
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1294
125
claus
parents: 122
diff changeset
  1295
editValue
claus
parents: 122
diff changeset
  1296
    "if the field edits a string, this is a name alias for #contents.
claus
parents: 122
diff changeset
  1297
     Otherwise, if there is a converter, return the edited string
claus
parents: 122
diff changeset
  1298
     converted to an appropriate object."
claus
parents: 122
diff changeset
  1299
claus
parents: 122
diff changeset
  1300
    |string|
claus
parents: 122
diff changeset
  1301
claus
parents: 122
diff changeset
  1302
    string := self contents.
279
b9fa9180aca4 empty strings are not nil
ca
parents: 261
diff changeset
  1303
    string isNil ifTrue:[string := ''].
125
claus
parents: 122
diff changeset
  1304
    converter isNil ifTrue:[^ string].
claus
parents: 122
diff changeset
  1305
    ^ converter readValueFrom:string 
claus
parents: 122
diff changeset
  1306
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1307
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1308
editValue:anObject
125
claus
parents: 122
diff changeset
  1309
    "set the contents. If there is a converter, use it to convert
claus
parents: 122
diff changeset
  1310
     the object into a printed representation.
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1311
     Otherwise, convert anObject to a string using #asString
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1312
     (this is equivalent to sending #contents:)."
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1313
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1314
    self editValue:anObject selected:false
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1315
!
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1316
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1317
editValue:anObject selected:isSelected
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1318
    "set the contents. If there is a converter, use it to convert
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1319
     anObject into a printed representation.
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1320
     Otherwise, use anObject asString
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1321
     (i.e. this is equivalent to sending #initialText:selected:)."
125
claus
parents: 122
diff changeset
  1322
claus
parents: 122
diff changeset
  1323
    |string|
claus
parents: 122
diff changeset
  1324
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1325
    string := self convertEditValueToString:anObject.
125
claus
parents: 122
diff changeset
  1326
    self contents:string.
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1327
    isSelected ifTrue:[
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1328
        self selectFromLine:1 col:1 toLine:1 col:string size.
125
claus
parents: 122
diff changeset
  1329
    ]
claus
parents: 122
diff changeset
  1330
!
claus
parents: 122
diff changeset
  1331
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1332
initialText:aString
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1333
    "set the initialText and select it.
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1334
     Better use #editValue: - it uses the type converter."
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1335
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1336
    self initialText:aString selected:true
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1337
!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1338
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1339
initialText:aString selected:isSelected
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1340
    "set the initialText and select it if isSelected is true
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1341
     Better use #editValue:selected: - it uses the type converter."
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1342
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1343
    |len s|
125
claus
parents: 122
diff changeset
  1344
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  1345
    viewOrigin := 0 @ viewOrigin y.
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  1346
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1347
    self contents:aString.
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1348
    isSelected ifTrue:[
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1349
        s := self contents.
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1350
        len := s size.
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1351
        len ~~ 0 ifTrue:[
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  1352
            self selectFromLine:1 col:1 toLine:1 col:len
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  1353
        ]
3709
a17acdae3e35 Modify previous change: only change the model, if the EditField's text
Stefan Vogel <sv@exept.de>
parents: 3706
diff changeset
  1354
    ].
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1355
!
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1356
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1357
list:someText
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1358
    "low level access to the underlying contents' list.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1359
     Redefined to force text to 1 line, and notify dependents
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1360
     of any changed extent-wishes (for automatic box resizing)."
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1361
6195
076be3d30b41 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6192
diff changeset
  1362
    |l oldWidth newWidth|
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1363
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1364
    l := someText.
4992
7d8b66d3c846 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4991
diff changeset
  1365
    l notEmptyOrNil ifTrue:[
1103
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1366
        l := OrderedCollection with:(l at:1)
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1367
    ].
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1368
    oldWidth := self widthOfContents.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1369
    super list:l.
6195
076be3d30b41 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6192
diff changeset
  1370
    newWidth := self widthOfContents.
076be3d30b41 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6192
diff changeset
  1371
    (newWidth > oldWidth and:[newWidth > self innerWidth]) ifTrue:[
1103
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1372
        self changedPreferredBounds:nil
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1373
    ]
1103
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1374
6195
076be3d30b41 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6192
diff changeset
  1375
    "Modified: / 24-08-2017 / 17:00:01 / cg"
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1376
!
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1377
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1378
stringValue
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1379
    "alias for #contents - for compatibility with ST-80's InputField"
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1380
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1381
    ^ self contents
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1382
! !
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1383
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1384
!EditField methodsFor:'accessing-look'!
125
claus
parents: 122
diff changeset
  1385
3585
16dfdbd231c2 +bePassword
Claus Gittinger <cg@exept.de>
parents: 3535
diff changeset
  1386
bePassword
16dfdbd231c2 +bePassword
Claus Gittinger <cg@exept.de>
parents: 3535
diff changeset
  1387
    "make me a password entry field (i.e. show *'s for typed characters"
16dfdbd231c2 +bePassword
Claus Gittinger <cg@exept.de>
parents: 3535
diff changeset
  1388
16dfdbd231c2 +bePassword
Claus Gittinger <cg@exept.de>
parents: 3535
diff changeset
  1389
    self passwordCharacter:$*
16dfdbd231c2 +bePassword
Claus Gittinger <cg@exept.de>
parents: 3535
diff changeset
  1390
!
16dfdbd231c2 +bePassword
Claus Gittinger <cg@exept.de>
parents: 3535
diff changeset
  1391
3990
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1392
emptyFieldReplacementText
3991
9bf5fb90853f comments:
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  1393
    "the string to show in grey if nothing has been entered (and the field is passive)"
3990
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1394
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1395
    ^ emptyFieldReplacementText
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1396
!
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1397
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1398
emptyFieldReplacementText:something
3991
9bf5fb90853f comments:
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  1399
    "the string to show in grey if nothing has been entered (and the field is passive)"
3990
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1400
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1401
    emptyFieldReplacementText := something.
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1402
!
6a7e190c11cd category of:
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  1403
4989
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1404
font:aFont
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1405
    super font:aFont.
5044
db43a967ff95 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5043
diff changeset
  1406
    realized ifTrue:[ self computeTopMargin ].
4989
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1407
!
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1408
155
claus
parents: 144
diff changeset
  1409
maxChars
claus
parents: 144
diff changeset
  1410
    "return the maximum number of characters that are allowed in
claus
parents: 144
diff changeset
  1411
     the field. 
claus
parents: 144
diff changeset
  1412
     A limit of nil means: unlimited. This is the default."
claus
parents: 144
diff changeset
  1413
claus
parents: 144
diff changeset
  1414
    ^ lengthLimit
claus
parents: 144
diff changeset
  1415
claus
parents: 144
diff changeset
  1416
    "Modified: 6.9.1995 / 13:43:33 / claus"
claus
parents: 144
diff changeset
  1417
!
claus
parents: 144
diff changeset
  1418
125
claus
parents: 122
diff changeset
  1419
maxChars:aNumberOrNil
claus
parents: 122
diff changeset
  1420
    "set the maximum number of characters that are allowed in
claus
parents: 122
diff changeset
  1421
     the field. Additional input will be ignored by the field.
1034
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1422
     A limit of nil or zero means: unlimited. This is the default.
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1423
     If set, a lengthLimit must be defined before any contents is placed
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1424
     into the field, because the contents is not cut when the max is
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1425
     changed later. I.e. it should be set early after creation of the field.
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1426
125
claus
parents: 122
diff changeset
  1427
     This method has been renamed from #lengthLimit: for ST-80
claus
parents: 122
diff changeset
  1428
     compatibility."
claus
parents: 122
diff changeset
  1429
1034
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1430
    aNumberOrNil == 0 ifTrue:[
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1431
        lengthLimit := nil
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1432
    ] ifFalse:[
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1433
        lengthLimit := aNumberOrNil.
d6d5d222f166 added #enabled.
ca
parents: 995
diff changeset
  1434
    ]
187
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1435
!
1a429506fad6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1436
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1437
passwordCharacter
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1438
    "return the passwordCharacter;
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1439
     If nonNil, that one is replacing typed input
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1440
     (for secret input)"
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1441
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1442
    ^ passwordCharacter
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1443
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1444
    "Modified: 6.9.1995 / 12:25:39 / claus"
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1445
    "Modified: 16.12.1995 / 16:24:25 / cg"
125
claus
parents: 122
diff changeset
  1446
!
claus
parents: 122
diff changeset
  1447
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1448
passwordCharacter:aCharacter
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1449
    "set the passwordCharacter;
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1450
     If nonNil, that one is replacing typed input
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1451
     (for secret input)"
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1452
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1453
    passwordCharacter := aCharacter
97
cbf495fe3b64 *** empty log message ***
claus
parents: 77
diff changeset
  1454
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1455
    "Modified: 6.9.1995 / 12:25:33 / claus"
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1456
    "Modified: 16.12.1995 / 16:24:33 / cg"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
  1457
! !
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 19
diff changeset
  1458
1829
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1459
!EditField methodsFor:'cursor drawing'!
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1460
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1461
cursorShown:aBoolean
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1462
    "make cursor visible if currently invisible - but only if this
1880
3ad00c12541e comment
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1463
     EditField is enabled. 
3ad00c12541e comment
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1464
     Return the previous cursor-shown-state"
1399
a3dd97770d99 release channels on destroy
Claus Gittinger <cg@exept.de>
parents: 1372
diff changeset
  1465
1836
97361bf30af6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1834
diff changeset
  1466
    ^ super cursorShown:(aBoolean and:[enabled and:[self isReadOnly not]])
1399
a3dd97770d99 release channels on destroy
Claus Gittinger <cg@exept.de>
parents: 1372
diff changeset
  1467
1829
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1468
    "Created: / 30.3.1999 / 16:00:25 / stefan"
1880
3ad00c12541e comment
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1469
    "Modified: / 1.4.1999 / 11:18:38 / cg"
1829
30b8981385f4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1470
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1471
155
claus
parents: 144
diff changeset
  1472
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg
claus
parents: 144
diff changeset
  1473
    startVisLineNr to:endVisLineNr do:[:visLine |
claus
parents: 144
diff changeset
  1474
	self drawVisibleLine:visLine with:fg and:bg
claus
parents: 144
diff changeset
  1475
    ]
claus
parents: 144
diff changeset
  1476
claus
parents: 144
diff changeset
  1477
    "Modified: 6.9.1995 / 12:24:29 / claus"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1478
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1479
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1480
!EditField methodsFor:'cursor movement'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1481
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1482
cursorDown
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1483
    "catch cursor movement"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1484
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1485
    (cursorVisibleLine == nLinesShown) ifFalse:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 47
diff changeset
  1486
	super cursorDown
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1487
    ]
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1488
!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1489
6222
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  1490
cursorLeft
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  1491
    super cursorLeft
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  1492
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  1493
    "Created: / 23-10-2017 / 18:28:38 / cg"
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  1494
!
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  1495
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1496
cursorLine:line col:col
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1497
    "catch cursor movement"
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1498
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1499
    super cursorLine:1 col:col
673
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1500
!
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1501
5055
392e14014bba class: EditField
Claus Gittinger <cg@exept.de>
parents: 5044
diff changeset
  1502
cursorLine:line col:col makeVisible:aBoolean
392e14014bba class: EditField
Claus Gittinger <cg@exept.de>
parents: 5044
diff changeset
  1503
    "catch cursor movement"
392e14014bba class: EditField
Claus Gittinger <cg@exept.de>
parents: 5044
diff changeset
  1504
392e14014bba class: EditField
Claus Gittinger <cg@exept.de>
parents: 5044
diff changeset
  1505
    super cursorLine:1 col:col makeVisible:aBoolean
392e14014bba class: EditField
Claus Gittinger <cg@exept.de>
parents: 5044
diff changeset
  1506
!
392e14014bba class: EditField
Claus Gittinger <cg@exept.de>
parents: 5044
diff changeset
  1507
673
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1508
validateCursorCol:col inLine:line
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1509
    "check of col is a valid cursor position;
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1510
     return a fixed value if not."
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1511
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1512
    |sz|
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1513
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1514
    sz := self contents size.
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1515
    lengthLimit notNil ifTrue:[
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1516
        sz := sz min:lengthLimit.
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1517
    ].
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1518
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1519
    col <= sz ifTrue:[
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1520
        ^ col
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1521
    ].
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1522
    ^ sz + 1.  "/ to allow positioning right behind the string
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1523
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1524
    "Created: 22.5.1996 / 18:17:27 / cg"
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1525
    "Modified: 22.5.1996 / 18:19:04 / cg"
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1526
! !
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1527
3413
49d0f37f0616 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3408
diff changeset
  1528
!EditField methodsFor:'drag & drop'!
49d0f37f0616 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3408
diff changeset
  1529
49d0f37f0616 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3408
diff changeset
  1530
dropFileObject:aDropObject
49d0f37f0616 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3408
diff changeset
  1531
    "drop objects
49d0f37f0616 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3408
diff changeset
  1532
     Redefined to always drop the name only"
49d0f37f0616 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3408
diff changeset
  1533
3797
69edb2e7436c code formatting
Claus Gittinger <cg@exept.de>
parents: 3768
diff changeset
  1534
    self 
4115
d72bec20db99 changed: #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
  1535
        undoablePasteReplacingAll:(aDropObject asFilename pathName) 
3797
69edb2e7436c code formatting
Claus Gittinger <cg@exept.de>
parents: 3768
diff changeset
  1536
        info:'Drop Filename'.
3413
49d0f37f0616 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3408
diff changeset
  1537
49d0f37f0616 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3408
diff changeset
  1538
    "Created: / 13-10-2006 / 17:42:22 / cg"
3494
34917a0f9072 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
  1539
    "Modified: / 28-07-2007 / 13:27:32 / cg"
3413
49d0f37f0616 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3408
diff changeset
  1540
! !
49d0f37f0616 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3408
diff changeset
  1541
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1542
!EditField methodsFor:'editing'!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1543
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1544
paste:someText
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1545
    "redefined to force text to 1 line"
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1546
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1547
    super paste:someText.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1548
    list size > 1 ifTrue:[
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1549
	self deleteFromLine:2 toLine:(list size)
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1550
    ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1551
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1552
70
14443a9ea4ec *** empty log message ***
claus
parents: 62
diff changeset
  1553
!EditField methodsFor:'event handling'!
19
a696fb528758 *** empty log message ***
claus
parents: 7
diff changeset
  1554
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1555
buttonPress:button x:x y:y
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1556
    "enable myself on mouse click"
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1557
673
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1558
    |prevFocus|
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1559
3703
5463ea3878b0 you can copy from the menu even if disabled.
Claus Gittinger <cg@exept.de>
parents: 3702
diff changeset
  1560
    enabled ifTrue:[
5463ea3878b0 you can copy from the menu even if disabled.
Claus Gittinger <cg@exept.de>
parents: 3702
diff changeset
  1561
        prevFocus := hasKeyboardFocus.
5463ea3878b0 you can copy from the menu even if disabled.
Claus Gittinger <cg@exept.de>
parents: 3702
diff changeset
  1562
        clickAction notNil ifTrue:[
5463ea3878b0 you can copy from the menu even if disabled.
Claus Gittinger <cg@exept.de>
parents: 3702
diff changeset
  1563
            clickAction value:self
5463ea3878b0 you can copy from the menu even if disabled.
Claus Gittinger <cg@exept.de>
parents: 3702
diff changeset
  1564
        ].
5463ea3878b0 you can copy from the menu even if disabled.
Claus Gittinger <cg@exept.de>
parents: 3702
diff changeset
  1565
        hasKeyboardFocus ~~ prevFocus ifTrue:[
5463ea3878b0 you can copy from the menu even if disabled.
Claus Gittinger <cg@exept.de>
parents: 3702
diff changeset
  1566
            ^ self
5463ea3878b0 you can copy from the menu even if disabled.
Claus Gittinger <cg@exept.de>
parents: 3702
diff changeset
  1567
        ].
673
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1568
    ].
316
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1569
    super buttonPress:button x:x y:y
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1570
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1571
"/    enabled ifFalse:[
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1572
"/        enabled := true.
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1573
"/        super buttonPress:button x:x y:y.
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1574
"/        enableAction notNil ifTrue:[
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1575
"/            enableAction value
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1576
"/        ]
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1577
"/    ] ifTrue:[
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1578
"/        super buttonPress:button x:x y:y
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1579
"/    ]
333
f1c500f177d8 handle disabled state
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1580
673
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  1581
    "Modified: 22.5.1996 / 15:02:45 / cg"
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1582
!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1583
6117
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1584
buttonRelease:button x:x y:y
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1585
    "if the selection is empty (because of validateSelection, 
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1586
     clear it alltogether, so that the cursor becomes visible again"
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1587
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1588
    (selectionStartCol notNil and:[selectionEndCol notNil
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1589
      and:[ selectionStartLine == 1 and:[selectionEndLine == 1]]]) ifTrue:[
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1590
        selectionEndCol < selectionStartCol ifTrue:[
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1591
            selectionStartCol := selectionEndCol := nil.
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1592
            selectionStartLine := selectionEndLine := nil.
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1593
        ]
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1594
    ].
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1595
    super buttonRelease:button x:x y:y
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1596
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1597
    "Created: / 07-03-2017 / 15:52:56 / cg"
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1598
!
026e468c7585 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
  1599
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1600
canHandle:aKey
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1601
    "return true, if the receiver would like to handle aKey
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1602
     (usually from another view, when the receiver is part of
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1603
      a more complex dialog box).
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1604
     We do return true here, since the editfield will handle
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1605
     all keys.
5594
09e1ac49efce #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5542
diff changeset
  1606
     OBSOLETE: don't use this anymore - its a leftover for the tableWidget"
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1607
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1608
    ^ true
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1609
!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1610
3216
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1611
doubleClickX:x y:y
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1612
    doubleClickAction notNil ifTrue: [
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1613
        doubleClickAction value.
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1614
    ].
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1615
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1616
    super doubleClickX:x y:y
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1617
!
8161c0b4b38e add double click action
ab
parents: 3082
diff changeset
  1618
4608
7c0f79a2d2d8 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4540
diff changeset
  1619
handleCompletionService
7c0f79a2d2d8 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4540
diff changeset
  1620
    "none here"
7c0f79a2d2d8 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4540
diff changeset
  1621
7c0f79a2d2d8 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4540
diff changeset
  1622
    ^ self
7c0f79a2d2d8 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4540
diff changeset
  1623
!
7c0f79a2d2d8 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4540
diff changeset
  1624
3460
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1625
handleFocusKey:key
3535
1c9f308b2eec comment
Claus Gittinger <cg@exept.de>
parents: 3494
diff changeset
  1626
    "handle a focus key, to assign the focus to another field in my group"
1c9f308b2eec comment
Claus Gittinger <cg@exept.de>
parents: 3494
diff changeset
  1627
3460
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1628
    <resource: #keyboard (#Tab #Return #CursorDown #CursorUp)>
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1629
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1630
    windowGroup isNil ifTrue:[^ self ].
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1631
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1632
    (key == #Tab) ifTrue:[
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1633
        (self tabRequiresControl not
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1634
        or:[ self sensor ctrlDown ]) ifTrue:[
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1635
            self sensor shiftDown ifTrue:[
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1636
                windowGroup focusPrevious
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1637
            ] ifFalse:[
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1638
                windowGroup focusNext
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1639
            ].
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1640
        ].
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1641
        ^ self
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1642
    ].
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1643
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1644
    (key == #Return) ifTrue:[
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1645
        windowGroup focusNext.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1646
        ^ self
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1647
    ].
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1648
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1649
    key == #CursorDown ifTrue:[
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1650
        windowGroup focusNext.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1651
        ^ self.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1652
    ].
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1653
    key == #CursorUp ifTrue:[
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1654
        windowGroup focusPrevious.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1655
        ^ self.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1656
    ].
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1657
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1658
    "Created: / 06-03-2007 / 20:14:04 / cg"
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1659
!
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1660
125
claus
parents: 122
diff changeset
  1661
keyPress:key x:x y:y
claus
parents: 122
diff changeset
  1662
    "if keyHandler is defined, pass input; otherwise check for leave
claus
parents: 122
diff changeset
  1663
     keys"
claus
parents: 122
diff changeset
  1664
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  1665
    <resource: #keyboard (#Tab #Return #Find #FindNext #FindPrev
922
e6a5e1cf9565 resource spec updated
Claus Gittinger <cg@exept.de>
parents: 894
diff changeset
  1666
                          #DeleteLine #GotoLine #EndOfLine #EndOfText
e6a5e1cf9565 resource spec updated
Claus Gittinger <cg@exept.de>
parents: 894
diff changeset
  1667
                          #CursorDown #CursorUp)>
132
claus
parents: 131
diff changeset
  1668
4992
7d8b66d3c846 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4991
diff changeset
  1669
    |leave oldContents newContents doAccept keyAction numArgs|
125
claus
parents: 122
diff changeset
  1670
claus
parents: 122
diff changeset
  1671
    enabled ifFalse:[
325
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  1672
        ^ self
125
claus
parents: 122
diff changeset
  1673
    ].
claus
parents: 122
diff changeset
  1674
claus
parents: 122
diff changeset
  1675
    (key == #DeleteLine) ifTrue:[
325
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  1676
        Smalltalk at:#CopyBuffer put:(self contents).
3797
69edb2e7436c code formatting
Claus Gittinger <cg@exept.de>
parents: 3768
diff changeset
  1677
        self contents:''. 
69edb2e7436c code formatting
Claus Gittinger <cg@exept.de>
parents: 3768
diff changeset
  1678
        ^ self
125
claus
parents: 122
diff changeset
  1679
    ].
19
a696fb528758 *** empty log message ***
claus
parents: 7
diff changeset
  1680
3460
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1681
    (key == entryCompletionCharacter and:[self entryCompletionBlock notNil]) ifTrue:[
979
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1682
        oldContents := self contents.
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1683
        oldContents isNil ifTrue:[
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1684
            oldContents := ''
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1685
        ] ifFalse:[
978
6e678fdc6e5b allow non-Tab as entryCompleter; care for immediateAccept after completion
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  1686
            oldContents := oldContents asString
6e678fdc6e5b allow non-Tab as entryCompleter; care for immediateAccept after completion
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  1687
        ].
6e678fdc6e5b allow non-Tab as entryCompleter; care for immediateAccept after completion
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  1688
2993
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1689
        self entryCompletionBlock valueWithOptionalArgument:oldContents and:self.
978
6e678fdc6e5b allow non-Tab as entryCompleter; care for immediateAccept after completion
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  1690
979
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1691
        newContents := self contents.
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1692
        newContents isNil ifTrue:[
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1693
            newContents := ''
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1694
        ] ifFalse:[
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1695
            newContents := newContents asString
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1696
        ].
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1697
        newContents ~= oldContents ifTrue:[
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1698
            self textChanged
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1699
        ].
c71f75bb9ffc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
  1700
        ^ self
978
6e678fdc6e5b allow non-Tab as entryCompleter; care for immediateAccept after completion
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  1701
    ].
6e678fdc6e5b allow non-Tab as entryCompleter; care for immediateAccept after completion
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  1702
125
claus
parents: 122
diff changeset
  1703
    (key == #Tab) ifTrue:[
3460
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1704
        doAccept := acceptOnTab.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1705
        keyAction := tabAction.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1706
    ].
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1707
    (key == #Return) ifTrue:[
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1708
        doAccept := acceptOnReturn.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1709
        keyAction := crAction.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1710
    ].
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1711
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1712
    leave := leaveKeys includes:key.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1713
    leave ifTrue:[
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1714
        leaveKey := key.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1715
        doAccept := doAccept ? acceptOnLeave.
4720
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1716
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1717
        "/ on leave, the precedence of actions is:
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1718
        "/  1) explicit leaveAction per key
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1719
        "/  2) general leaveAction
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1720
        "/  3) tab or return action
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1721
        leaveKeyActions notNil ifTrue:[
4979
bcf924c2ec88 class: EditField
ca
parents: 4939
diff changeset
  1722
            keyAction := leaveKeyActions at:key ifAbsent:[keyAction].
4720
1a78fc5a39d7 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4608
diff changeset
  1723
        ].
3460
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1724
        keyAction := keyAction ? leaveAction.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1725
    ].
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1726
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1727
    doAccept == true ifTrue:[
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1728
        self accept.
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1729
    ].
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1730
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1731
    keyAction notNil ifTrue:[
3462
447eb65a523f check for numArgs == 0 before evaluating the keyAction
boris
parents: 3461
diff changeset
  1732
        numArgs := keyAction numArgs.
447eb65a523f check for numArgs == 0 before evaluating the keyAction
boris
parents: 3461
diff changeset
  1733
447eb65a523f check for numArgs == 0 before evaluating the keyAction
boris
parents: 3461
diff changeset
  1734
        numArgs == 2 ifTrue:[
3460
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1735
            ^ keyAction value:self value:key
964
73525cfd8fa2 dont forget to accept, when only (cr- and tab-) actions are defined
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1736
        ].
3462
447eb65a523f check for numArgs == 0 before evaluating the keyAction
boris
parents: 3461
diff changeset
  1737
        numArgs == 0 ifTrue:[
447eb65a523f check for numArgs == 0 before evaluating the keyAction
boris
parents: 3461
diff changeset
  1738
            ^ keyAction value
447eb65a523f check for numArgs == 0 before evaluating the keyAction
boris
parents: 3461
diff changeset
  1739
        ].
3460
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1740
        ^ keyAction value:key
125
claus
parents: 122
diff changeset
  1741
    ].
480
dd6263c5f9ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
  1742
125
claus
parents: 122
diff changeset
  1743
    leave ifTrue:[
611
87637cf3931b Handle keypress:key x:nil y:nil correctly (means recursion).
Stefan Vogel <sv@exept.de>
parents: 601
diff changeset
  1744
        (x notNil and:[x >= 0]) ifTrue:[
325
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  1745
            "
737
911a168ef967 handle leave from EditField without a group as a focus-stepping
Claus Gittinger <cg@exept.de>
parents: 725
diff changeset
  1746
             we do not handle this key directly.
611
87637cf3931b Handle keypress:key x:nil y:nil correctly (means recursion).
Stefan Vogel <sv@exept.de>
parents: 601
diff changeset
  1747
             let superview know about the key that caused us to leave (maybe RETURN, DOWN, UP etc....
325
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  1748
            "
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  1749
            (superView notNil and:[superView canHandle:key from:self]) ifTrue:[
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  1750
                superView keyPress:key x:x y:y.
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  1751
            ].
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  1752
        ].
737
911a168ef967 handle leave from EditField without a group as a focus-stepping
Claus Gittinger <cg@exept.de>
parents: 725
diff changeset
  1753
911a168ef967 handle leave from EditField without a group as a focus-stepping
Claus Gittinger <cg@exept.de>
parents: 725
diff changeset
  1754
        "/ a leave, but no action defined
911a168ef967 handle leave from EditField without a group as a focus-stepping
Claus Gittinger <cg@exept.de>
parents: 725
diff changeset
  1755
        "/ forward it as a Focus-step
911a168ef967 handle leave from EditField without a group as a focus-stepping
Claus Gittinger <cg@exept.de>
parents: 725
diff changeset
  1756
        key == #CursorDown ifTrue:[
3460
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1757
            self handleFocusKey:key.
2708
dfdf8977e9ba care for nil windogroup (editor in dataSet)
Claus Gittinger <cg@exept.de>
parents: 2707
diff changeset
  1758
            ^ self.
737
911a168ef967 handle leave from EditField without a group as a focus-stepping
Claus Gittinger <cg@exept.de>
parents: 725
diff changeset
  1759
        ].
911a168ef967 handle leave from EditField without a group as a focus-stepping
Claus Gittinger <cg@exept.de>
parents: 725
diff changeset
  1760
        key == #CursorUp ifTrue:[
3460
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1761
            self handleFocusKey:key.
2708
dfdf8977e9ba care for nil windogroup (editor in dataSet)
Claus Gittinger <cg@exept.de>
parents: 2707
diff changeset
  1762
            ^ self.
737
911a168ef967 handle leave from EditField without a group as a focus-stepping
Claus Gittinger <cg@exept.de>
parents: 725
diff changeset
  1763
        ].
325
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  1764
        ^ self
19
a696fb528758 *** empty log message ***
claus
parents: 7
diff changeset
  1765
    ].
121
claus
parents: 120
diff changeset
  1766
125
claus
parents: 122
diff changeset
  1767
    "
claus
parents: 122
diff changeset
  1768
     ignore some keys (if not a leaveKey) ...
claus
parents: 122
diff changeset
  1769
    "
claus
parents: 122
diff changeset
  1770
    (key == #Find) ifTrue:[^self].
claus
parents: 122
diff changeset
  1771
    (key == #FindNext) ifTrue:[^self].
claus
parents: 122
diff changeset
  1772
    (key == #FindPrev) ifTrue:[^self].
claus
parents: 122
diff changeset
  1773
    (key == #GotoLine) ifTrue:[^self].
claus
parents: 122
diff changeset
  1774
    "
claus
parents: 122
diff changeset
  1775
     a normal key - let superclass's method insert it
claus
parents: 122
diff changeset
  1776
    "
claus
parents: 122
diff changeset
  1777
    super keyPress:key x:x y:y.
claus
parents: 122
diff changeset
  1778
claus
parents: 122
diff changeset
  1779
    "
claus
parents: 122
diff changeset
  1780
     for end-of-text, also move to end-of-line
claus
parents: 122
diff changeset
  1781
    "
claus
parents: 122
diff changeset
  1782
    key == #EndOfText ifTrue:[
325
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  1783
        super keyPress:#EndOfLine x:x y:y.
125
claus
parents: 122
diff changeset
  1784
    ].
6136
54e34fbf8f6d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6117
diff changeset
  1785
    
54e34fbf8f6d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6117
diff changeset
  1786
    key isCharacter ifTrue:[
54e34fbf8f6d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6117
diff changeset
  1787
        self resizeOrScroll.
54e34fbf8f6d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6117
diff changeset
  1788
    ].
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1789
3460
98524ea0fea6 tab handling;
Claus Gittinger <cg@exept.de>
parents: 3413
diff changeset
  1790
    "Modified: / 02-05-1996 / 17:24:16 / stefan"
6209
5e83ab74283d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6195
diff changeset
  1791
    "Modified: / 27-09-2017 / 15:34:19 / cg"
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1792
!
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1793
5929
ea7162cefcc5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5910
diff changeset
  1794
keyboardZoom:larger
ea7162cefcc5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5910
diff changeset
  1795
    "/ ignored here
ea7162cefcc5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5910
diff changeset
  1796
!
ea7162cefcc5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5910
diff changeset
  1797
1936
f8253741114d pointerLeave fixed
tm
parents: 1918
diff changeset
  1798
pointerLeave:state
1937
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
  1799
    (acceptOnPointerLeave and:[enabled and:[self modified]]) ifTrue:[
1936
f8253741114d pointerLeave fixed
tm
parents: 1918
diff changeset
  1800
        self accept
f8253741114d pointerLeave fixed
tm
parents: 1918
diff changeset
  1801
    ].
f8253741114d pointerLeave fixed
tm
parents: 1918
diff changeset
  1802
    super pointerLeave:state
1937
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
  1803
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
  1804
    "Modified: / 28.6.1999 / 18:08:29 / cg"
1936
f8253741114d pointerLeave fixed
tm
parents: 1918
diff changeset
  1805
!
f8253741114d pointerLeave fixed
tm
parents: 1918
diff changeset
  1806
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1807
resizeOrScroll
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1808
    "helper for keyPress.
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1809
     Extracted for easier subclass redefinition."
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1810
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1811
    |xCol newOffset newWidth|
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1812
125
claus
parents: 122
diff changeset
  1813
    newWidth := self widthOfContents.
claus
parents: 122
diff changeset
  1814
claus
parents: 122
diff changeset
  1815
    "
claus
parents: 122
diff changeset
  1816
     should (& can) we resize ?
claus
parents: 122
diff changeset
  1817
    "
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  1818
    xCol := (self xOfCol:cursorCol inVisibleLine:cursorLine) - viewOrigin x.
6139
8c85b22e8722 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6136
diff changeset
  1819
    (xCol > (width - 50 "* (5/6)")) ifTrue:[
1103
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1820
        self changedPreferredBounds:nil
125
claus
parents: 122
diff changeset
  1821
    ] ifFalse:[
6139
8c85b22e8722 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6136
diff changeset
  1822
"/ Do not shrink!! Enterbox grows if size of contained Editfield changes!!    
8c85b22e8722 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6136
diff changeset
  1823
"/        newWidth < (width * (1/3)) ifTrue:[
8c85b22e8722 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6136
diff changeset
  1824
"/            self changedPreferredBounds:nil
8c85b22e8722 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6136
diff changeset
  1825
"/        ]
125
claus
parents: 122
diff changeset
  1826
    ].
claus
parents: 122
diff changeset
  1827
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
  1828
    autoScrollHorizontally ifTrue:[
1103
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1829
        "
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1830
         did someone react (i.e. has my extent changed) ?
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1831
         (if not, we scroll horizontally)
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1832
        "
2016
7a4d89c99c98 dont scroll horizontally, if there is a lengthLimit,
Claus Gittinger <cg@exept.de>
parents: 1999
diff changeset
  1833
        lengthLimit notNil ifTrue:[
7a4d89c99c98 dont scroll horizontally, if there is a lengthLimit,
Claus Gittinger <cg@exept.de>
parents: 1999
diff changeset
  1834
            (self xOfCol:lengthLimit+1 inVisibleLine:cursorLine) <= self innerWidth
7a4d89c99c98 dont scroll horizontally, if there is a lengthLimit,
Claus Gittinger <cg@exept.de>
parents: 1999
diff changeset
  1835
            ifTrue:[
7a4d89c99c98 dont scroll horizontally, if there is a lengthLimit,
Claus Gittinger <cg@exept.de>
parents: 1999
diff changeset
  1836
                ^ self
7a4d89c99c98 dont scroll horizontally, if there is a lengthLimit,
Claus Gittinger <cg@exept.de>
parents: 1999
diff changeset
  1837
            ].
7a4d89c99c98 dont scroll horizontally, if there is a lengthLimit,
Claus Gittinger <cg@exept.de>
parents: 1999
diff changeset
  1838
        ].
7a4d89c99c98 dont scroll horizontally, if there is a lengthLimit,
Claus Gittinger <cg@exept.de>
parents: 1999
diff changeset
  1839
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  1840
        xCol := (self xOfCol:cursorCol inVisibleLine:cursorLine) - viewOrigin x.
1103
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1841
        (xCol > (width * (5/6))) ifTrue:[
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  1842
            newOffset := viewOrigin x + (width // 2).
1103
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1843
        ] ifFalse:[
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1844
            (xCol < (width * (1/6))) ifTrue:[
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  1845
                newOffset := 0 max: viewOrigin x - (width // 2).
1103
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1846
            ] ifFalse:[
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  1847
                newOffset := viewOrigin x
1103
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1848
            ]
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1849
        ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  1850
        newOffset ~~ viewOrigin x ifTrue:[
1103
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1851
            self scrollHorizontalTo:newOffset.
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1852
        ]
125
claus
parents: 122
diff changeset
  1853
    ].
1103
0efbd1ac68f4 use new #changedPreferredBounds
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1854
6136
54e34fbf8f6d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6117
diff changeset
  1855
    "Modified: / 15-03-2017 / 19:22:56 / cg"
6139
8c85b22e8722 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6136
diff changeset
  1856
    "Modified: / 30-03-2017 / 18:46:50 / stefan"
8c85b22e8722 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6136
diff changeset
  1857
    "Modified (format): / 30-03-2017 / 22:24:58 / stefan"
316
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1858
!
1e27aa926710 fixed Tab handling in enterFieldGroups;
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1859
784
4161490a4b6d scroll to origin, if size changes and all text fits into the view.
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1860
sizeChanged:how
4161490a4b6d scroll to origin, if size changes and all text fits into the view.
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1861
    "scroll to origin, if all fits"
4161490a4b6d scroll to origin, if size changes and all text fits into the view.
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1862
1282
781c5d134e7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  1863
    |xCol|
784
4161490a4b6d scroll to origin, if size changes and all text fits into the view.
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1864
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  1865
    viewOrigin x ~~ 0 ifTrue:[
784
4161490a4b6d scroll to origin, if size changes and all text fits into the view.
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1866
        xCol := self xOfCol:cursorCol inVisibleLine:cursorLine.
4161490a4b6d scroll to origin, if size changes and all text fits into the view.
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1867
        (xCol < (width * (5/6))) ifTrue:[
4161490a4b6d scroll to origin, if size changes and all text fits into the view.
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1868
            self scrollHorizontalTo:0
4161490a4b6d scroll to origin, if size changes and all text fits into the view.
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1869
        ].
4161490a4b6d scroll to origin, if size changes and all text fits into the view.
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1870
    ].
4161490a4b6d scroll to origin, if size changes and all text fits into the view.
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1871
    self makeCursorVisible.
4989
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1872
    super sizeChanged:how.
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1873
    self computeTopMargin.
784
4161490a4b6d scroll to origin, if size changes and all text fits into the view.
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1874
4161490a4b6d scroll to origin, if size changes and all text fits into the view.
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1875
    "Modified: 10.7.1996 / 10:59:37 / cg"
4986
f3349579b8d3 Added EditField>>#tripleClickX:y:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4979
diff changeset
  1876
!
f3349579b8d3 Added EditField>>#tripleClickX:y:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4979
diff changeset
  1877
f3349579b8d3 Added EditField>>#tripleClickX:y:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4979
diff changeset
  1878
tripleClickX:x y:y
f3349579b8d3 Added EditField>>#tripleClickX:y:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4979
diff changeset
  1879
    "triple-click - select all"
f3349579b8d3 Added EditField>>#tripleClickX:y:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4979
diff changeset
  1880
f3349579b8d3 Added EditField>>#tripleClickX:y:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4979
diff changeset
  1881
    self selectAll
f3349579b8d3 Added EditField>>#tripleClickX:y:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4979
diff changeset
  1882
f3349579b8d3 Added EditField>>#tripleClickX:y:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4979
diff changeset
  1883
    "Created: / 09-04-2014 / 19:04:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1884
! !
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1885
1806
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1886
!EditField methodsFor:'focus handling'!
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1887
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1888
hasKeyboardFocus:aBoolean
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1889
    "the view got/lost the keyboard focus"
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1890
4930
af079679defd class: EditField
Stefan Vogel <sv@exept.de>
parents: 4910
diff changeset
  1891
    |hadKeyboardFocus|
af079679defd class: EditField
Stefan Vogel <sv@exept.de>
parents: 4910
diff changeset
  1892
af079679defd class: EditField
Stefan Vogel <sv@exept.de>
parents: 4910
diff changeset
  1893
    hadKeyboardFocus := hasKeyboardFocus.
af079679defd class: EditField
Stefan Vogel <sv@exept.de>
parents: 4910
diff changeset
  1894
    super hasKeyboardFocus:aBoolean.
af079679defd class: EditField
Stefan Vogel <sv@exept.de>
parents: 4910
diff changeset
  1895
af079679defd class: EditField
Stefan Vogel <sv@exept.de>
parents: 4910
diff changeset
  1896
    (acceptOnLostFocus and:[enabled and:[aBoolean not and:[hadKeyboardFocus]]]) ifTrue:[
6113
8731509a4171 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6095
diff changeset
  1897
        (model notNil and:[model value = self argForChangeMessage]) ifTrue:[
8731509a4171 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6095
diff changeset
  1898
            ^ self
1806
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1899
        ].
4930
af079679defd class: EditField
Stefan Vogel <sv@exept.de>
parents: 4910
diff changeset
  1900
        self accept.
1806
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1901
    ].
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1902
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1903
    "Created: / 11.12.1996 / 16:57:50 / cg"
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1904
    "Modified: / 6.12.1997 / 14:07:12 / cg"
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1905
!
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1906
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1907
showFocus:explicit
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1908
    "the view got the keyboard focus 
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1909
     (either explicit, via tabbing; or implicit, by pointer movement)
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1910
      - change any display attributes as req'd."
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1911
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1912
    "/ giving me the focus is like clicking on me
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1913
    "/ (tell my enterFieldGroup ...)
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1914
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1915
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1916
    (enabled or:[explicit]) ifTrue:[
5240
331c5840649e class: EditField
Claus Gittinger <cg@exept.de>
parents: 5122
diff changeset
  1917
        super showFocus:explicit.
1806
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1918
        clickAction notNil ifTrue:[clickAction value:self].
3461
0b3cc6fc00ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3460
diff changeset
  1919
        "/ mhmh - should we ALWAYS do this ?
5240
331c5840649e class: EditField
Claus Gittinger <cg@exept.de>
parents: 5122
diff changeset
  1920
        true "explicit" ifTrue:[ self makeCursorVisible ].
1806
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1921
    ]
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1922
3461
0b3cc6fc00ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3460
diff changeset
  1923
    "Modified: / 06-03-2007 / 21:11:17 / cg"
1806
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1924
!
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1925
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1926
showNoFocus:explicit
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1927
    "the view lost the keyboard focus 
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1928
     (either explicit, via tabbing; or implicit, by pointer movement)
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1929
      - change any display attributes as req'd."
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1930
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1931
    self hideCursor.
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1932
    super showNoFocus:explicit
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1933
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1934
    "Modified: / 17.9.1998 / 15:10:04 / cg"
1918
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1912
diff changeset
  1935
!
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1912
diff changeset
  1936
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1912
diff changeset
  1937
wantsFocusWithPointerEnter
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1912
diff changeset
  1938
    "return true, if I want the focus when
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1912
diff changeset
  1939
     the mouse pointer enters"
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1912
diff changeset
  1940
4992
7d8b66d3c846 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4991
diff changeset
  1941
    ^ UserPreferences current focusFollowsMouse ~~ false
7d8b66d3c846 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4991
diff changeset
  1942
         and:[(styleSheet at:#'editField.requestFocusOnPointerEnter' default:true)
7d8b66d3c846 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4991
diff changeset
  1943
         and:[self enabled 
7d8b66d3c846 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4991
diff changeset
  1944
         and:[self isReadOnly not]]]
1806
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1945
! !
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1946
5484
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  1947
!EditField methodsFor:'help'!
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  1948
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  1949
flyByHelpTextAt:aPoint
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  1950
    |len|
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  1951
    
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  1952
    len := self widthOfContents.
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  1953
    len > width ifTrue:[
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  1954
        ^ self contents  
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  1955
    ].
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  1956
    ^ nil
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  1957
! !
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  1958
2750
94531b6049a3 method category rename
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
  1959
!EditField methodsFor:'initialization & release'!
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1960
4989
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1961
computeTopMargin
5043
7faaf3204fc3 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5042
diff changeset
  1962
    |innerHeight rest font fontHeight fontDescent|
4989
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1963
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1964
    innerHeight := self innerHeight.
5044
db43a967ff95 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5043
diff changeset
  1965
    innerHeight <= 0 ifTrue:[ textStartTop := 0. ^ self ].
db43a967ff95 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5043
diff changeset
  1966
5043
7faaf3204fc3 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5042
diff changeset
  1967
    font := gc font.
7faaf3204fc3 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5042
diff changeset
  1968
    fontHeight := font height.
7faaf3204fc3 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5042
diff changeset
  1969
    fontDescent := font descent.
7faaf3204fc3 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5042
diff changeset
  1970
    rest := innerHeight - (fontHeight + (fontDescent // 2)).
4989
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1971
    rest > 1 ifTrue:[
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1972
        textStartTop := (rest // 2) + margin + topMargin
5043
7faaf3204fc3 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5042
diff changeset
  1973
    ] ifFalse:[
7faaf3204fc3 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5042
diff changeset
  1974
        "/ care if font is too high for my height: 
7faaf3204fc3 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5042
diff changeset
  1975
        "/ shift baseline towards the top, so that the same is cut off at both ends.
7faaf3204fc3 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5042
diff changeset
  1976
        "/ (the heuristic fontDescent//3) gives a few pixels more at the top)
5044
db43a967ff95 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5043
diff changeset
  1977
        textStartTop := 1 "(fontDescent//3)" - ((font ascent + fontDescent - innerHeight) // 2).
db43a967ff95 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5043
diff changeset
  1978
    ].
4989
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1979
!
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1980
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1981
initStyle
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 964
diff changeset
  1982
    "setup viewStyle specifics"
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 964
diff changeset
  1983
3265
33baaef82ef3 resource directive
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  1984
    <resource: #style (#'editField.cursorType'
33baaef82ef3 resource directive
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  1985
                       #'editField.cursorForegroundColor' 
4013
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  1986
                       #'editField.cursorBackgroundColor'
3265
33baaef82ef3 resource directive
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  1987
                       )>
33baaef82ef3 resource directive
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  1988
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1989
    super initStyle.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1990
4989
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1991
    self computeTopMargin.
cb0fb182dc2c class: EditField
Claus Gittinger <cg@exept.de>
parents: 4986
diff changeset
  1992
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1993
    DefaultBackgroundColor notNil ifTrue:[
5642
0f8102c3091d device access
Claus Gittinger <cg@exept.de>
parents: 5594
diff changeset
  1994
        bgColor := DefaultBackgroundColor onDevice:device.
1482
19c10a4142bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  1995
"/        bgColor ditherForm notNil ifTrue:[
4896
b0ed9d5390d3 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4888
diff changeset
  1996
"/            bgColor := (bgColor copy) exactOrNearestOn:self graphicsDevice
1482
19c10a4142bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  1997
"/        ].
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 964
diff changeset
  1998
        self viewBackground:bgColor.
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  1999
    ].
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2000
    fgColor := DefaultForegroundColor.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2001
    selectionFgColor := DefaultSelectionForegroundColor.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2002
    selectionBgColor := DefaultSelectionBackgroundColor.
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 964
diff changeset
  2003
1544
bb7e168dd651 dont hide editFields non-focus cursor (for now - focusDetection must be fixed)
Claus Gittinger <cg@exept.de>
parents: 1542
diff changeset
  2004
    "/ enable this, when the focus detection works correctly (in dialogs)
1848
fee9c6718e70 new cursorType: Ibeam
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  2005
    cursorTypeNoFocus := #none.
fee9c6718e70 new cursorType: Ibeam
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  2006
fee9c6718e70 new cursorType: Ibeam
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  2007
    cursorType := styleSheet at:#'editField.cursorType' default:cursorType.
fee9c6718e70 new cursorType: Ibeam
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  2008
fee9c6718e70 new cursorType: Ibeam
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  2009
    cursorFgColor := styleSheet at:#'editField.cursorForegroundColor' default:cursorFgColor.
fee9c6718e70 new cursorType: Ibeam
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  2010
    cursorBgColor := styleSheet at:#'editField.cursorBackgroundColor' default:cursorBgColor.
1544
bb7e168dd651 dont hide editFields non-focus cursor (for now - focusDetection must be fixed)
Claus Gittinger <cg@exept.de>
parents: 1542
diff changeset
  2011
4013
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2012
    DefaultLevel notNil ifTrue:[
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2013
        self level:DefaultLevel.
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2014
    ].
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2015
    DefaultBorderWidth notNil ifTrue:[
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2016
        self borderWidth:DefaultBorderWidth.
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2017
        DefaultBorderColor notNil ifTrue:[
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2018
            self borderColor:DefaultBorderColor.
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2019
        ].
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2020
    ].
3ed9d93e8ff6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2021
4320
088ca53d23ad comment/format in: #initStyle
az
parents: 4214
diff changeset
  2022
    "Modified: / 21-05-1998 / 15:38:14 / cg"
088ca53d23ad comment/format in: #initStyle
az
parents: 4214
diff changeset
  2023
    "Modified (comment): / 05-10-2011 / 15:51:15 / az"
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2024
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2025
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2026
initialize
5910
83afa19a39f7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5815
diff changeset
  2027
    |font|
83afa19a39f7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5815
diff changeset
  2028
    
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2029
    super initialize.
5910
83afa19a39f7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5815
diff changeset
  2030
    font := gc font.
83afa19a39f7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5815
diff changeset
  2031
    self initialHeight:(font height + font descent + (topMargin * 2)).
673
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  2032
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2033
    nFullLinesShown := 1.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2034
    nLinesShown := 1.
1225
6220d3bd3033 initialize acceptOnLostFocus
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2035
    trimBlankLines := immediateAccept := acceptOnLostFocus := false.
1937
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
  2036
    acceptOnPointerLeave := false.
1225
6220d3bd3033 initialize acceptOnLostFocus
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2037
    enabled := fixedSize := autoScrollHorizontally := true.
298
932fa5ca44f8 added more control over tab-key behavior (acceptOnTab:); added more examples & docu
ah
parents: 290
diff changeset
  2038
    acceptOnLeave := acceptOnReturn := acceptOnTab := true.
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2039
    cursorShown := true.
978
6e678fdc6e5b allow non-Tab as entryCompleter; care for immediateAccept after completion
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2040
    entryCompletionCharacter := #Tab.
2105
364c74512645 neu: acceptIfUnchanged
ca
parents: 2042
diff changeset
  2041
    acceptIfUnchanged := false.
673
e5a4bcfc960e use new cursorValidation (now positions at end-of-input when clicked)
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
  2042
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2043
    leaveKeys isNil ifTrue:[
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2044
        leaveKeys := self class defaultLeaveKeys.
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2045
    ].
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2046
    cursorMovementWhenUpdating := #endOfLine
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2047
1937
b88111019826 added acceptOnPointerLeave - must be separate from acceptOnLeave
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
  2048
    "Modified: / 28.6.1999 / 18:08:17 / cg"
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2049
! !
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2050
3702
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2051
!EditField methodsFor:'menu actions'!
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2052
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2053
editMenu
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2054
    "return a popUpMenu for the receiver"
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2055
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2056
    <resource: #keyboard ( #Accept #Copy #Cut #Paste ) >
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2057
    <resource: #programMenu>
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2058
4212
8b3a3ef8278a changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4194
diff changeset
  2059
    |items m isReadOnly|
8b3a3ef8278a changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4194
diff changeset
  2060
8b3a3ef8278a changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4194
diff changeset
  2061
    isReadOnly := (self isReadOnly == true or:[enabled == false]).
8b3a3ef8278a changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4194
diff changeset
  2062
    isReadOnly ifTrue:[
3702
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2063
        items := #(
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2064
                ('Copy'   copySelection  Copy  )
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2065
                )
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2066
    ] ifFalse:[
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2067
        items := #(
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2068
                    ('Cut'    cut            Cut   )
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2069
                    ('Copy'   copySelection  Copy  )
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2070
                    ('Paste'  pasteOrReplace Paste )
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2071
                   ).
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2072
        (acceptAction notNil 
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2073
        or:[model notNil and:[changeMsg notNil]]) ifTrue:[
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2074
            immediateAccept ifFalse:[
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2075
                items := items , #(
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2076
                                        ('-'                     )
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2077
                                        ('Accept'  accept  Accept)
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2078
                                    ).
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2079
            ].
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2080
        ].
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2081
    ].
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2082
6190
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2083
    passwordCharacter notNil ifTrue:[
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2084
        items := items ,
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2085
                    #(
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2086
                        ('-'                     )
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2087
                        ('Show Password'                showPasswordCharacters )
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2088
                    ).
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2089
    ] ifFalse:[
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2090
        items := items ,
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2091
                    #(
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2092
                        ('-'                     )
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2093
                        ('Hide as Password'                hideAsPassword )
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2094
                    ).
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2095
    ].    
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2096
4992
7d8b66d3c846 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4991
diff changeset
  2097
    isReadOnly ifFalse:[
4194
87d816906093 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
  2098
        items := items ,
87d816906093 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
  2099
                    #(
87d816906093 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
  2100
                        ('-'                     )
4938
136d6382e549 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4930
diff changeset
  2101
                        ('Insert Unicode...'            insertUnicode )
4194
87d816906093 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
  2102
                    ).
4938
136d6382e549 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4930
diff changeset
  2103
        CharacterSetView notNil ifTrue:[
136d6382e549 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4930
diff changeset
  2104
            items := items ,
136d6382e549 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4930
diff changeset
  2105
                        #(
136d6382e549 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4930
diff changeset
  2106
                            ('Special Characters...'    specialCharacters  OpenSpecialCharacterWindow )
136d6382e549 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4930
diff changeset
  2107
                        ).
136d6382e549 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4930
diff changeset
  2108
        ].
4194
87d816906093 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
  2109
    ].
87d816906093 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
  2110
3702
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2111
    m := PopUpMenu itemList:items resources:resources.
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2112
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2113
    passwordCharacter notNil ifTrue:[
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2114
        m disable:#copySelection
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2115
    ].
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2116
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2117
    self hasSelectionForCopy ifFalse:[
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2118
        m disable:#copySelection
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2119
    ].
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2120
    self hasSelection ifFalse:[
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2121
        m disable:#cut
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2122
    ].
4212
8b3a3ef8278a changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4194
diff changeset
  2123
    isReadOnly ifTrue:[
3702
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2124
        m disableAll:#(cut pasteOrReplace accept)
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2125
    ].
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2126
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2127
    ^ m
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2128
6190
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2129
    "Modified: / 17-08-2017 / 00:11:36 / cg"
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2130
!
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2131
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2132
hideAsPassword
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2133
    passwordCharacter := $*.
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2134
    self invalidate
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2135
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2136
    "Created: / 17-08-2017 / 00:11:41 / cg"
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2137
!
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2138
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2139
showPasswordCharacters
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2140
    passwordCharacter := nil.
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2141
    self invalidate
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2142
5cbc34a6f2d0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6167
diff changeset
  2143
    "Created: / 17-08-2017 / 00:11:27 / cg"
3702
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2144
! !
30f5a2efe531 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2145
5122
d2cf0e4081f0 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5098
diff changeset
  2146
!EditField methodsFor:'native widget support'!
d2cf0e4081f0 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5098
diff changeset
  2147
d2cf0e4081f0 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5098
diff changeset
  2148
nativeWindowType
d2cf0e4081f0 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5098
diff changeset
  2149
    "return a symbol describing my native window type 
5542
2b73601f4549 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2150
     (may be used internally by the device as a native window creation hint,
2b73601f4549 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2151
      if the device supports native windows)"
5122
d2cf0e4081f0 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5098
diff changeset
  2152
d2cf0e4081f0 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5098
diff changeset
  2153
    ^ #EditField
d2cf0e4081f0 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5098
diff changeset
  2154
! !
d2cf0e4081f0 class: EditField
Claus Gittinger <cg@exept.de>
parents: 5098
diff changeset
  2155
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2156
!EditField methodsFor:'private'!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2157
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2158
argForChangeMessage
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2159
    "redefined to send use converted value (if I have one)"
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2160
2538
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  2161
    |str|
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  2162
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  2163
    str := self editValue.
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  2164
    (acceptIfUnchanged
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  2165
    and:[model notNil
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  2166
    and:[model value == self editValue]]) ifTrue:[
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  2167
        "/ copy to force valueHolder to trigger
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  2168
        str := str copy.
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  2169
    ].
ce313a0572e7 care for accept with unchangedValue;
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  2170
    ^ str
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2171
!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2172
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2173
getListFromModel
5777
d278c2f170c3 #OTHER by mawalch
mawalch
parents: 5725
diff changeset
  2174
    "redefined to acquire the text via the aspectMsg - not the listMsg,
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2175
     and to ignore updates resulting from my own change."
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2176
1464
079d8a07b19c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1407
diff changeset
  2177
    |val|
079d8a07b19c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1407
diff changeset
  2178
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2179
    (model notNil and:[aspectMsg notNil]) ifTrue:[
1464
079d8a07b19c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1407
diff changeset
  2180
        aspectMsg == #value ifTrue:[
079d8a07b19c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1407
diff changeset
  2181
            val := model value
079d8a07b19c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1407
diff changeset
  2182
        ] ifFalse:[
079d8a07b19c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1407
diff changeset
  2183
            val := model perform:aspectMsg
079d8a07b19c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1407
diff changeset
  2184
        ].
1503
ae953a367422 care for models ignoring a change (i.e. if doing range checks in
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  2185
ae953a367422 care for models ignoring a change (i.e. if doing range checks in
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  2186
        "
ae953a367422 care for models ignoring a change (i.e. if doing range checks in
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  2187
         ignore updates from my own change
ae953a367422 care for models ignoring a change (i.e. if doing range checks in
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  2188
        "
ae953a367422 care for models ignoring a change (i.e. if doing range checks in
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  2189
        lockUpdates ifTrue:[
ae953a367422 care for models ignoring a change (i.e. if doing range checks in
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  2190
            lockUpdates := false.
ae953a367422 care for models ignoring a change (i.e. if doing range checks in
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  2191
            val = self editValue ifTrue:[
ae953a367422 care for models ignoring a change (i.e. if doing range checks in
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  2192
                ^ self
ae953a367422 care for models ignoring a change (i.e. if doing range checks in
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  2193
            ]
ae953a367422 care for models ignoring a change (i.e. if doing range checks in
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  2194
        ].
ae953a367422 care for models ignoring a change (i.e. if doing range checks in
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  2195
1464
079d8a07b19c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1407
diff changeset
  2196
        self editValue:val.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2197
    ]
1464
079d8a07b19c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1407
diff changeset
  2198
1503
ae953a367422 care for models ignoring a change (i.e. if doing range checks in
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  2199
    "Modified: / 23.4.1998 / 10:10:37 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2200
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2201
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2202
startAutoScrollDown:y
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2203
    "no vertical scrolling in editfields"
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2204
5095
a65fea7e7c4b class: EditField
Claus Gittinger <cg@exept.de>
parents: 5055
diff changeset
  2205
    ^ false
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2206
!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2207
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2208
startAutoScrollUp:y
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2209
    "no vertical scrolling in editfields"
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2210
5095
a65fea7e7c4b class: EditField
Claus Gittinger <cg@exept.de>
parents: 5055
diff changeset
  2211
    ^ false
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2212
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2213
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2214
textChanged
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2215
    "this is sent by mySelf (somewhere in a superclass) whenever
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2216
     my contents has changed. 
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2217
     A good place to add immediateAccept functionality and check for the
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2218
     lengthLimit."
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2219
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2220
    |string c|
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2221
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2222
    super textChanged.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2223
    string := self contents.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2224
    lengthLimit notNil ifTrue:[
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2225
	string size > lengthLimit ifTrue:[
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2226
	    c := cursorCol.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2227
	    self contents:(string copyTo:lengthLimit).
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2228
	    self flash.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2229
	    self cursorCol:c.
125
claus
parents: 122
diff changeset
  2230
	]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2231
    ].
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2232
    immediateAccept ifTrue:[
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2233
	self accept
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2234
    ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2235
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2236
2616
dc97ec169256 type on method name
Claus Gittinger <cg@exept.de>
parents: 2538
diff changeset
  2237
textChangedButNoSizeChange
2296
b924cc94580c immediate update did not work for Backspace key (and some others)
Claus Gittinger <cg@exept.de>
parents: 2193
diff changeset
  2238
    "this is sent by mySelf (somewhere in a superclass) whenever
b924cc94580c immediate update did not work for Backspace key (and some others)
Claus Gittinger <cg@exept.de>
parents: 2193
diff changeset
  2239
     my contents has changed. 
b924cc94580c immediate update did not work for Backspace key (and some others)
Claus Gittinger <cg@exept.de>
parents: 2193
diff changeset
  2240
     A good place to add immediateAccept functionality."
b924cc94580c immediate update did not work for Backspace key (and some others)
Claus Gittinger <cg@exept.de>
parents: 2193
diff changeset
  2241
2616
dc97ec169256 type on method name
Claus Gittinger <cg@exept.de>
parents: 2538
diff changeset
  2242
    super textChangedButNoSizeChange.
2296
b924cc94580c immediate update did not work for Backspace key (and some others)
Claus Gittinger <cg@exept.de>
parents: 2193
diff changeset
  2243
    immediateAccept ifTrue:[
b924cc94580c immediate update did not work for Backspace key (and some others)
Claus Gittinger <cg@exept.de>
parents: 2193
diff changeset
  2244
        self accept
b924cc94580c immediate update did not work for Backspace key (and some others)
Claus Gittinger <cg@exept.de>
parents: 2193
diff changeset
  2245
    ]
b924cc94580c immediate update did not work for Backspace key (and some others)
Claus Gittinger <cg@exept.de>
parents: 2193
diff changeset
  2246
!
b924cc94580c immediate update did not work for Backspace key (and some others)
Claus Gittinger <cg@exept.de>
parents: 2193
diff changeset
  2247
1631
f8fae6670540 change viewBackground, when either disabled or readOnly.
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  2248
updateBackground
f8fae6670540 change viewBackground, when either disabled or readOnly.
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  2249
    "make my background grey, whenever either readOnly or disable"
f8fae6670540 change viewBackground, when either disabled or readOnly.
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  2250
1974
c513cc45de3a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  2251
    |fg|
c513cc45de3a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  2252
3648
7a959d9db34f dont (re)set the background, if I have a bg-channel.
Claus Gittinger <cg@exept.de>
parents: 3585
diff changeset
  2253
    backgroundChannel notNil ifTrue:[^ self].
7a959d9db34f dont (re)set the background, if I have a bg-channel.
Claus Gittinger <cg@exept.de>
parents: 3585
diff changeset
  2254
1733
c5139b7402f0 use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents: 1683
diff changeset
  2255
    (self isReadOnly or:[enabled not]) ifTrue:[
1632
01a7b330622a change foregroundColor when disabled.
Claus Gittinger <cg@exept.de>
parents: 1631
diff changeset
  2256
        self backgroundColor:(View defaultViewBackgroundColor).
01a7b330622a change foregroundColor when disabled.
Claus Gittinger <cg@exept.de>
parents: 1631
diff changeset
  2257
        enabled ifFalse:[
1974
c513cc45de3a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  2258
            fg := StyleSheet colorAt:'editField.disabledForegroundColor' default:nil.
c513cc45de3a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  2259
            fg isNil ifTrue:[
c513cc45de3a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  2260
                fg := StyleSheet colorAt:'button.disabledForegroundColor' default:Color gray.
c513cc45de3a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  2261
            ].
c513cc45de3a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  2262
            self foregroundColor:fg.
3408
df7db0818a22 #updateBackground bug fixed
sr
parents: 3367
diff changeset
  2263
        ] ifTrue:[
df7db0818a22 #updateBackground bug fixed
sr
parents: 3367
diff changeset
  2264
            self foregroundColor:DefaultForegroundColor.
df7db0818a22 #updateBackground bug fixed
sr
parents: 3367
diff changeset
  2265
        ].
1631
f8fae6670540 change viewBackground, when either disabled or readOnly.
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  2266
    ] ifFalse:[
1632
01a7b330622a change foregroundColor when disabled.
Claus Gittinger <cg@exept.de>
parents: 1631
diff changeset
  2267
        self backgroundColor:DefaultBackgroundColor.
01a7b330622a change foregroundColor when disabled.
Claus Gittinger <cg@exept.de>
parents: 1631
diff changeset
  2268
        self foregroundColor:DefaultForegroundColor.
1631
f8fae6670540 change viewBackground, when either disabled or readOnly.
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  2269
    ]
f8fae6670540 change viewBackground, when either disabled or readOnly.
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  2270
1632
01a7b330622a change foregroundColor when disabled.
Claus Gittinger <cg@exept.de>
parents: 1631
diff changeset
  2271
    "Modified: / 3.8.1998 / 18:40:11 / cg"
1631
f8fae6670540 change viewBackground, when either disabled or readOnly.
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  2272
!
f8fae6670540 change viewBackground, when either disabled or readOnly.
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  2273
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2274
visibleAt:visLineNr
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2275
    "return the string at lineNr for display.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2276
     If there is a password character, return a string consisting of those only."
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2277
3988
7b496d3c7d12 changed: #visibleAt:
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  2278
    |s emptyText|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2279
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2280
    s := super visibleAt:visLineNr.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2281
    passwordCharacter notNil ifTrue:[
3985
31fa420f210a +emptyFieldReplacementText
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  2282
        ^ String new:(s size) withAll:passwordCharacter
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2283
    ].
3985
31fa420f210a +emptyFieldReplacementText
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  2284
    (s isEmptyOrNil  
3988
7b496d3c7d12 changed: #visibleAt:
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  2285
    and:[ (emptyText := self emptyFieldReplacementText) notNil  
3985
31fa420f210a +emptyFieldReplacementText
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  2286
    and:[ self hasFocus not 
31fa420f210a +emptyFieldReplacementText
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  2287
    and:[ visLineNr == 1 ]]])
31fa420f210a +emptyFieldReplacementText
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  2288
    ifTrue:[
5725
36a040e8555b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5642
diff changeset
  2289
        ^ emptyText allItalic withColor:Color lightGray.
3985
31fa420f210a +emptyFieldReplacementText
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  2290
    ].
31fa420f210a +emptyFieldReplacementText
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  2291
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2292
    ^ s
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2293
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2294
    "Modified: 6.9.1995 / 12:25:06 / claus"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2295
! !
125
claus
parents: 122
diff changeset
  2296
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2297
!EditField methodsFor:'queries'!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2298
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
  2299
hasSelectionForCopy
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
  2300
    "return true, if there is a selection which can be copied."
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
  2301
4992
7d8b66d3c846 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4991
diff changeset
  2302
    ^ passwordCharacter isNil and:[self hasSelection]
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
  2303
!
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2349
diff changeset
  2304
561
ef45086071c6 oops - isInputView renamed to isInputField
ca
parents: 506
diff changeset
  2305
isInputField
ef45086071c6 oops - isInputView renamed to isInputField
ca
parents: 506
diff changeset
  2306
    "return true, if the receiver is some kind of input view,
ef45086071c6 oops - isInputView renamed to isInputField
ca
parents: 506
diff changeset
  2307
     i.e. it should (can) be part of an enterGroup.
ef45086071c6 oops - isInputView renamed to isInputField
ca
parents: 506
diff changeset
  2308
     Return true here"
ef45086071c6 oops - isInputView renamed to isInputField
ca
parents: 506
diff changeset
  2309
ef45086071c6 oops - isInputView renamed to isInputField
ca
parents: 506
diff changeset
  2310
    ^ true
ef45086071c6 oops - isInputView renamed to isInputField
ca
parents: 506
diff changeset
  2311
ef45086071c6 oops - isInputView renamed to isInputField
ca
parents: 506
diff changeset
  2312
    "Created: 4.3.1996 / 11:32:34 / cg"
ef45086071c6 oops - isInputView renamed to isInputField
ca
parents: 506
diff changeset
  2313
!
ef45086071c6 oops - isInputView renamed to isInputField
ca
parents: 506
diff changeset
  2314
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2315
preferredExtent
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2316
    "return the preferred extent of this view.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2317
     That is the width of the string plus some extra, 
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2318
     but not wider than half of the screen"
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2319
1120
3faa7fc84bad checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2320
    |string w h f|
125
claus
parents: 122
diff changeset
  2321
3768
d759c921cb45 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3709
diff changeset
  2322
    "/ If I have an explicit preferredExtent..
d759c921cb45 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3709
diff changeset
  2323
    explicitExtent notNil ifTrue:[
d759c921cb45 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3709
diff changeset
  2324
        ^ explicitExtent
d759c921cb45 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3709
diff changeset
  2325
    ].
d759c921cb45 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3709
diff changeset
  2326
d759c921cb45 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3709
diff changeset
  2327
    "/ If I have a cached preferredExtent value..
714
5ff02d2d9fa7 care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 677
diff changeset
  2328
    preferredExtent notNil ifTrue:[
5ff02d2d9fa7 care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 677
diff changeset
  2329
        ^ preferredExtent
5ff02d2d9fa7 care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 677
diff changeset
  2330
    ].
5ff02d2d9fa7 care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 677
diff changeset
  2331
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2332
    string := self contents.
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2333
    (string isNil or:[string isBlank]) ifTrue:[
4086
677dab361ea7 changed: #preferredExtent
Stefan Vogel <sv@exept.de>
parents: 4028
diff changeset
  2334
        w := fontWidth * 20.  "space for 20 characters"
677dab361ea7 changed: #preferredExtent
Stefan Vogel <sv@exept.de>
parents: 4028
diff changeset
  2335
    ] ifFalse:[
677dab361ea7 changed: #preferredExtent
Stefan Vogel <sv@exept.de>
parents: 4028
diff changeset
  2336
        "length of current contents +  50% space to type more characters"
5815
a041a7f7b30b #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5777
diff changeset
  2337
        f := gc deviceFont.
4086
677dab361ea7 changed: #preferredExtent
Stefan Vogel <sv@exept.de>
parents: 4028
diff changeset
  2338
        w := ((f widthOf:string) * 1.5) rounded. 
677dab361ea7 changed: #preferredExtent
Stefan Vogel <sv@exept.de>
parents: 4028
diff changeset
  2339
        w := w + margin + margin.
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2340
    ].
6136
54e34fbf8f6d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6117
diff changeset
  2341
    "/ never more than the screen width, minus some 
54e34fbf8f6d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6117
diff changeset
  2342
    w := w min:(device width - 200 " // 2").
667
d02f6bba8fc5 use fonts maxHeight in prefExtent (A-Umlaut)
Claus Gittinger <cg@exept.de>
parents: 660
diff changeset
  2343
3929
3c88a4e7a7ac preferredExtent fontHeight
fm
parents: 3797
diff changeset
  2344
    "/ h := f maxHeight + (f maxDescent * 2) + (margin * 2).
4086
677dab361ea7 changed: #preferredExtent
Stefan Vogel <sv@exept.de>
parents: 4028
diff changeset
  2345
    h := fontHeight + topMargin + (margin * 2).
1120
3faa7fc84bad checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2346
3faa7fc84bad checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2347
    ^ w rounded @ h rounded
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2348
6136
54e34fbf8f6d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6117
diff changeset
  2349
    "Modified: / 06-09-1995 / 19:24:06 / claus"
54e34fbf8f6d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6117
diff changeset
  2350
    "Modified: / 15-03-2017 / 19:31:54 / cg"
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2351
!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2352
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2353
specClass
1372
c32cb309da8d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1363
diff changeset
  2354
    "redefined, since the name of my specClass is nonStandard (i.e. not EditFieldSpec)"
c32cb309da8d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1363
diff changeset
  2355
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2356
    self class == EditField ifTrue:[^ InputFieldSpec].
1047
4d7bc9784f94 specClass query
ca
parents: 1034
diff changeset
  2357
    ^ super specClass
125
claus
parents: 122
diff changeset
  2358
1372
c32cb309da8d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1363
diff changeset
  2359
    "Modified: / 5.9.1995 / 17:28:27 / claus"
c32cb309da8d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1363
diff changeset
  2360
    "Modified: / 31.10.1997 / 19:48:59 / cg"
325
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  2361
!
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  2362
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  2363
tabMeansNextField
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  2364
    "return true, if Tab character should shift focus to the next field"
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  2365
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  2366
    "if I have a completionBlock, I want my Tabs ..."
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  2367
2993
5a610fe081ed entryCompletionBlockHolder
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  2368
    ^ self entryCompletionBlock isNil or:[entryCompletionCharacter ~~ #Tab]
325
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  2369
87e24beaf835 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  2370
    "Created: 7.2.1996 / 19:16:38 / cg"
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2371
! !
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2372
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2373
!EditField methodsFor:'realization'!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2374
1274
a861b526e2c0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1268
diff changeset
  2375
realize
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2376
    "scroll back to beginning when realized"
1268
da86fb7a9f12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
  2377
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  2378
    viewOrigin := 0 @ viewOrigin y.
1274
a861b526e2c0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1268
diff changeset
  2379
    super realize
1268
da86fb7a9f12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
  2380
1274
a861b526e2c0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1268
diff changeset
  2381
    "Created: 24.7.1997 / 18:23:15 / cg"
125
claus
parents: 122
diff changeset
  2382
! !
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2383
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2384
!EditField methodsFor:'scrolling'!
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2385
1751
f29c3312beaf adjust h-scroll offset if only part is visible,
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
  2386
makeColVisible:col inLine:lineNr
6095
65ed08296dcb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5973
diff changeset
  2387
    "don't scroll for the cursor, if it's beyond the text and a lengthLimit
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2388
     is present."
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2389
2759
c7cdd64a930f makeCursorVisible-fix
Claus Gittinger <cg@exept.de>
parents: 2750
diff changeset
  2390
    |wText innerWidth colToMakeVisible|
2424
aa7b253717b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  2391
aa7b253717b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  2392
    innerWidth := self innerWidth.
2759
c7cdd64a930f makeCursorVisible-fix
Claus Gittinger <cg@exept.de>
parents: 2750
diff changeset
  2393
    colToMakeVisible := col.
2016
7a4d89c99c98 dont scroll horizontally, if there is a lengthLimit,
Claus Gittinger <cg@exept.de>
parents: 1999
diff changeset
  2394
7a4d89c99c98 dont scroll horizontally, if there is a lengthLimit,
Claus Gittinger <cg@exept.de>
parents: 1999
diff changeset
  2395
    lengthLimit notNil ifTrue:[
6222
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2396
        (self xOfCol:col-1 inVisibleLine:1) < self viewOrigin x ifTrue:[
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2397
        ] ifFalse:[    
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2398
            (self xOfCol:lengthLimit inVisibleLine:1) <= innerWidth
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2399
            ifTrue:[
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2400
                ^ self
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2401
            ].
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2402
            (self xOfCol:col inVisibleLine:1) <= innerWidth
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2403
            ifTrue:[
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2404
                ^ self
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2405
            ].
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2406
            (col == cursorCol and:[col > lengthLimit]) ifTrue:[
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2407
                colToMakeVisible := lengthLimit
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2408
            ].
2016
7a4d89c99c98 dont scroll horizontally, if there is a lengthLimit,
Claus Gittinger <cg@exept.de>
parents: 1999
diff changeset
  2409
        ].
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2410
    ].
1751
f29c3312beaf adjust h-scroll offset if only part is visible,
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
  2411
2759
c7cdd64a930f makeCursorVisible-fix
Claus Gittinger <cg@exept.de>
parents: 2750
diff changeset
  2412
    super makeColVisible:colToMakeVisible inLine:lineNr.
c7cdd64a930f makeCursorVisible-fix
Claus Gittinger <cg@exept.de>
parents: 2750
diff changeset
  2413
1751
f29c3312beaf adjust h-scroll offset if only part is visible,
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
  2414
    "/ new:
f29c3312beaf adjust h-scroll offset if only part is visible,
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
  2415
    "/ care to make the most possible visible
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2425
diff changeset
  2416
    viewOrigin x > 0 ifTrue:[
1751
f29c3312beaf adjust h-scroll offset if only part is visible,
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
  2417
        wText := self widthOfLine:lineNr.
6209
5e83ab74283d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6195
diff changeset
  2418
        wText < (innerWidth-10) ifTrue:[
1751
f29c3312beaf adjust h-scroll offset if only part is visible,
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
  2419
            self scrollHorizontalTo:0
f29c3312beaf adjust h-scroll offset if only part is visible,
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
  2420
        ]
f29c3312beaf adjust h-scroll offset if only part is visible,
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
  2421
    ]
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2422
4157
7f2928f99268 comment/format in: #makeColVisible:inLine:
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
  2423
    "Modified: / 06-09-1995 / 13:57:53 / claus"
6222
b5ed5993de3e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6209
diff changeset
  2424
    "Modified: / 23-10-2017 / 18:32:34 / cg"
192
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2425
! !
fc2fc4347d5d checkin from Browser
Claus Gittinger <cg@exept.de>
parents: 187
diff changeset
  2426
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  2427
!EditField methodsFor:'selections'!
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  2428
3366
0df1eb5da5aa refuse to copy passwords to the clipboard.
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  2429
copySelection
0df1eb5da5aa refuse to copy passwords to the clipboard.
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  2430
    "refuse to copy a password to the clipboard"
0df1eb5da5aa refuse to copy passwords to the clipboard.
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  2431
0df1eb5da5aa refuse to copy passwords to the clipboard.
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  2432
    passwordCharacter notNil ifTrue:[
3367
5e0416ea2518 ...and beep on an attempt.
Claus Gittinger <cg@exept.de>
parents: 3366
diff changeset
  2433
        self beep.
3366
0df1eb5da5aa refuse to copy passwords to the clipboard.
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  2434
        ^ self
0df1eb5da5aa refuse to copy passwords to the clipboard.
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  2435
    ].
0df1eb5da5aa refuse to copy passwords to the clipboard.
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  2436
    ^ super copySelection
0df1eb5da5aa refuse to copy passwords to the clipboard.
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  2437
!
0df1eb5da5aa refuse to copy passwords to the clipboard.
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  2438
1080
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2439
selectAll
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2440
    "select the whole text.
5594
09e1ac49efce #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5542
diff changeset
  2441
     redefined to send super selectFrom... since we don't want the
1080
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2442
     cursor to be moved in this case."
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2443
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2444
    |len|
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2445
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2446
    list isNil ifTrue:[
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2447
        self unselect
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2448
    ] ifFalse:[
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2449
        len := (self listAt:1) size.
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2450
        len ~~ 0 ifTrue:[
4992
7d8b66d3c846 class: EditField
Stefan Vogel <sv@exept.de>
parents: 4991
diff changeset
  2451
            self selectFromLine:1 col:1 toLine:1 col:len.
1080
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2452
        ].
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2453
        typeOfSelection := nil
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2454
    ]
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2455
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2456
    "Modified: 28.2.1997 / 19:16:21 / cg"
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2457
!
73877901fa7d redefined #selectAll to select nothing if there is nothing
Claus Gittinger <cg@exept.de>
parents: 1061
diff changeset
  2458
4540
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2459
selectFrom:firstColToSelect
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2460
    "select the right part of the text"
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2461
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2462
    |len|
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2463
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2464
    list isNil ifTrue:[
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2465
        self unselect
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2466
    ] ifFalse:[
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2467
        len := (self listAt:1) size.
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2468
        firstColToSelect <= len ifTrue:[
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2469
            self selectFromLine:1 col:firstColToSelect toLine:1 col:len.
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2470
        ].
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2471
        typeOfSelection := nil
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2472
    ]
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2473
!
ca28a8145610 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
  2474
5973
7e1d3c8aa4ad #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5929
diff changeset
  2475
setClipboardText:aString
5041
18f2861653bb class: EditField
Claus Gittinger <cg@exept.de>
parents: 4992
diff changeset
  2476
    "redefined to refuse to copy the password to the clipboard"
18f2861653bb class: EditField
Claus Gittinger <cg@exept.de>
parents: 4992
diff changeset
  2477
18f2861653bb class: EditField
Claus Gittinger <cg@exept.de>
parents: 4992
diff changeset
  2478
    passwordCharacter notNil ifTrue:[
18f2861653bb class: EditField
Claus Gittinger <cg@exept.de>
parents: 4992
diff changeset
  2479
        self beep.
18f2861653bb class: EditField
Claus Gittinger <cg@exept.de>
parents: 4992
diff changeset
  2480
        ^ self
18f2861653bb class: EditField
Claus Gittinger <cg@exept.de>
parents: 4992
diff changeset
  2481
    ].
5973
7e1d3c8aa4ad #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5929
diff changeset
  2482
    ^ super setClipboardText:aString
7e1d3c8aa4ad #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5929
diff changeset
  2483
7e1d3c8aa4ad #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5929
diff changeset
  2484
    "Modified (format): / 21-11-2016 / 23:37:07 / cg"
5041
18f2861653bb class: EditField
Claus Gittinger <cg@exept.de>
parents: 4992
diff changeset
  2485
!
18f2861653bb class: EditField
Claus Gittinger <cg@exept.de>
parents: 4992
diff changeset
  2486
5042
c7dfd678de9b class: EditField
Claus Gittinger <cg@exept.de>
parents: 5041
diff changeset
  2487
setLastStringToReplace: sel
c7dfd678de9b class: EditField
Claus Gittinger <cg@exept.de>
parents: 5041
diff changeset
  2488
    "redefined to refuse to remember the password"
c7dfd678de9b class: EditField
Claus Gittinger <cg@exept.de>
parents: 5041
diff changeset
  2489
c7dfd678de9b class: EditField
Claus Gittinger <cg@exept.de>
parents: 5041
diff changeset
  2490
    passwordCharacter notNil ifTrue:[
c7dfd678de9b class: EditField
Claus Gittinger <cg@exept.de>
parents: 5041
diff changeset
  2491
        ^ self
c7dfd678de9b class: EditField
Claus Gittinger <cg@exept.de>
parents: 5041
diff changeset
  2492
    ].
c7dfd678de9b class: EditField
Claus Gittinger <cg@exept.de>
parents: 5041
diff changeset
  2493
    ^ super setLastStringToReplace: sel
c7dfd678de9b class: EditField
Claus Gittinger <cg@exept.de>
parents: 5041
diff changeset
  2494
!
c7dfd678de9b class: EditField
Claus Gittinger <cg@exept.de>
parents: 5041
diff changeset
  2495
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  2496
validateNewSelection
6116
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2497
    "make certain that only one line is ever selected;
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2498
     also check that the selection is within the string"
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  2499
1654
2569ec675d8a bug fix:
ca
parents: 1632
diff changeset
  2500
    selectionEndLine notNil ifTrue:[
2569ec675d8a bug fix:
ca
parents: 1632
diff changeset
  2501
        selectionEndLine > 1 ifTrue:[
2569ec675d8a bug fix:
ca
parents: 1632
diff changeset
  2502
            selectionEndLine := 2. selectionEndCol := 0
2569ec675d8a bug fix:
ca
parents: 1632
diff changeset
  2503
        ]
2569ec675d8a bug fix:
ca
parents: 1632
diff changeset
  2504
    ].
6116
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2505
    "/ new: 7.3.2017
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2506
    selectionStartCol notNil ifTrue:[
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2507
        selectionStartCol > (self contents size + 1) ifTrue:[
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2508
            selectionStartCol := self contents size + 1.
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2509
        ].    
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2510
        selectionEndCol notNil ifTrue:[
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2511
            selectionEndCol > (self contents size) ifTrue:[
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2512
                selectionEndCol := self contents size.
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2513
            ].    
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2514
        ].    
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2515
    ].
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2516
2e2e14a081f8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6113
diff changeset
  2517
    "Modified (comment): / 07-03-2017 / 15:46:01 / cg"
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  2518
! !
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  2519
892
043b0ab4b786 allow acceptOnLostFocus.
Claus Gittinger <cg@exept.de>
parents: 842
diff changeset
  2520
!EditField class methodsFor:'documentation'!
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  2521
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  2522
version
5484
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  2523
    ^ '$Header$'
3975
73674d16fc63 copy asOrderedCollection -> copyAsOrderedCollection
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  2524
!
73674d16fc63 copy asOrderedCollection -> copyAsOrderedCollection
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  2525
73674d16fc63 copy asOrderedCollection -> copyAsOrderedCollection
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  2526
version_CVS
5484
73175b0903f9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5240
diff changeset
  2527
    ^ '$Header$'
261
afcea54bd74e added channel-enable (needs overall cleanup)
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  2528
! !
4507
5d052c1b7f02 class: EditField
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
  2529