Page 1 of 1

Question about layers

Posted: Thu Feb 24, 2011 11:34 am
by Allanon
Hello,
I was wondering if there is a way to check if layers are enabled or not.
I've looked through the docs but the only thing I've found is query GetAttribute to know how many layers are currently attached to the associated bgpic of a given display, but of course this solution is not safe, for example if the layers have been enabled just before my check.

Any hints?

Thank in advance
:D

Re: Question about layers

Posted: Thu Feb 24, 2011 2:03 pm
by Bugala
Dont know actual command, but program wise in normal cases it shouldnt be hard to put a variable my_islayerson=0 or 1 and keep changing it depending if you took layers on or off.

Re: Question about layers

Posted: Thu Feb 24, 2011 5:48 pm
by Allanon
Hi Bugala and thank you for your suggestion but it doesn't help :)
That's why I'm actually enhancing ScuiLib and I need to know if layer are enabled from Hollywood because the ScuiLib user may use layers or not and I cannot know this information in advance ;)
Strictly talking I've to make a floating object and if user is using layers I will build this object using layers, if the user is not using layers I will make this floating object using a sprite.
I'd like to give the freedom to switch layers on/off to the final user.

Re: Question about layers

Posted: Sat Feb 26, 2011 11:38 am
by airsoftsoftwair
I'm afraid that's currently not possible. I'll add a new attribute for this for the next version. Until then, you can use the following workaround:

Code: Select all

Function p_LayersEnabled()

ExitOnError(False)
GetAttribute(#LAYER, 1, #ATTRWIDTH)
Local code = GetLastError()
ExitOnError(True)

Return(IIf(code = 1078, False, True))
EndFunction
This should do the job :)

Re: Question about layers

Posted: Sat Feb 26, 2011 3:22 pm
by Allanon
Thank you Andreas!
Your sample code is really helpful, I'll try it ASAP :)

Re: Question about layers

Posted: Sat Feb 26, 2011 10:07 pm
by airsoftsoftwair
By the way, keep in mind that layers enabled/disabled is a setting that is local to each display. So if you have multiple displays opened, there could be differences between them, e.g. layers enabled in display 1, but disabled in display 2, etc.

Re: Question about layers

Posted: Sat Feb 26, 2011 10:50 pm
by Allanon
Oki, thank you ;)

Re: Question about layers

Posted: Sun Feb 27, 2011 12:04 am
by Allanon
Andreas wrote:I'm afraid that's currently not possible. I'll add a new attribute for this for the next version. Until then, you can use the following workaround:

Code: Select all

Function p_LayersEnabled()

ExitOnError(False)
GetAttribute(#LAYER, 1, #ATTRWIDTH)
Local code = GetLastError()
ExitOnError(True)

Return(IIf(code = 1078, False, True))
EndFunction
This should do the job :)
Hi Andreas,
I was thinking that if the Layer have been enabled just before the check this function will fail... but better then nothing... 8-)

Re: Question about layers

Posted: Sun Feb 27, 2011 12:07 pm
by airsoftsoftwair
Hmm, I don't get that, why do you think should this fail?

Re: Question about layers

Posted: Sun Feb 27, 2011 9:41 pm
by Allanon
Sorry Andreas,
I've misread your example, you have included a check with the specific error code and not against a generic error, wrongly I was thinking that a generic error check could have caused the function failing...
I'm a bit out of phase in this period, sorry again :D