Squeak – Switching Windows with Mouse Wheel

Works with

  • Squeak 4.6
  • Squeak 5.0.

Does not work with

  • Squeak 5.1  (try this instead)

Activate

ActiveWorld eventHandler
    on: #keyStroke
    send: #value:
    to: [:evt|
        evt controlKeyPressed ifTrue: [
            evt keyCharacter = Character arrowUp ifTrue: [
                SystemWindow sendTopWindowToBack.
                evt wasHandled: true].
            evt keyCharacter = Character arrowDown ifTrue: [
                (ActiveWorld submorphs reverse
                    detect: [:m | m isSystemWindow]
                    ifNone: []) ifNotNil: [:m| m activate.
                        evt wasHandled: true]]]].

Deactivate

ActiveWorld eventHandler
    on: #keyStroke
    send: #value:
    to: nil.

PasteUpMorph Optimization

!PasteUpMorph methodsFor: 'event handling' stamp: 'dgd 4/4/2006 14:42'!
keyStroke: anEvent
    "A keystroke has been made.  Service event handlers and, if it's a keystroke presented to the world, dispatch it to #unfocusedKeystroke:"

    | selected |
    super keyStroke: anEvent.  "Give event handlers a chance"

+    anEvent wasHandled
+        ifTrue: [^ self].
+
    selected := self selectedObject.
    selected isNil
        ifFalse:[ selected moveOrResizeFromKeystroke: anEvent ].

    (anEvent keyCharacter == Character tab) ifTrue:
        [self tabAmongFields
            ifTrue:[^ self tabHitWithEvent: anEvent]].
    self isWorldMorph ifTrue:
        [self keystrokeInWorld: anEvent]
! !

 

In addition

Preferences, mouseOverForKeyboardFocus [x]

should be enabled.

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s