Value as Text

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

Value as Text

K. K. Subramaniam
Hi,

How do I make a TextMorph track the numeric value of another Morph (say
SliderMorph's numericValue or Holder's count)? This is so I could use larger
fonts and sizes for the numbers.

Thanks in advance .. Subbu
_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: Value as Text

Bert Freudenberg
On Jun 14, 2007, at 8:59 , subbukk wrote:

> Hi,
>
> How do I make a TextMorph track the numeric value of another Morph  
> (say
> SliderMorph's numericValue or Holder's count)? This is so I could  
> use larger
> fonts and sizes for the numbers.

Well, the canonical way is that you make a script for your Text that  
defines its behavior:

        Text's numericValue <- Slider's numericValue

OTOH you can just bring up the halo on a watcher's readout and choose  
"change font" from its halo menu. You can even  take the readout  
string out of the watcher using its black handle (or duplicate using  
the green one), it still works.

- Bert -


_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: Value as Text

Alan Kay
In reply to this post by K. K. Subramaniam
Hi --

There are two ways to do this. Texts have a setter for "numeric value".

[]

Even simpler (though a little more kludgy) is to get a "simple watcher" from the viewer that holds the property you wish to see, click to the "Updating String" (called "Readout String" in OLPC version), and use red menu to make the changes.

In "regular Etoys" a shift-click will get you this component, and you can use the red menu to change the font and size, etc.

In OLPC Etoys, use the red menu to "Unlock Readout String", then select it and use its red menu to change font and size.

Cheers,

Alan

At 11:59 PM 6/13/2007, subbukk wrote:
Hi,

How do I make a TextMorph track the numeric value of another Morph (say
SliderMorph's numericValue or Holder's count)? This is so I could use larger
fonts and sizes for the numbers.

Thanks in advance .. Subbu
_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland

_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

RE : Value as Text

Dreyfuss Pierre-André (EDUM)
In reply to this post by K. K. Subramaniam

Hi,

The problem using the tile   text numeric value <-  Slider numericValue  is the number of decimals if numbers are not integers.


To adjust the number of decimals, you can make a script  with a parameter containing the smalltalk code :

decimals: t1
        self
                setNumericValue: (Réglette getNumericValue asScaledDecimal: t1).
        self
                setCharacters: (self getCharacters truncateTo: (self getCharacters findString: 's')
                                        - 1)


See the attached project. The text as the script decimals: 5.

Use this tile in a script to adjust the number of decimals displayed. The text of course should contain a number.


Regards

-------- Message d'origine--------
De: [hidden email] de la part de subbukk
Date: jeu. 14/06/2007 08:59
À: [hidden email]
Objet : [Squeakland] Value as Text
 
Hi,

How do I make a TextMorph track the numeric value of another Morph (say
SliderMorph's numericValue or Holder's count)? This is so I could use larger
fonts and sizes for the numbers.

Thanks in advance .. Subbu
_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland



_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland

DecimalText.001.pr (51K) Download Attachment