LOGO-L> Erasing LABELed text 
Author Message
 LOGO-L> Erasing LABELed text

Hello,

Sometimes it's desirable to erase a LABELed text from the screen, e.g.,
when creating the digital part in an analogical-digital watch. CS is no
help here, as it erases EVERYTHING on the screen, while we want
SELECTIVE erasure.

Erasing LABELed text is done by re-LABELing the text *precisely* on the
already LABELed text, but this time in the background color. This can be
accomplished in UCBLogo by:
        SETPC BG
        LABEL [your text]

and in MSWLogo by saying:
        SETPC SCREENCOLOR
        LABEL [your text]

After it you need, of course, restore the original pen color, for the
rest of your program.

As an illustration, I wrote the following program:

===================================================
to main ; blink
cs ht
draw
blink[Welcome to Logo]
end

to draw
setpc[0 0 0]
repeat 6[repeat 6[fd 50 rt 60] rt 60]
end

to blink :txt
pu setpos[-85 -110] pd seth 90     ; LABEL location
setpc [255 0 0]   label :txt wait 30 ; red pencolor
setpc screencolor label :txt wait 30 ; screen color
blink :txt
end
===================================================

Run it: That's an endless loop; to stop it hit Ctrl+Q or Ctrl+Break (in
UCBLogo), or push HALT in MSWLogo.

The "trick" for erasing LABELed text is undocumented, maybe because the
designers found it self evident.

Incidently, George might want to add a digital watch upon his analogical
demo CLOCK.LGO.

Enjoy it,

[[Yehuda]]

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





Mon, 13 Mar 2000 03:00:00 GMT  
 LOGO-L> Erasing LABELed text

Here is a slightly more "modern" way to program it.

Once fired up MSWLogo is free to other things while
that text blinks. It's only "busy" when the timer fires
rather than "busy" all the time in the former infinite
recursive call.

to main ; blink
cs ht
draw
make "Blink.On "True
settimer 1 500 [blink [Welcome to Logo]]
end

to blink :txt
pu setpos[-85 -110] pd seth 90     ; LABEL location
ifelse :Blink.On [setpc [255 0 0]   make "Blink.On "False] ~
                 [setpc screencolor make "Blink.On "True]
label :txt
end

to draw
setpc[0 0 0]
repeat 6[repeat 6[fd 50 rt 60] rt 60]
end

Quote:

> Hello,

> Sometimes it's desirable to erase a LABELed text from the screen, e.g.,
> when creating the digital part in an analogical-digital watch. CS is no
> help here, as it erases EVERYTHING on the screen, while we want
> SELECTIVE erasure.

> Erasing LABELed text is done by re-LABELing the text *precisely* on the
> already LABELed text, but this time in the background color. This can be
> accomplished in UCBLogo by:
>         SETPC BG
>         LABEL [your text]

> and in MSWLogo by saying:
>         SETPC SCREENCOLOR
>         LABEL [your text]

> After it you need, of course, restore the original pen color, for the
> rest of your program.

> As an illustration, I wrote the following program:

> ===================================================
> to main ; blink
> cs ht
> draw
> blink[Welcome to Logo]
> end

> to draw
> setpc[0 0 0]
> repeat 6[repeat 6[fd 50 rt 60] rt 60]
> end

> to blink :txt
> pu setpos[-85 -110] pd seth 90     ; LABEL location
> setpc [255 0 0]   label :txt wait 30 ; red pencolor
> setpc screencolor label :txt wait 30 ; screen color
> blink :txt
> end
> ===================================================

> Run it: That's an endless loop; to stop it hit Ctrl+Q or Ctrl+Break (in
> UCBLogo), or push HALT in MSWLogo.

> The "trick" for erasing LABELed text is undocumented, maybe because the
> designers found it self evident.

> Incidently, George might want to add a digital watch upon his analogical
> demo CLOCK.LGO.

> Enjoy it,

> [[Yehuda]]

> ---------------------------------------------------------------




--
===============================================================

http://www.softronix.com/
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------





Mon, 13 Mar 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. LOGO-L> Pen Erase

2. LOGO-L> erase command

3. LOGO-L> Re: Text for Logo course

4. LOGO-L> Text for Logo course

5. LOGO-L> Orientation of labels

6. LOGO-L> Hebrew LABELing

7. LOGO-L> Re: LABELing

8. LOGO-L> Re: LABELing in MSWLogo

9. LOGO-L> Re: Label in MSWLogo

10. LOGO-L> Semi Circle LABELing in MSWLogo

11. LOGO-L> Re: Helpful texts

12. LOGO-L> Helpful texts

 

 
Powered by phpBB® Forum Software