continuous display of cursor position

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|

continuous display of cursor position

Ralph Boland
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

Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Chris Cunnington
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

Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Ken G. Brown
In reply to this post by Ralph Boland
Have a look at and try:
HandMorph showEvents: true.

   Ken G. Brown

On 2013-01-03, at 7: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
>


Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Frank Shearar-3
In reply to this post by Ralph Boland
On 4 January 2013 02:50, Ralph Boland <[hidden email]> 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.

AFAIK. you don't need to sleep as such. You need to draw, obviously,
which for custom Morphs would be implementing #drawOn: (like an
EllipseMorph), while sleeping looks like using #step: and #stepTime:
(see Flasher).

frank

> 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
>

Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Edgar J. De Cleene-3
In reply to this post by Ralph Boland



On 1/3/13 11:50 PM, "Ralph Boland" <[hidden email]> 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
>
See the attached, I use daily

Evaluate InfoMorph openInWorld or InfoMorph openInHand

Cheers

Edgar




InfoMorph.st (894 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

marcel.taeumel (old)
In reply to this post by Ralph Boland
You could take a look at the FrameRateMorph or TheWorldMainDockingBar>>#startMessageTally.

Alternatively, run this in a workspace:

[Sensor peekMousePt y > 0] whileTrue: [World doOneCycle. Sensor peekMousePt asString displayAt: 0@0].

Move your mouse to the top edge to end this. There is no need to create custom Morphs to achieve your goal neither to run a separate process. Just be sure that the main UI loop keeps running. :)

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Bob Arning-2
In reply to this post by Ralph Boland
UpdatingStringMorph new
    target: [World activeHand position asString];
    getSelector: #value;
    stepTime: 10;
    openInWorld

Cheers,
Bob

On 1/3/13 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





Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Chris Muller-3
In reply to this post by Ralph Boland
This is a piece of cake with Maui.

1) Install Maui (1.4) or (head) from SqueakMap.
2) Type "ActiveHand maui" (without quotes, of course :) and Do It.
3) Set the "a HandMorph(1234)" box down, press the "c" key on it -- a
browser opens up on HandMorph.
4) Drag the #position  message to the box.
5) On the embedded #position message, press "e" key on edit its settings.
6) In the #repeat: message, click on the "false" object to toggle it to true.
7) In #repeatInterval: box, type 10 and press Enter.

Done (see screenshot).

Maui might be overkill for only this, but you can see you can have a
watch on any message, not just the Hand position.  And there are
benefits of developing with a naked-objects drag-and-drop UI builder
because it forces good "usability" out of API's you design while
providing an easy, codeless way to _operate_ your domain model.  I
really like it.



On Thu, Jan 3, 2013 at 8:50 PM, Ralph Boland <[hidden email]> 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
>



maui.png (60K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Chris Muller-3
> 4) Drag the #position  message to the box.
> 5) On the embedded #position message, press "e" key on edit its settings.

5.5) Click the white box next to #selectStrategy: to see its drop-down
list, select "MauiAutoInvocationStrategy".

> 6) In the #repeat: message, click on the "false" object to toggle it to true.
> 7) In #repeatInterval: box, type 10 and press Enter.

Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

douglas mcpherson
Hi Chris,

Timely thread … recently I've been exploring Maui for rapidly constructing UIs. Thank you for this impressive package, and thanks for posting this example.

I've followed the steps you describe, but I can't get the position to automatically update. It only updates when I click on the position message. I've definitely got the invocationStrategy set to a MauiAutoInvocationStrategy, repeat set to true, and repeatInterval set to 10.

This is in a fresh 4.4 image with Maui newly installed from SqueakMap.

Any ideas?

Thanks!

On Jan 4, 2013, at 08:52 , Chris Muller <[hidden email]> wrote:

>> 4) Drag the #position  message to the box.
>> 5) On the embedded #position message, press "e" key on edit its settings.
>
> 5.5) Click the white box next to #selectStrategy: to see its drop-down
> list, select "MauiAutoInvocationStrategy".
>
>> 6) In the #repeat: message, click on the "false" object to toggle it to true.
>> 7) In #repeatInterval: box, type 10 and press Enter.
>


Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Chris Muller-3
It will after the next time you pick it up and then set it down.

On Fri, Jan 4, 2013 at 2:53 PM, Douglas McPherson <[hidden email]> wrote:

> Hi Chris,
>
> Timely thread … recently I've been exploring Maui for rapidly constructing UIs. Thank you for this impressive package, and thanks for posting this example.
>
> I've followed the steps you describe, but I can't get the position to automatically update. It only updates when I click on the position message. I've definitely got the invocationStrategy set to a MauiAutoInvocationStrategy, repeat set to true, and repeatInterval set to 10.
>
> This is in a fresh 4.4 image with Maui newly installed from SqueakMap.
>
> Any ideas?
>
> Thanks!
>
> On Jan 4, 2013, at 08:52 , Chris Muller <[hidden email]> wrote:
>
>>> 4) Drag the #position  message to the box.
>>> 5) On the embedded #position message, press "e" key on edit its settings.
>>
>> 5.5) Click the white box next to #selectStrategy: to see its drop-down
>> list, select "MauiAutoInvocationStrategy".
>>
>>> 6) In the #repeat: message, click on the "false" object to toggle it to true.
>>> 7) In #repeatInterval: box, type 10 and press Enter.
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

douglas mcpherson
Ah, ok, thanks. I just did a 'refresh' from the message's right-click menu, and that worked too.

Thanks.


On Jan 4, 2013, at 13:08 , Chris Muller <[hidden email]> wrote:

> It will after the next time you pick it up and then set it down.
>
> On Fri, Jan 4, 2013 at 2:53 PM, Douglas McPherson <[hidden email]> wrote:
>> Hi Chris,
>>
>> Timely thread … recently I've been exploring Maui for rapidly constructing UIs. Thank you for this impressive package, and thanks for posting this example.
>>
>> I've followed the steps you describe, but I can't get the position to automatically update. It only updates when I click on the position message. I've definitely got the invocationStrategy set to a MauiAutoInvocationStrategy, repeat set to true, and repeatInterval set to 10.
>>
>> This is in a fresh 4.4 image with Maui newly installed from SqueakMap.
>>
>> Any ideas?
>>
>> Thanks!
>>
>> On Jan 4, 2013, at 08:52 , Chris Muller <[hidden email]> wrote:
>>
>>>> 4) Drag the #position  message to the box.
>>>> 5) On the embedded #position message, press "e" key on edit its settings.
>>>
>>> 5.5) Click the white box next to #selectStrategy: to see its drop-down
>>> list, select "MauiAutoInvocationStrategy".
>>>
>>>> 6) In the #repeat: message, click on the "false" object to toggle it to true.
>>>> 7) In #repeatInterval: box, type 10 and press Enter.
>>>
>>
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Ken G. Brown
In reply to this post by Edgar J. De Cleene-3

On 2013-01-04, at 1:57 AM, Edgar J. De Cleene wrote:

>
>
>
> On 1/3/13 11:50 PM, "Ralph Boland" <[hidden email]> 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
>>
>
> See the attached, I use daily
>
> Evaluate InfoMorph openInWorld or InfoMorph openInHand
>
> Cheers
>
> Edgar
Have you been able to run this in the latest Squeak4.4-12327 on Cog 2640?
On my Mac, InfoMorph openInWorld fails:

InfoMorph class(Object)>>doesNotUnderstand: #openInWorld
        Receiver: InfoMorph
        Arguments and temporary variables:
                aMessage: openInWorld
                exception: MessageNotUnderstood: InfoMorph class>>openInWorld
                resumeValue: nil
        Receiver's instance variables:
                superclass: StringMorph
                methodDict: a MethodDictionary(#cambio:->(InfoMorph>>#cambio: "a CompiledMethod...etc...
                format: 150
                instanceVariables: nil
                organization: ('step' step stepTime)
('as yet unclassified' cambio:)

                subclasses: nil
                name: #InfoMorph
                classPool: nil
                sharedPools: nil
                environment: Smalltalk globals "a SystemDictionary with lots of globals"
                category: #SqueakRos

Ken G. Brown


>
[see attached file: InfoMorph.st]



InfoMorph.st (677 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Nicolas Cellier
Why open a class ?

2013/1/4 Ken G. Brown <[hidden email]>:

>
> On 2013-01-04, at 1:57 AM, Edgar J. De Cleene wrote:
>
>>
>>
>>
>> On 1/3/13 11:50 PM, "Ralph Boland" <[hidden email]> 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
>>>
>>
>> See the attached, I use daily
>>
>> Evaluate InfoMorph openInWorld or InfoMorph openInHand
>>
>> Cheers
>>
>> Edgar
>
> Have you been able to run this in the latest Squeak4.4-12327 on Cog 2640?
> On my Mac, InfoMorph openInWorld fails:
>
> InfoMorph class(Object)>>doesNotUnderstand: #openInWorld
>         Receiver: InfoMorph
>         Arguments and temporary variables:
>                 aMessage:       openInWorld
>                 exception:      MessageNotUnderstood: InfoMorph class>>openInWorld
>                 resumeValue:    nil
>         Receiver's instance variables:
>                 superclass:     StringMorph
>                 methodDict:     a MethodDictionary(#cambio:->(InfoMorph>>#cambio: "a CompiledMethod...etc...
>                 format:         150
>                 instanceVariables:      nil
>                 organization:   ('step' step stepTime)
> ('as yet unclassified' cambio:)
>
>                 subclasses:     nil
>                 name:   #InfoMorph
>                 classPool:      nil
>                 sharedPools:    nil
>                 environment:    Smalltalk globals "a SystemDictionary with lots of globals"
>                 category:       #SqueakRos
>
> Ken G. Brown
>
>
>>
> [see attached file: InfoMorph.st]
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Hannes Hirzel
Ken,

It seems that Edgar's fileIn code is corrupted.

Here is a modified version which works for me
------------------------------------------------------------------------------------



'From Squeak4.2 of 13 June 2011 [latest update: #11599] on 16 April
2012 at 9:31 am'!
StringMorph subclass: #InfoMorph
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'HJHWork2013'!


!InfoMorph methodsFor: 'step' stamp: 'edc 5/12/2005 16:06'!
step
        | pt |
        super step.
        pt := Sensor peekMousePt.
      self contents: pt asString.
! !

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

        ^ 100! !




------------------------------------------------------------------------------------



Then evaluate

InfoMorph new openInWorld



HTH


HJH

On 1/4/13, Nicolas Cellier <[hidden email]> wrote:

> Why open a class ?
>
> 2013/1/4 Ken G. Brown <[hidden email]>:
>>
>> On 2013-01-04, at 1:57 AM, Edgar J. De Cleene wrote:
>>
>>>
>>>
>>>
>>> On 1/3/13 11:50 PM, "Ralph Boland" <[hidden email]> 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
>>>>
>>>
>>> See the attached, I use daily
>>>
>>> Evaluate InfoMorph openInWorld or InfoMorph openInHand
>>>
>>> Cheers
>>>
>>> Edgar
>>
>> Have you been able to run this in the latest Squeak4.4-12327 on Cog 2640?
>> On my Mac, InfoMorph openInWorld fails:
>>
>> InfoMorph class(Object)>>doesNotUnderstand: #openInWorld
>>         Receiver: InfoMorph
>>         Arguments and temporary variables:
>>                 aMessage:       openInWorld
>>                 exception:      MessageNotUnderstood: InfoMorph
>> class>>openInWorld
>>                 resumeValue:    nil
>>         Receiver's instance variables:
>>                 superclass:     StringMorph
>>                 methodDict:     a
>> MethodDictionary(#cambio:->(InfoMorph>>#cambio: "a
>> CompiledMethod...etc...
>>                 format:         150
>>                 instanceVariables:      nil
>>                 organization:   ('step' step stepTime)
>> ('as yet unclassified' cambio:)
>>
>>                 subclasses:     nil
>>                 name:   #InfoMorph
>>                 classPool:      nil
>>                 sharedPools:    nil
>>                 environment:    Smalltalk globals "a SystemDictionary with
>> lots of globals"
>>                 category:       #SqueakRos
>>
>> Ken G. Brown
>>
>>
>>>
>> [see attached file: InfoMorph.st]
>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Ken G. Brown
Thx.

Ken,
from my iPhone

On 2013-01-04, at 16:33, "H. Hirzel" <[hidden email]> wrote:

> Ken,
>
> It seems that Edgar's fileIn code is corrupted.
>
> Here is a modified version which works for me
> ------------------------------------------------------------------------------------
>
>
>
> 'From Squeak4.2 of 13 June 2011 [latest update: #11599] on 16 April
> 2012 at 9:31 am'!
> StringMorph subclass: #InfoMorph
>    instanceVariableNames: ''
>    classVariableNames: ''
>    poolDictionaries: ''
>    category: 'HJHWork2013'!
>
>
> !InfoMorph methodsFor: 'step' stamp: 'edc 5/12/2005 16:06'!
> step
>    | pt |
>    super step.
>    pt := Sensor peekMousePt.
>      self contents: pt asString.
> ! !
>
> !InfoMorph methodsFor: 'step' stamp: 'edc 2/20/2002 11:30'!
> stepTime
>    "Answer the desired time between steps in milliseconds."
>
>    ^ 100! !
>
>
>
>
> ------------------------------------------------------------------------------------
>
>
>
> Then evaluate
>
> InfoMorph new openInWorld
>
>
>
> HTH
>
>
> HJH
>
> On 1/4/13, Nicolas Cellier <[hidden email]> wrote:
>> Why open a class ?
>>
>> 2013/1/4 Ken G. Brown <[hidden email]>:
>>>
>>> On 2013-01-04, at 1:57 AM, Edgar J. De Cleene wrote:
>>>
>>>>
>>>>
>>>>
>>>> On 1/3/13 11:50 PM, "Ralph Boland" <[hidden email]> 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
>>>>
>>>> See the attached, I use daily
>>>>
>>>> Evaluate InfoMorph openInWorld or InfoMorph openInHand
>>>>
>>>> Cheers
>>>>
>>>> Edgar
>>>
>>> Have you been able to run this in the latest Squeak4.4-12327 on Cog 2640?
>>> On my Mac, InfoMorph openInWorld fails:
>>>
>>> InfoMorph class(Object)>>doesNotUnderstand: #openInWorld
>>>        Receiver: InfoMorph
>>>        Arguments and temporary variables:
>>>                aMessage:       openInWorld
>>>                exception:      MessageNotUnderstood: InfoMorph
>>> class>>openInWorld
>>>                resumeValue:    nil
>>>        Receiver's instance variables:
>>>                superclass:     StringMorph
>>>                methodDict:     a
>>> MethodDictionary(#cambio:->(InfoMorph>>#cambio: "a
>>> CompiledMethod...etc...
>>>                format:         150
>>>                instanceVariables:      nil
>>>                organization:   ('step' step stepTime)
>>> ('as yet unclassified' cambio:)
>>>
>>>                subclasses:     nil
>>>                name:   #InfoMorph
>>>                classPool:      nil
>>>                sharedPools:    nil
>>>                environment:    Smalltalk globals "a SystemDictionary with
>>> lots of globals"
>>>                category:       #SqueakRos
>>>
>>> Ken G. Brown
>>>
>>>
>>> [see attached file: InfoMorph.st]
>

Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Casey Ransberger-2
In reply to this post by Chris Muller-3
Also, Maui is an incredible thing. There is a small gestural learning curve to it, but it's fantastic and becomes natural very quickly. It's worth loading up just for *fun.*

C

On Jan 4, 2013, at 8:49 AM, Chris Muller <[hidden email]> wrote:

> This is a piece of cake with Maui.
>
> 1) Install Maui (1.4) or (head) from SqueakMap.
> 2) Type "ActiveHand maui" (without quotes, of course :) and Do It.
> 3) Set the "a HandMorph(1234)" box down, press the "c" key on it -- a
> browser opens up on HandMorph.
> 4) Drag the #position  message to the box.
> 5) On the embedded #position message, press "e" key on edit its settings.
> 6) In the #repeat: message, click on the "false" object to toggle it to true.
> 7) In #repeatInterval: box, type 10 and press Enter.
>
> Done (see screenshot).
>
> Maui might be overkill for only this, but you can see you can have a
> watch on any message, not just the Hand position.  And there are
> benefits of developing with a naked-objects drag-and-drop UI builder
> because it forces good "usability" out of API's you design while
> providing an easy, codeless way to _operate_ your domain model.  I
> really like it.
>
>
>
> On Thu, Jan 3, 2013 at 8:50 PM, Ralph Boland <[hidden email]> 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
>>
> <maui.png>
>

Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Edgar J. De Cleene-3
In reply to this post by Ken G. Brown



On 1/4/13 6:45 PM, "Ken G. Brown" <[hidden email]> wrote:

> Have you been able to run this in the latest Squeak4.4-12327 on Cog 2640?
> On my Mac, InfoMorph openInWorld fails:
>
> InfoMorph class(Object)>>doesNotUnderstand: #openInWorld
> Receiver: InfoMorph
> Arguments and temporary variables:
> aMessage:  openInWorld
> exception:  MessageNotUnderstood: InfoMorph class>>openInWorld
> resumeValue:  nil
> Receiver's instance variables:
> superclass:  StringMorph
> methodDict:  a MethodDictionary(#cambio:->(InfoMorph>>#cambio: "a
> CompiledMethod...etc...
> format:  150
> instanceVariables:  nil
> organization:  ('step' step stepTime)
> ('as yet unclassified' cambio:)
>
> subclasses:  nil
> name:  #InfoMorph
> classPool:  nil
> sharedPools:  nil
> environment:  Smalltalk globals "a SystemDictionary with lots of globals"
> category:  #SqueakRos
>
> Ken G. Brown
>
>
>>
> [see attached file: InfoMorph.st]
> ?
You was right and Houston, we have a problem
Because if you check the hierarchy
ProtoObject
  Object
    Morph
      StringMorph
        InfoMorph

And Morph openInWorld also fails, which is a serious bug.
I using my own derivate images for long time, so don't see this problem.
Now check with older VMs....

And yes Morph openInWorld fails.

Later I updated from trunk for see which change break this.

Normally use the attached for years and on any Squeak , Cuis and Pharo 1.4
It's initialized in red and adhere to top edge, then I do find window,
select and embed into DokingBar, so have position of mouse and current
Change Set

Thanks!

Edgar





InfoMorph.morph (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Edgar J. De Cleene-3
In reply to this post by Nicolas Cellier



On 1/4/13 8:18 PM, "Nicolas Cellier" <[hidden email]>
wrote:

> Why open a class ?
No, you do not open a class, openInWorld and openInHand was Morph methods
for ages.
As my response to Ken, if this do not work in current Squeak is a serious
bug.

Edgar



Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Bob Arning-2
In reply to this post by Edgar J. De Cleene-3
I'm a little confused here. Did

Morph openInWorld

ever work? I've never seen a Squeak where that worked, but

Morph new openWorld

has worked everywhere I have visited.

Also, what does InfoMorph do for you that UpdatingStringMorph does not?

Cheers,
Bob

On 1/5/13 4:14 AM, Edgar J. De Cleene wrote:


On 1/4/13 6:45 PM, "Ken G. Brown" [hidden email] wrote:

Have you been able to run this in the latest Squeak4.4-12327 on Cog 2640?
On my Mac, InfoMorph openInWorld fails:

InfoMorph class(Object)>>doesNotUnderstand: #openInWorld
Receiver: InfoMorph
Arguments and temporary variables:
aMessage:  openInWorld
exception:  MessageNotUnderstood: InfoMorph class>>openInWorld
resumeValue:  nil
Receiver's instance variables:
superclass:  StringMorph
methodDict:  a MethodDictionary(#cambio:->(InfoMorph>>#cambio: "a
CompiledMethod...etc...
format:  150
instanceVariables:  nil
organization:  ('step' step stepTime)
('as yet unclassified' cambio:)

subclasses:  nil
name:  #InfoMorph
classPool:  nil
sharedPools:  nil
environment:  Smalltalk globals "a SystemDictionary with lots of globals"
category:  #SqueakRos

Ken G. Brown



        
[see attached file: InfoMorph.st]
?
You was right and Houston, we have a problem
Because if you check the hierarchy
ProtoObject
  Object
    Morph
      StringMorph
        InfoMorph

And Morph openInWorld also fails, which is a serious bug.
I using my own derivate images for long time, so don't see this problem.
Now check with older VMs....

And yes Morph openInWorld fails.

Later I updated from trunk for see which change break this.

Normally use the attached for years and on any Squeak , Cuis and Pharo 1.4
It's initialized in red and adhere to top edge, then I do find window,
select and embed into DokingBar, so have position of mouse and current
Change Set

Thanks!

Edgar





    



12