why does setlayerstyle not accept createlayer ID?

Find quick help here to get you started with Hollywood
Post Reply
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

why does setlayerstyle not accept createlayer ID?

Post by Bugala »

What am I doing wrong in here, or is this some sort of bug?
  • EnableLayers()
    n = CreateTextObject(Nil, "yea", color=#BLACK)
    SetLayerStyle(n, {text="no"})
It complains "String or number expected in argument 1!"
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: why does setlayerstyle not accept createlayer ID?

Post by Bugala »

Forgot to add one line to show that it works in other place:

Code: Select all

EnableLayers()
n = CreateTextObject(Nil, "yea", color=#BLACK)
DisplayTextObject(n, 100, 100)
SetLayerStyle(n, {text="no"})
So createtextobjecst output works when using DisplayTextObject, but it wont work when using setlayerstyle?
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: why does setlayerstyle not accept createlayer ID?

Post by Bugala »

I got round the problem and probably figured what half the problem was too.

Displaytextobject makes a textout layer, hence i had to figure out the ID of that new layer.

I took it by looking what is the highest numbered layer attached to that bgpic, but is there a better way to do it?

Displaytext dont seem to return the id of the layer it creates, but is there a way to give that textout layer a name when creating it, like "DisplayTextObject(1, 100, 100, {name="myname"})"?
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: why does setlayerstyle not accept createlayer ID?

Post by jPV »

DisplayTextObject(n, 100, 100)
SetLayerName(0, "mytextlayer")

ID 0 in SetLayerName modifies the last added layer.
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: why does setlayerstyle not accept createlayer ID?

Post by Bugala »

Ah, thats a good tip. I had missed that 0 option.
User avatar
Clyde
Posts: 348
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: why does setlayerstyle not accept createlayer ID?

Post by Clyde »

Thanks a lot, jPV! I also missed that 0 option (that should be highlighted definitely better in the documentation, it is easy to overread) and wonder and tried exactly like Bugala.
Glad I used the board search. :-)
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
Post Reply