Hello There,
Would anyone be able to tell me how I could accomplish the following:
I would like a component on my page to only become visible 5 seconds after the page has been loaded.
Is there a way to do this?
Many thanks
Hello There,
Would anyone be able to tell me how I could accomplish the following:
I would like a component on my page to only become visible 5 seconds after the page has been loaded.
Is there a way to do this?
Many thanks
There are two ways to do this, and it depends on the whether the parent container of the component is Coordinate or Flex. If in a Flex container, set Component.position.display
to a value of false
(boolean). If in a Coordinate Container, set Component.props.style.display
to a value of ânoneâ (string).
In the onStartup Event of the View the component resides in:
system.perspective.sendMessage('FIVESECONDTIMER',scope='page')
from time import sleep
sleep(5)
# Flex
self.props.display = True
# Coordinate
self.props.style.display = 'block'
You should be aware that this will happen in the Designer as well, so if you work on the View, the Button will appear after five seconds. If you save the View while the button is visible, then it will be immediately visible in sessions, so you should apply similar logic to make the button invisible immediately in the Viewâs onStartup Event.
Thank you for this info.
In the Vision world, we were always warned against using âsleepâ within GUI scripts. Does Perspective handle this in a separate thread automatically?
It wonât hang the UI like in Vision but itâs still not a good idea. I would treat this suggestion as a quick hack at best.
I have a separate thread going about setting the value of checkboxes within a FlexRepeater. I have not been able to get the bools set to the value I want on view startup unless I delay running the script. Since a sleep delay is still not a good idea, what do you suggest to trigger my script?