EventListener.st
author Claus Gittinger <cg@exept.de>
Sun, 03 May 2009 22:34:46 +0200
changeset 2632 ced2473521b1
parent 2617 91adf98676da
child 2687 9d0bae89d82f
permissions -rw-r--r--
changed #startInPortalService:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     1
"
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
77
claus
parents: 60
diff changeset
     3
	      All Rights Reserved
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     4
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    11
"
1424
3198d7d846be catch errors when processing events;
tm
parents: 1271
diff changeset
    12
"{ Package: 'stx:libview2' }"
3198d7d846be catch errors when processing events;
tm
parents: 1271
diff changeset
    13
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    14
Object subclass:#EventListener
212
874afdeb380a commentary
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
    15
	instanceVariableNames:''
874afdeb380a commentary
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
    16
	classVariableNames:''
874afdeb380a commentary
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
    17
	poolDictionaries:''
874afdeb380a commentary
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
    18
	category:'Interface-Support'
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    19
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    20
1173
8c6ccf98efd9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
    21
!EventListener class methodsFor:'documentation'!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    22
123
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    23
copyright
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    24
"
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    25
 COPYRIGHT (c) 1995 by Claus Gittinger
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    26
	      All Rights Reserved
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    27
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    28
 This software is furnished under a license and may be used
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    29
 only in accordance with the terms of that license and with the
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    31
 be provided or otherwise made available to, or used by, any
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    32
 other person.  No title to or ownership of the software is
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    33
 hereby transferred.
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    34
"
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    35
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    36
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    37
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    38
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    39
documentation
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    40
"
98
claus
parents: 96
diff changeset
    41
    abstract class for event listeners. EventListeners can be used to intercept
claus
parents: 96
diff changeset
    42
    incoming events (keyboard & mouse) directly from a sensor, or even
claus
parents: 96
diff changeset
    43
    for a complete display device.
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    44
    A concrete application is the bubble help, which tracks entering/leaving
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    45
    views, and pops up some help message. 
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    46
    See concrete code in ActiveHelp.
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    47
98
claus
parents: 96
diff changeset
    48
    For each intercepted event, a corresponding method is called for in instances
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    49
    of myself - these MUST return true, if the event is to be ignored (i.e.
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    50
    assumed to be processed and consumed by the reader, 
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    51
    and MUST return false, if the normal event procedure should be performed. 
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    52
    Since this is an abstract class,
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    53
    all of my intercept methods return false. 
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    54
    They are meant to be redefined in concrete subclasses.
212
874afdeb380a commentary
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
    55
874afdeb380a commentary
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
    56
    [see also:]
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    57
	WindowSensor WindowEvent WindowGroup
222
c51b06f6bf9a documentation
Claus Gittinger <cg@exept.de>
parents: 213
diff changeset
    58
c51b06f6bf9a documentation
Claus Gittinger <cg@exept.de>
parents: 213
diff changeset
    59
    [author:]
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    60
	Claus Gittinger
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    61
"
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    62
! !
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    63
2390
67d0a61fbadf edit/list aspect methods
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
    64
!EventListener methodsFor:'event handling'!
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    65
2476
7fa9e8576594 changed #buttonMotion:x:y:view:
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
    66
buttonMotion:buttonAndModifierState x:x y:y view:aView
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    67
    "not handled here - should be redefined in a concrete subclass"
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
    68
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    69
    ^ false
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
    70
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
    71
    "Modified: 23.4.1996 / 21:57:54 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    72
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    73
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    74
buttonMultiPress:button x:x y:y view:aView
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    75
    "not handled here - should be redefined in a concrete subclass"
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
    76
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    77
    ^ false
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    78
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
    79
    "Modified: 23.4.1996 / 21:57:58 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    80
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    81
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    82
buttonPress:button x:x y:y view:aView
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    83
    "not handled here - should be redefined in a concrete subclass"
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
    84
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    85
    ^ false
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    86
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
    87
    "Modified: 23.4.1996 / 21:58:01 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    88
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    89
123
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    90
buttonRelease:button x:x y:y view:aView
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    91
    "not handled here - should be redefined in a concrete subclass"
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
    92
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    93
    ^ false
123
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    94
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
    95
    "Modified: 23.4.1996 / 21:58:03 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    96
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
    97
2516
d088b12a7948 add #focusInView:
fm
parents: 2476
diff changeset
    98
focusInView:aView
d088b12a7948 add #focusInView:
fm
parents: 2476
diff changeset
    99
    "not handled here - should be redefined in a concrete subclass"
d088b12a7948 add #focusInView:
fm
parents: 2476
diff changeset
   100
d088b12a7948 add #focusInView:
fm
parents: 2476
diff changeset
   101
    ^ false
d088b12a7948 add #focusInView:
fm
parents: 2476
diff changeset
   102
!
d088b12a7948 add #focusInView:
fm
parents: 2476
diff changeset
   103
d088b12a7948 add #focusInView:
fm
parents: 2476
diff changeset
   104
focusOutView:aView
d088b12a7948 add #focusInView:
fm
parents: 2476
diff changeset
   105
    "not handled here - should be redefined in a concrete subclass"
d088b12a7948 add #focusInView:
fm
parents: 2476
diff changeset
   106
d088b12a7948 add #focusInView:
fm
parents: 2476
diff changeset
   107
    ^ false
d088b12a7948 add #focusInView:
fm
parents: 2476
diff changeset
   108
!
d088b12a7948 add #focusInView:
fm
parents: 2476
diff changeset
   109
1424
3198d7d846be catch errors when processing events;
tm
parents: 1271
diff changeset
   110
hasKeyboardFocus:aBoolean view:aView
3198d7d846be catch errors when processing events;
tm
parents: 1271
diff changeset
   111
    "not handled here - should be redefined in a concrete subclass"
3198d7d846be catch errors when processing events;
tm
parents: 1271
diff changeset
   112
3198d7d846be catch errors when processing events;
tm
parents: 1271
diff changeset
   113
    ^ false
3198d7d846be catch errors when processing events;
tm
parents: 1271
diff changeset
   114
!
3198d7d846be catch errors when processing events;
tm
parents: 1271
diff changeset
   115
123
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   116
keyPress:key x:x y:y view:aView
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
   117
    "not handled here - should be redefined in a concrete subclass"
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
   118
123
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   119
    ^ false
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   120
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
   121
    "Modified: 23.4.1996 / 21:58:08 / cg"
123
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   122
!
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   123
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   124
keyRelease:key x:x y:y view:aView
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
   125
    "not handled here - should be redefined in a concrete subclass"
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
   126
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   127
    ^ false
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   128
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
   129
    "Modified: 23.4.1996 / 21:58:11 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   130
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   131
1178
44f1fee1b444 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
   132
mouseWheelMotion:state x:x y:y amount:amount deltaTime:dTime view:aView
1173
8c6ccf98efd9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   133
    "not handled here - can be redefined in a concrete subclass"
8c6ccf98efd9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   134
8c6ccf98efd9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   135
    ^ false
8c6ccf98efd9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   136
8c6ccf98efd9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   137
    "Modified: / 23.4.1996 / 21:57:54 / cg"
8c6ccf98efd9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   138
    "Created: / 21.5.1999 / 13:07:13 / cg"
8c6ccf98efd9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   139
!
8c6ccf98efd9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   140
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   141
pointerEnter:state x:x y:y view:view
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
   142
    "not handled here - should be redefined in a concrete subclass"
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
   143
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   144
    ^ false
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   145
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
   146
    "Modified: 23.4.1996 / 21:58:14 / cg"
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   147
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   148
123
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   149
pointerLeave:state view:view
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
   150
    "not handled here - should be redefined in a concrete subclass"
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
   151
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   152
    ^ false
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   153
213
9fac751c6499 commentary
Claus Gittinger <cg@exept.de>
parents: 212
diff changeset
   154
    "Modified: 23.4.1996 / 21:58:17 / cg"
2390
67d0a61fbadf edit/list aspect methods
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
   155
! !
67d0a61fbadf edit/list aspect methods
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
   156
67d0a61fbadf edit/list aspect methods
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
   157
!EventListener methodsFor:'events-window creation'!
1262
9b691fdaae56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   158
9b691fdaae56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   159
postCreateView:aView
9b691fdaae56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   160
    ^ self
9b691fdaae56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   161
!
9b691fdaae56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   162
9b691fdaae56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   163
preCreateView:aView
9b691fdaae56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   164
    ^ self
2390
67d0a61fbadf edit/list aspect methods
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
   165
!
574
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
   166
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
   167
preCreateView:aView origin:org
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
   168
    "invoked right before a view is about to be physically created.
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
   169
     May return a new origin."
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
   170
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
   171
    ^ org
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
   172
! !
a4fe01515dc1 added windowCreation hooks
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
   173
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   174
!EventListener methodsFor:'listen'!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   175
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   176
listen
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   177
    "install myself as listener"
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   178
1262
9b691fdaae56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   179
    WindowSensor addEventListener:self
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   180
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   181
    "
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   182
     |listener|
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   183
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   184
     listener := EventListener new.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   185
     listener listen.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   186
     (Delay forSeconds:20) wait.
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   187
     listener unlisten
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   188
    "
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   189
!
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   190
1262
9b691fdaae56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   191
processEvent:ev
1271
1fc0f8a774c7 comment
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   192
    "process an event; if true is returned, the event is considered to be
1fc0f8a774c7 comment
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   193
     'eaten' by the listener, and not passed to the view.
1fc0f8a774c7 comment
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   194
     If false is returned, the event is processed as usual.
1fc0f8a774c7 comment
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   195
     Here, the event is dispatched into one of the button*/key* etc. methods"
1fc0f8a774c7 comment
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   196
2617
91adf98676da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2516
diff changeset
   197
    |eventHasBeenProcessed|
91adf98676da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2516
diff changeset
   198
91adf98676da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2516
diff changeset
   199
    eventHasBeenProcessed := false.
1424
3198d7d846be catch errors when processing events;
tm
parents: 1271
diff changeset
   200
    Error handle:[:ex |
1939
f72ff9a773e5 print -> infoPrint
Claus Gittinger <cg@exept.de>
parents: 1770
diff changeset
   201
        ('Listener [info]: error while processing event: ' , ex description) infoPrintCR.
1424
3198d7d846be catch errors when processing events;
tm
parents: 1271
diff changeset
   202
    ] do:[
2617
91adf98676da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2516
diff changeset
   203
        eventHasBeenProcessed := ev dispatchWithViewArgumentTo:self
91adf98676da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2516
diff changeset
   204
    ].
91adf98676da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2516
diff changeset
   205
    ^ eventHasBeenProcessed
1262
9b691fdaae56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   206
!
9b691fdaae56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   207
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   208
unlisten
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   209
    "uninstall myself as listener"
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   210
1262
9b691fdaae56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   211
    WindowSensor removeEventListener:self 
60
c9dc64d2b4d6 Initial revision
claus
parents:
diff changeset
   212
! !
123
39e9679c132d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   213
1173
8c6ccf98efd9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   214
!EventListener class methodsFor:'documentation'!
127
4b1051c23b9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 123
diff changeset
   215
4b1051c23b9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 123
diff changeset
   216
version
2617
91adf98676da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2516
diff changeset
   217
    ^ '$Header: /cvs/stx/stx/libview2/EventListener.st,v 1.26 2009-03-23 18:54:46 cg Exp $'
127
4b1051c23b9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 123
diff changeset
   218
! !