Hide event not working

What I’m trying to do:
Get code to run when a component is hidden, specifically when its visible property is set to False.

What I’ve tried and what’s not working:
The hide event does not appear to be working.

Clone link:
https://anvil.works/build#clone:7KNSXS7YF3UAIKBT=L3TN7CXPMIKWSNQFEXCE2QC5

2 Likes

I don’t know if that is a bug or just how Hide events work. But a show event works upon toggling from not visible to visible. But the Hide event only seem to work when the parent of the container or the whole form disappears.

Ok, it does trigger when I change the open form, but not when I merely hide a parent container:
https://anvil.works/build#clone:JKSSCB5QLU7NBIVQ=YS3WLIVSNWZXRDIRLLFAFMX7

1 Like

Just realised it was a misunderstanding. It only works on closing the form

1 Like

Is that documented somewhere? In the API, for instance, the descriptions of show and hide events are symmetric.

I don’t think there is anything about it there. Maybe it is a glitch?

1 Like

Did you ever find a workaround? I’m trying to get the hide event to trigger when I make a component invisible, but running into the same issue of it not triggering.

I don’t have a workaround (though maybe you could do something with JavaScript?) but I’m going to at least change this thread to a Feature Request (though it’s really a bug report, I think).

1 Like