Is there a good reason for the form_show
event to be fired when a visible component is set to visible?
If yes, then please ignore this FR.
I can’t think find any good reason, but I have a good reason for form_show
not to be fired: it causes execution of code that has already been executed.
I have created this little helper function:
def set_visible(comp, visible):
if comp.visible != visible:
comp.visible = visible
Then I have replaced a bunch of:
self.comp.visible = visible
With:
set_visible(self.comp, visible)
And the number of form_show
events fired has decreased and the app is snappier.
EDIT
It’s worse than I thought
I have a column panel cp1
containing a column panel cp2
containing a datagrid containing a repeating panel containing row item forms.
When items are added to the repeating panel, their form_show
events are fired as expected.
When cp1.visible
and cp2.visible
are set to False
, the datagrid is invisible.
When cp1.visible
is set to True
, cp2
is still invisible and so are its descendants, but the form_show
events of the repeating panel items are all fired.
Is this a feature request or a bug?
Here is a little test app:
https://anvil.works/build#clone:4IWL4XN76PHYLXGX=UVLD2HQMKPTVHAYG6AAI2ED6