why does setlayerstyle not accept createlayer ID?

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

why does setlayerstyle not accept createlayer ID?

Post by Bugala » Mon Jun 11, 2018 9:07 pm

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: 693
Joined: Sun Feb 14, 2010 7:11 pm

Re: why does setlayerstyle not accept createlayer ID?

Post by Bugala » Mon Jun 11, 2018 11:27 pm

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: 693
Joined: Sun Feb 14, 2010 7:11 pm

Re: why does setlayerstyle not accept createlayer ID?

Post by Bugala » Tue Jun 12, 2018 9:23 am

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: 193
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: why does setlayerstyle not accept createlayer ID?

Post by jPV » Tue Jun 12, 2018 12:27 pm

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

ID 0 in SetLayerName modifies the last added layer.

Bugala
Posts: 693
Joined: Sun Feb 14, 2010 7:11 pm

Re: why does setlayerstyle not accept createlayer ID?

Post by Bugala » Tue Jun 12, 2018 1:35 pm

Ah, thats a good tip. I had missed that 0 option.

Post Reply