Page 1 of 1

[15 Mar 2009] Bug in SetLayerStyle() with an Inserted TextObject

Posted: Sat Jun 13, 2020 5:32 pm
by PEB
Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 15 Mar 2009 11:06:22 -0000

Hi Andreas,

I've got a really strange bug here. The following code does not work with OS 4.1 (the text gets destroyed in the interval):

Code: Select all

EnableLayers()
SetFont("DejaVu Sans.font", 16)
CreateTextObject(1, "This is a test")
InsertLayer(1, #TEXTOBJECT, 1, #CENTER, #CENTER)
Function p_TimeInterval()
    SetLayerStyle(1, {Text = GetTime(TRUE)})
EndFunction
SetInterval(10, p_TimeInterval, 1000)
Repeat
    WaitEvent
Forever
There are two ways of working around this problem.

1) Remove the SetFont() line, and use the default font.

OR

2) Use DisplayTextObject() instead of InsertLayer()

[17 Mar 2009] Re: Bug in SetLayerStyle() with an Inserted TextObject

Posted: Sat Jun 13, 2020 5:32 pm
by airsoftsoftwair
Note: This is an archived post that was originally sent to the Hollywood mailing list on Tue, 17 Mar 2009 10:14:30 +0100
Hi Andreas,

I've got a really strange bug here. The following code does not work with OS 4.1 (the text gets destroyed in the interval):

Code: Select all

EnableLayers()
SetFont("DejaVu Sans.font", 16)
CreateTextObject(1, "This is a test")
InsertLayer(1, #TEXTOBJECT, 1, #CENTER, #CENTER)
Function p_TimeInterval()
   SetLayerStyle(1, {Text = GetTime(TRUE)})
EndFunction
SetInterval(10, p_TimeInterval, 1000)
Repeat
   WaitEvent
Forever
There are two ways of working around this problem. 1) Remove the SetFont() line, and use the default font. OR 2) Use DisplayTextObject() instead of InsertLayer()
Yes, that's definitely a bug. I've fixed it. Thanks for the report!