Scrolling Text setCharacters

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

Scrolling Text setCharacters

Stephen Rowley
Just learning smalltalk & squeak. One of the first things I wanted to try was to load text into a scroll morph at the press of a button.

I  renamed the Scrolling Text morph scroll.
And I put the following code underneath button.
Everything seems fine but the last line

The error I get back is that scroll is an unknown variable.

So my question is am I referencing the scroll morph correctly in the button script?

button
    | stream data |
    Transcript show: 'hello'.
    
"Read file into a string"
    stream _ FileStream fileNamed: 'test.txt'.
    data _ stream contentsOfEntireFile.
    stream close.
    Transcript show: data.
    scroll setCharacters: data.



Thanks in advance

Steve

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Scrolling Text setCharacters

Stephen Rowley


Just learning smalltalk & squeak. One of the first things I wanted to try was to load text into a scroll morph at the press of a button.

I  renamed the Scrolling Text morph scroll.
And I put the following code underneath button.
Everything seems fine but the last line

The error I get back is that scroll is an unknown variable.

So my question is am I referencing the scroll morph correctly in the button script?

button
    | stream data |
    Transcript show: 'hello'.
    
"Read file into a string"
    stream _ FileStream fileNamed: 'test.txt'.
    data _ stream contentsOfEntireFile.
    stream close.
    Transcript show: data.
    scroll setCharacters: data.



Thanks in advance

Steve

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Scrolling Text setCharacters

Jerome Peace
In reply to this post by Stephen Rowley
[Newbies] Scrolling Text setCharacters

Hi Steve.

The variable scroll is indeed a undefined in the
method you used.

To get the results you wanted I tried this.

>From objects pull out a press me button.
Get the halo and press the unmarked light green
button.
That got a "button" tile scirpt.

>From objects>text get a scrollingText.
Using halos get viewer for the scrolling text.
(At this point you can name the scrolling text
whatever you want I made it say "Scroll".)
Pull the tiles  that says "Scroll characters <-" onto
the button tile script.



Now change the button tile script to text using the
check box.
You will see :
Scroll setCharacters: ''

paste the working part of your script before that. And
change the argument from '' to data.

Giving:

button
  | stream data |
    Transcript show: 'hello'.

"Read file into a string"
    stream _ FileStream fileNamed: 'test.txt'.
    data _ stream contentsOfEntireFile.
    stream close.
    Transcript show: data.
        Scroll setCharacters: data .

Place the mouse over the box that says normal and from
the menu pick the action you want to trigger the
script (say mouse up for example )
press and release the button. And you get your text in
the transcript and the scrolling text.

The ritual we did with the tiles insured that Scroll
refered to the desired object namely your text morph.

There are probably other ways to insert the reference
but this was the one I tried first because I figured
it would work.


Yours in service, --Jerome Peace


>
>Stephen Rowley stever1975 at gmail.com
>Wed Jan 24 20:21:39 UTC 2007 wrote:
>
>
>Just learning smalltalk & squeak. One of the first
things I wanted to try
>was to load text into a scroll morph at the press of
a button.
>
>I  renamed the Scrolling Text morph scroll.
>And I put the following code underneath button.
>Everything seems fine but the last line
>
>The error I get back is that scroll is an unknown
variable.
>
>So my question is am I referencing the scroll morph
correctly in the button

>script?
>
>button
>    | stream data |
>    Transcript show: 'hello'.
>
>"Read file into a string"
>    stream _ FileStream fileNamed: 'test.txt'.
>    data _ stream contentsOfEntireFile.
>    stream close.
>    Transcript show: data.
>    scroll setCharacters: data.
>
>
>
>Thanks in advance
>
>Steve
>


 
____________________________________________________________________________________
Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners