[squeak-dev] continuous display of cursor position

Chris Cunnington smalltalktelevision at gmail.com
Fri Jan 4 03:31:41 UTC 2013


On 2013-01-03 9:50 PM, Ralph Boland wrote:
> I would like to create a small TextMorph that continuously displays the position
> of the cursor.  To do this I need to write something of the form:
>
> true whileTrue: [
>      x := self getCursorPosition.
>      textMorph display: x.
>      self sleep:  10   "milliseconds"]
>
> I plan to use this when investigating some morph that is not displaying the way
> I expect it to.
>
> Can someone provide me with hints as how to properly do this or point
> me to a package that already does this or something similar?
>
> I have searched the code and the Internet.  I found that "getCursorPosition"
> can be implemented as:
>
>       "World activeHand position"
>
>   I can also figure out how to build the Morph I need to display the
> Cursor position.
>
> I don't know how to implement "sleep:"
> I am not sure if I should use an infinite loop as I have.
>
> An alternative to the TextMorph I want is to construct a cursor that
> continuously displays its
> position but I prefer my original plan.
>
> Any help much appreciated.
>
> Ralph Boland
>
process := [[true] whileTrue:
     [(Delay forSeconds: 0.5) wait.
     Transcript show: (World activeHand position); cr]] newProcess.


     process resume.
     process terminate

That's about all I can do to help. I'd suspect that data coming to your 
eyes at 10 ms will be unreadable.  Putting it into a Morph? Couldn't 
tell ya.

FWIW,
Chris


More information about the Squeak-dev mailing list