I've made a skin specifically for loading different layouts depending on whether the sun has set or not, and it works fine except it doesn't stay open and I'm not sure why. Once I load the skin, it changes the layout if needed and then closes itself immediately. Not sure what I've done wrong.
You need to be sure that a version of this skin is included and loading in both layouts. Be SURE that for this skin in Layout "day" it is testing to see if it is now "night", and for this skin in Layout "night" it is testing for "day".
If you are not careful, you can easily get into an endless loop...
jsmorley wrote: ↑August 2nd, 2020, 6:15 pm
If you are not careful, you can easily get into an endless loop...
As far as I see the question, this definitely goes to an endless loop, unless the skin having the posted code is not included in any of the Night and Day layouts. If it's not, the skin has to be manually loaded and when the WebParser measures get their value, the skin loads the appropriate layout. If it is not included into the loaded layout, it's ok, but otherwise the discussed endless loop comes out. But this means that the skin has to be loaded manually from time to time, or there has to be another skin which loads this one for instance on certain moments of day.
Hope I don't miss something, but this is what I think about this thing.
balala wrote: ↑August 2nd, 2020, 7:16 pm
As far as I see the question, this definitely goes to an endless loop, unless the skin having the posted code is not included in any of the Night and Day layouts. If it's not, the skin has to be manually loaded and when the WebParser measures get their value, the skin loads the appropriate layout. If it is not included into the loaded layout, it's ok, but otherwise the discussed endless loop comes out. But this means that the skin has to be loaded manually from time to time, or there has to be another skin which loads this one for instance on certain moments of day.
Hope I don't miss something, but this is what I think about this thing.
While I'm not in love with this approach, as I think it is a bit complicated to set up, and prone to problems if you want to change your layouts to load or unload skins or reposition something, I think it can work with some care.
You need two copies of this skin, what I will call the "testing" skins. One of them should be testing to see if it is "day", and that skin should be included and loaded in the Layout he creates for "night". The second one should be testing to see if it is "night", and that skin should be included and loaded in the Layout he creates for "day".
You want to avoid ever having the test cause a layout to be loaded that contains a running version of the same "testing" skin, as that is an endless loop... In other words, you can't ever allow a test that asks "is it night?" to load a layout that contains a test that asks "is it night?".
jsmorley wrote: ↑August 2nd, 2020, 7:24 pm
You need two copies of this skin, what I will call the "testing" skins. One of them should be testing to see if it is "day", and that skin should be included and loaded in the Layout he creates for "night". The second one should be testing to see if it is "night", and that skin should be included and loaded in the Layout he creates for "day".
You want to avoid ever having the test cause a layout to be loaded that contains a running version of the same "testing" skin, as that is an endless loop... In other words, you can't ever allow a test that asks "is it night?" to load a layout that contains a test that asks "is it night?".
Yes, agree, if there are those two, almost identical versions of the skin.