Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
MousePositionInfoMorph
Last updated at 6:19 am UTC on 11 November 2017
If you file in the code below (4 methods) you get a morph which displays the mouse position.

Execute in a workspace

      MousePositionInfoMorph  new openInHand

The morphs also appears in the red 'Objects' flap under the category 'Useful'.

Step method


 step
      super step.
      self contents: Cursor currentCursor peekPosition printString


Code

File in
StringMorph subclass: #MousePositionInfoMorph
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'Helpers2017'!
!MousePositionInfoMorph commentStamp: 'hjh 11/10/2017 14:17' prior: 0!
A subclass of StringMorph which shows the mouse position.


MousePositionInfoMorph  new openInHand
!
]style[(60 22 17),c000000125,!


!MousePositionInfoMorph methodsFor: 'step' stamp: 'hjh 11/10/2017 14:09'!
step
        super step.
      self contents: Cursor currentCursor peekPosition printString
! !

!MousePositionInfoMorph methodsFor: 'step' stamp: 'edc 2/20/2002 11:30'!
stepTime
        "Answer the desired time between steps in milliseconds."

        ^ 100! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

MousePositionInfoMorph class
        instanceVariableNames: ''!

!MousePositionInfoMorph class methodsFor: 'parts bin' stamp: 'hjh
11/10/2017 14:16'!
descriptionForPartsBin
        ^ self partName:        'Mouse position info'
                categories:             #('Useful')
                documentation:  'Continually show the mouse position'! !


!MousePositionInfoMorph class methodsFor: 'example' stamp: 'hjh
11/10/2017 14:18'!
example
"self example"


MousePositionInfoMorph  new openInHand!