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
|

Re: continuous display of cursor position

Edgar De Cleene
Re: [squeak-dev] continuous display of cursor position


On 1/5/13 8:55 AM, "

" <[hidden email]> wrote:

  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


Apologize all.

Too much sidras for new year :=)

Yes, always was Morph new openWorld.

And lucky us, no bugs

Cheers and is a good news see you active on list.

Edgar


Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Hannes Hirzel
Hello Bob and Edgar

For the case of tracking mouse position InfoMorph and
UpdatingStringMorph do the same.

Both are subclasses of StringMorph

UpdatingStringMorph does much more though (61 instance methods, class
comment copied in below, might need some updating).

InfoMorph is a nice example how the stepping mechanism of Morphic may be used.
It only needs two method override.

--Hannes


BTW Edgar, the code you posted was corrupted, have you seen my updated version?


CLASS COMMENT of UpdatingStringMorph


A StringMorph that constantly tries to show the current data from the
target object.  When sent #step, it shows what the target objects has
(target perform: getSelector).  When edited (with shift-click), it
writes back to the target.

floatPrecision = 1. to round to integer.
floatPrecision = .1 to round to 1 decimal place, etc.

Even when ((target == nil) or: [getSelector == nil]), the user would
still like to edit the string with shift-click.

On 1/5/13, Edgar J. De Cleene <[hidden email]> wrote:

>
>
>
> On 1/5/13 8:55 AM, "
>
> " <[hidden email]> wrote:
>
>>    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
>
>
> Apologize all.
>
> Too much sidras for new year :=)
>
> Yes, always was Morph new openWorld.
>
> And lucky us, no bugs
>
> Cheers and is a good news see you active on list.
>
> Edgar
>

Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Edgar De Cleene



On 1/5/13 9:29 AM, "H. Hirzel" <[hidden email]> wrote:

> BTW Edgar, the code you posted was corrupted, have you seen my updated
> version?

Yes, but again I apologize.
As said in another mail, always use the working .morph by years.
Only take the relevant part for original question.
And as said to Bob,  forget "new".
As Bob said , is Morph new openInWorld (or Morph new openInHand)
And all Morph descendant (below in hierarchy) should responds except you
override as in this case

Cheers

PS: 1 to: 1000 do: [ea:| Transcript show: 'Must avoid drink too much sidra
next year';cr ]



Reply | Threaded
Open this post in threaded view
|

Re: continuous display of cursor position

Chris Muller-4
In reply to this post by Casey Ransberger-2
Hey, thanks..  :)

On Fri, Jan 4, 2013 at 10:50 PM, Casey Ransberger
<[hidden email]> wrote:

> 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

Bert Freudenberg
In reply to this post by Bob Arning-2
On 04.01.2013, at 13:48, Bob Arning <[hidden email]> wrote:

> UpdatingStringMorph new
>     target: [World activeHand position asString];
>     getSelector: #value;
>     stepTime: 10;
>     openInWorld
>
> Cheers,
> Bob

Scott Wallace has a "watch it" context menu item in his images that does exactly this. E.g., you simply select an expression:

        ActiveHand position

and choose "watch it" from the menu, and it creates a simple updating string morph.

(similarly, there is a "button for it" menu item that executes the expression once when clicked. very convenient)

- Bert -



12