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