Print or textout

Find quick help here to get you started with Hollywood
Post Reply
ilbarbax
Posts: 115
Joined: Thu Apr 01, 2010 6:41 pm

Print or textout

Post by ilbarbax »

I have a small problem with print/textout functions.
If I have to print out a recursive text (read clock time), because fonts have the transparent background after few seconds my printing out is unreadible due to the overwriting of the characters. cls function does not sort out the problem because works on the whole screen and then delete parts of the screen I don't want.
I suspect this can be solved with layers, but I'm not yet to this stage!
Which is the better way to sort out this problem?
User avatar
TheMartian
Posts: 109
Joined: Sun Feb 28, 2010 12:51 pm

Re: Print or textout

Post by TheMartian »

Hi

The 'crude' method is to erase the area where the clock is displayed using a Box() command with an appropriate fill folor before rewriting the time. For more fun you can create a small brush, select it for output and then clear it and write the time using TextOut before unselecting it every time you wish to update the time. The extra fun comes from racing the brush around and stamping it all over the place.... Sorry, just my warped sense of humour :-) You can do something similar with a layer or even a sprite. But brushes are 'the mother' of graphics objects in Hollywood and easy to handle, and they may be converted to all other graphic object types.

regards
jesper
PEB
Posts: 569
Joined: Sun Feb 21, 2010 1:28 am

Re: Print or textout

Post by PEB »

Yes, using layers is the way to go. Try this code:

EnableLayers()
TextOut(0, 0, "This string will be changed", {Name="Time"})
Function p_UpdateTime()
time$=GetTime(True)
SetLayerStyle("Time", {Text=time$})
EndFunction
SetInterval(1, p_UpdateTime, 1000)
Repeat
WaitEvent
Forever
ilbarbax
Posts: 115
Joined: Thu Apr 01, 2010 6:41 pm

Re: Print or textout

Post by ilbarbax »

PEB wrote:Yes, using layers is the way to go. T

Work thanks, but altrough the whole program run fine on OS4, when I compile it for WS32 it crashes rather immediately without advisings. Can this problem related to the layers?
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Print or textout

Post by airsoftsoftwair »

Does the program really crash (i.e. Windows displaying an error box) or does Hollywood exit and display an error?
ilbarbax
Posts: 115
Joined: Thu Apr 01, 2010 6:41 pm

Re: Print or textout

Post by ilbarbax »

Is not Hollywood crashing, but the .exe of my application.
In reality I can't understand if it crashes or not. When I run the exe it blanks the screen flashing some of the things that should appear for a fraction of second then it exit to windows. No message boxes at all. Some time it build the first background screen ant it seems that at the first iteration it fail something. This is matter of one secon. Under OS4 i works fine. I haven't tryed on aros yet (I have to reinstall it)
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Print or textout

Post by airsoftsoftwair »

Hmm, weird, can you post the source code? Then I can try it here. But try to make it as short as possible :-)
Post Reply