Question about layers
Question about layers
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
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
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
Re: Question about layers
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
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.
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.
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
- airsoftsoftwair
- Posts: 5443
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Question about layers
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:
This should do the job
Code: Select all
Function p_LayersEnabled()
ExitOnError(False)
GetAttribute(#LAYER, 1, #ATTRWIDTH)
Local code = GetLastError()
ExitOnError(True)
Return(IIf(code = 1078, False, True))
EndFunction
Re: Question about layers
Thank you Andreas!
Your sample code is really helpful, I'll try it ASAP
Your sample code is really helpful, I'll try it ASAP
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
- airsoftsoftwair
- Posts: 5443
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Question about layers
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
Oki, thank you
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
Re: Question about layers
Hi Andreas,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:
This should do the jobCode: Select all
Function p_LayersEnabled() ExitOnError(False) GetAttribute(#LAYER, 1, #ATTRWIDTH) Local code = GetLastError() ExitOnError(True) Return(IIf(code = 1078, False, True)) EndFunction
I was thinking that if the Layer have been enabled just before the check this function will fail... but better then nothing...
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
- airsoftsoftwair
- Posts: 5443
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Question about layers
Hmm, I don't get that, why do you think should this fail?
Re: Question about layers
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
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
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆