KeyboardProcessor.st
author Claus Gittinger <cg@exept.de>
Wed, 23 Aug 2006 01:58:25 +0200
changeset 2165 308101564aa0
parent 2008 bc367a4d7d6a
child 2249 150a384a74a6
permissions -rw-r--r--
automatically generated by browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
1388
b5ba6f0d434f category only
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
    17
"{ Package: 'stx:libview2' }"
b5ba6f0d434f category only
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
    18
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
Object subclass:#KeyboardProcessor
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
    20
	instanceVariableNames:'returnIsOKInDialog escapeIsCancelInDialog menuBar
1983
868f48812257 initial focus
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
    21
		autoAcceptListeners globalAccelerators componentWithInitialFocus'
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	classVariableNames:''
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
	poolDictionaries:''
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
	category:'Interface-Support-UI'
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
!KeyboardProcessor class methodsFor:'documentation'!
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
copyright
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
"
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 COPYRIGHT (c) 1997 by eXept Software AG
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
              All Rights Reserved
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 This software is furnished under a license and may be used
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 only in accordance with the terms of that license and with the
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 inclusion of the above copyright notice.   This software may not
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
 be provided or otherwise made available to, or used by, any
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
 other person.  No title to or ownership of the software is
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
 hereby transferred.
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
!
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
documentation
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
"
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    ST80 compatibility (mimicry) class.
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    The class is not completed yet and certainly not bug free.
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    Notice: 
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
        this class was implemented using protocol information
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
        from alpha testers, literature and by reading public domain code
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
        - it may not be complete or compatible to
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
        the corresponding ST-80 class. 
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
        If you encounter any incompatibilities, please forward a note 
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
1160
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
    61
    KeyboardProcessor is going to take over the focus control
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
    62
    mechanism (which are currently located in the windowGroup).
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
    63
    Currently, it keeps track of inputFields, and allows for
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
    64
    a global accept to be forced.
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
    65
    This is especially useful with dialogs, where a global accept
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
    66
    should be performed on all inputFields, when the OK button
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
    67
    is pressed.
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
    68
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    [author:]
1160
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
    70
        Claus Gittinger
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
"
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
! !
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
1422
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
    78
!KeyboardProcessor class methodsFor:'defaults'!
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
    79
1455
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    80
isKeyEventIgnoredAsShortcut:aKeyEvent
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    81
    "returns true if the key event ignored is a shortCut key
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    82
    "
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    83
    |rawKey|
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    84
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    85
    rawKey := aKeyEvent rawKey.
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    86
    rawKey isSymbol ifFalse:[^ true].
1503
b3c4b1b1bfbb cursor keys ARE allowed as accelerators (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
    87
"/    "/ ignore cursor keys
b3c4b1b1bfbb cursor keys ARE allowed as accelerators (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
    88
"/    (#(
b3c4b1b1bfbb cursor keys ARE allowed as accelerators (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
    89
"/        Up Down Left Right 
b3c4b1b1bfbb cursor keys ARE allowed as accelerators (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
    90
"/        CursorUp CursorDown CursorLeft CursorRight
b3c4b1b1bfbb cursor keys ARE allowed as accelerators (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
    91
"/    ) includes:rawKey) ifTrue:[^ true].
1455
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    92
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    93
    "/ ignore some meta keys
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    94
    (#( 
1499
391ec6b1e6d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
    95
        #'Control_L' #'Control_R' #'Control' #'Ctrl' 
391ec6b1e6d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
    96
        #'CmdMenu' #'BackSpace' #Tab
391ec6b1e6d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
    97
        #'Cmd_L' #'Cmd_R' #'Cmd'
391ec6b1e6d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
    98
        #'Shift_L' #'Shift_R' Shift 
391ec6b1e6d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
    99
        #'Alt_L' #'Alt_R' #'Alt'
391ec6b1e6d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
   100
        #'Super_R' #'Super_L' #'Super'
1455
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   101
    ) includes:aKeyEvent key) ifTrue:[^ true].
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   102
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   103
    ^ false
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   104
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   105
    "Created: / 17.1.2001 / 11:57:07 / cg"
1457
59014aba97fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   106
    "Modified: / 17.1.2001 / 13:05:46 / cg"
1455
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   107
!
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   108
1422
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   109
isMnemonicKeyEvent:aKeyEvent
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   110
    "returns true if the key event is a mnemonic key
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   111
    "
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   112
    |rawKey|
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   113
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   114
    rawKey := aKeyEvent rawKey.
1443
fecba7db7523 - rename #mnemonicViewNext: to #processMnemonic:
ca
parents: 1423
diff changeset
   115
  ^ rawKey size == 4 and:[rawKey startsWith:'Cmd']
fecba7db7523 - rename #mnemonicViewNext: to #processMnemonic:
ca
parents: 1423
diff changeset
   116
! !
1422
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   117
1763
fabe0b506e33 method category rename
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
   118
!KeyboardProcessor methodsFor:'Compatibility-VW'!
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
keyboardConsumers
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
    ^ #()
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
    "Created: 6.3.1997 / 15:16:32 / cg"
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
!
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
removeKeyboardReceiver:aController
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    "Created: / 31.10.1997 / 01:56:54 / cg"
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
!
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
sendKeyboardTo:aController
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    "Created: / 31.10.1997 / 01:57:15 / cg"
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
!
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
setActive:aWidget
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    "Created: 3.3.1997 / 18:31:09 / cg"
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
! !
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
!KeyboardProcessor methodsFor:'accessing'!
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
1251
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   143
addAccelerator:aKey action:aSelectorOrBlock
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   144
    "add a global accelerator - these are handled even if no corresponding
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   145
     menu shortcut is defined"
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   146
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   147
    globalAccelerators isNil ifTrue:[
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   148
        globalAccelerators := Dictionary new
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   149
    ].
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   150
    globalAccelerators at:aKey put:aSelectorOrBlock
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   151
!
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   152
1983
868f48812257 initial focus
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
   153
componentWithInitialFocus
868f48812257 initial focus
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
   154
    ^ componentWithInitialFocus
868f48812257 initial focus
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
   155
!
868f48812257 initial focus
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
   156
868f48812257 initial focus
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
   157
componentWithInitialFocus:aComponent
868f48812257 initial focus
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
   158
    componentWithInitialFocus := aComponent
868f48812257 initial focus
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
   159
!
868f48812257 initial focus
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
   160
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
escapeIsCancelInDialog:aBoolean
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   162
    "set the escapeIsCancel flag.
1635
f65f19dc255a escapeIsCancel/returnIsOK default
ca
parents: 1552
diff changeset
   163
     If off, Escape is NOT handled as cancel (the builder defaults it to true,)"
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   164
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    escapeIsCancelInDialog := aBoolean
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
!
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
menuBar
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
    "return the value of the instance variable 'menuBar' (automatically generated)"
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
1443
fecba7db7523 - rename #mnemonicViewNext: to #processMnemonic:
ca
parents: 1423
diff changeset
   171
    ^ menuBar
fecba7db7523 - rename #mnemonicViewNext: to #processMnemonic:
ca
parents: 1423
diff changeset
   172
!
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
menuBar:something
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
    "set the value of the instance variable 'menuBar' (automatically generated)"
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
1443
fecba7db7523 - rename #mnemonicViewNext: to #processMnemonic:
ca
parents: 1423
diff changeset
   177
    menuBar := something.
fecba7db7523 - rename #mnemonicViewNext: to #processMnemonic:
ca
parents: 1423
diff changeset
   178
!
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
returnIsOKInDialog:aBoolean
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   181
    "set the returnIsOK flag.
1635
f65f19dc255a escapeIsCancel/returnIsOK default
ca
parents: 1552
diff changeset
   182
     If off, Return is NOT handled as accept (the builder defaults it to true,)"
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   183
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
    returnIsOKInDialog := aBoolean
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
! !
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
!KeyboardProcessor methodsFor:'event handling'!
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
1135
ee997fc311e2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1134
diff changeset
   189
processEvent:event forModalView:modalTopOrNil
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   190
    "process a key-event; return true, if handled & eaten; false if not.
1251
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   191
     Here, first, we look for a globalAccelerator,
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   192
     then for Return and Escape in modal applications,
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   193
     (which lead to Accept & Cancel resp.)
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   194
     Finally, menu-shortcuts are handled."
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   195
2007
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   196
    |key rawKey topView wg app view action explicitFocusView focusView|
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
    view := event view.
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
    event isKeyPressEvent ifTrue:[
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
        key := event key.
1448
0c7834bd6c0f early bailOut for cursorKeys (do not check for shortCuts)
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   202
        rawKey := event rawKey.
1135
ee997fc311e2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1134
diff changeset
   203
        topView := modalTopOrNil ? view topView.
1636
c9ed206b5d32 escapeIsCancel/returnIsOK in popup with same app as mainapp
ca
parents: 1635
diff changeset
   204
1445
50bf6580e064 care for topViews without windowGroup (which should not happen - but...)
tm
parents: 1443
diff changeset
   205
        wg := topView windowGroup.
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
        app := topView application.
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
1251
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   208
        "/ how about global accelerators ?
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   209
        (globalAccelerators notNil
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   210
        and:[(action := globalAccelerators at:key ifAbsent:nil) notNil])
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   211
        ifTrue:[
1492
8a92a2d071ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
   212
            event consumed:true.
1251
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   213
            action isSymbol ifTrue:[
1422
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   214
                app notNil ifTrue:[
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   215
                    action numArgs == 1 ifTrue:[
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   216
                        app perform:action with:event
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   217
                    ] ifFalse:[
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   218
                        app perform:action
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   219
                    ].
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   220
                ]
1251
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   221
            ] ifFalse:[
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   222
                action numArgs == 1 ifTrue:[
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   223
                    action value:event
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   224
                ] ifFalse:[
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   225
                    action value
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   226
                ]
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   227
            ].
1492
8a92a2d071ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
   228
            "/ ^ true
8a92a2d071ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1488
diff changeset
   229
            ^ event consumed
1251
2b4223c2e092 added global accelerator
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   230
        ].
1488
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   231
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   232
        topView isModal ifTrue:[
1637
5745a22735c8 code rewrite
ca
parents: 1636
diff changeset
   233
            (key == #Return and:[returnIsOKInDialog ? true]) ifTrue:[
5745a22735c8 code rewrite
ca
parents: 1636
diff changeset
   234
                (wg notNil 
2007
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   235
                and:[(explicitFocusView := wg explicitFocusView) isNil
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   236
                      or:[ explicitFocusView isKeyboardConsumer not 
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   237
                      or:[ explicitFocusView isInputField ] ]
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   238
                ]) ifTrue:[
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   239
                    ((focusView := wg focusView) notNil and:[focusView isTextView]) ifTrue:[
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   240
                        focusView isInputField ifFalse:[
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   241
                            "/ modalBox with a TextView
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   242
                            ^ false
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   243
                        ].
2008
bc367a4d7d6a kludge for subcanvas-inputfields
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
   244
                        "/ this is a kludge for subcanvas' input-fields, which
bc367a4d7d6a kludge for subcanvas-inputfields
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
   245
                        "/ are not affected by #requestGlobalAutoAccept below.
2007
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   246
                        focusView isAcceptOnReturn ifTrue:[
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   247
                            focusView accept
014e4bfe31f1 must accept an inputField before
Claus Gittinger <cg@exept.de>
parents: 2006
diff changeset
   248
                        ].
2006
83d2e7259fcf ignore return (do not close) if the current
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
   249
                    ].
83d2e7259fcf ignore return (do not close) if the current
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
   250
1488
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   251
                    self requestGlobalAutoAccept ifFalse:[^ true].
1636
c9ed206b5d32 escapeIsCancel/returnIsOK in popup with same app as mainapp
ca
parents: 1635
diff changeset
   252
c9ed206b5d32 escapeIsCancel/returnIsOK in popup with same app as mainapp
ca
parents: 1635
diff changeset
   253
                    "/ only care for RETURN and ESC if the window is the
c9ed206b5d32 escapeIsCancel/returnIsOK in popup with same app as mainapp
ca
parents: 1635
diff changeset
   254
                    "/ apps topView (not if its a popup or dialog of it)
c9ed206b5d32 escapeIsCancel/returnIsOK in popup with same app as mainapp
ca
parents: 1635
diff changeset
   255
                    (app notNil and:[app window == topView]) ifTrue:[
1794
81e71050bce2 extra hooks for ok/cancel via keyboard
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
   256
                        app doAcceptByReturnKey.
1488
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   257
                    ] ifFalse:[
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   258
                        "/ oldStyle modalBox - for now, let Box handle it itself
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   259
                        ^ false
1422
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   260
                    ].
1134
758151d73aac only do autoAccept, if there is no focus view.
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   261
                    ^ true
758151d73aac only do autoAccept, if there is no focus view.
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   262
                ].
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
            ].
1637
5745a22735c8 code rewrite
ca
parents: 1636
diff changeset
   264
            (key == #Escape and:[escapeIsCancelInDialog ? true]) ifTrue:[
1636
c9ed206b5d32 escapeIsCancel/returnIsOK in popup with same app as mainapp
ca
parents: 1635
diff changeset
   265
                "/ only care for RETURN and ESC if the window is the
c9ed206b5d32 escapeIsCancel/returnIsOK in popup with same app as mainapp
ca
parents: 1635
diff changeset
   266
                "/ apps topView (not if its a popup or dialog of it)
c9ed206b5d32 escapeIsCancel/returnIsOK in popup with same app as mainapp
ca
parents: 1635
diff changeset
   267
                (app notNil and:[app window == topView]) ifTrue:[
1794
81e71050bce2 extra hooks for ok/cancel via keyboard
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
   268
                    app doCancelByEscapeKey.
1488
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   269
                ] ifFalse:[
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   270
                    "/ oldStyle modalBox - for now, let Box handle it itself
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   271
                    ^ false
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   272
                ].
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   273
                ^ true
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   274
            ].
1422
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   275
        ].
1488
9fa3505d2d85 optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   276
1455
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   277
        wg notNil ifTrue:[
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   278
            (self class isMnemonicKeyEvent:event) ifTrue:[
1456
025fa88bf498 debug print
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   279
"/Transcript showCR:event rawKey.
025fa88bf498 debug print
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   280
"/Transcript showCR:event key.
1455
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   281
                (wg processMnemonic:event) ifTrue:[
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   282
                    ^ true
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   283
                ]
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   284
            ].
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   285
            (self class isKeyEventIgnoredAsShortcut:event) ifFalse:[
1456
025fa88bf498 debug print
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   286
"/Transcript showCR:event rawKey.
025fa88bf498 debug print
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   287
"/Transcript showCR:event key.
1455
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   288
                (wg processShortcut:event) ifTrue:[
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   289
                    ^ true
1445
50bf6580e064 care for topViews without windowGroup (which should not happen - but...)
tm
parents: 1443
diff changeset
   290
                ].
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
            ].
1422
3d33f87160bf mnemonic-key support;
ca
parents: 1388
diff changeset
   292
        ].        
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
    ].
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
1423
0e391ec230be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
   295
    "/ let view dispatch it.
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   296
    ^ false
1455
6d385add9b96 shortcut key processing (too slow)
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   297
1552
9b200b9dd032 initial focus
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
   298
    "Modified: / 23.12.2001 / 13:12:55 / cg"
1423
0e391ec230be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
   299
!
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
requestForWindowClose
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   302
     "about to close the window."
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   304
     ^ true
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
!
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
requestGlobalAutoAccept
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   308
     "about to close the window via return ok accept.
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   309
      Ask all acceptListeners to accept their value and return true, if all of those fields
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   310
      did."
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   312
    autoAcceptListeners notNil ifTrue:[
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   313
        autoAcceptListeners do:[:aListener |
1133
48fe25214e65 fixed requestAutoAccept.
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
   314
            (aListener requestAutoAccept) ifFalse:[^ false].
48fe25214e65 fixed requestAutoAccept.
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
   315
        ].
48fe25214e65 fixed requestAutoAccept.
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
   316
        ^ true
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   317
    ].
1458
43c22152a2f5 accept autoAccept (RETURN) if no input field widget is present
Claus Gittinger <cg@exept.de>
parents: 1457
diff changeset
   318
    "/ if no input field (or comparable widget) is present ...
43c22152a2f5 accept autoAccept (RETURN) if no input field widget is present
Claus Gittinger <cg@exept.de>
parents: 1457
diff changeset
   319
"/    ^ false     <- wrong.
43c22152a2f5 accept autoAccept (RETURN) if no input field widget is present
Claus Gittinger <cg@exept.de>
parents: 1457
diff changeset
   320
    ^ true.
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
! !
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
1128
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   323
!KeyboardProcessor methodsFor:'setup'!
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   324
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   325
addAutoAcceptListener:aListener
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   326
    "add a aListener to my autoAcceptListeners.
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   327
     Typically, inputFields add themself, to be notified (via requestForAutoAccept)
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   328
     when the dialog is about to be closed with returnIsOK or accept.
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   329
     (of course, other listeners are also invited ;-)"
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   330
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   331
    autoAcceptListeners isNil ifTrue:[
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   332
        autoAcceptListeners := IdentitySet new.
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   333
    ].
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   334
    autoAcceptListeners add:aListener
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   335
! !
7810bca304e3 added autoAccept (editFields in dialogs)
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   336
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
!KeyboardProcessor class methodsFor:'documentation'!
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
version
2008
bc367a4d7d6a kludge for subcanvas-inputfields
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
   340
    ^ '$Header: /cvs/stx/stx/libview2/KeyboardProcessor.st,v 1.36 2004-08-19 10:10:10 cg Exp $'
1124
3dc83be3a3f9 moved from libcompat
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
! !