SegmentedButton crashes after setting tab page programmatically

I am using @Antonio_Rinaldi code to select a specific tab page on a tabbar programmatically. There is a problem with a SegmentedButton: if I have a SegmentedButton with a Pressed event on the first screen of the tabbar, it will raise an exception when I click on that SegmentedButton.

Here is a sample project: I’m setting the active tab page to 1 and on that screen the SegmentedButton works fine. When I click on the left tab bar icon and then on the SegmentedButton, it crashes. Any idea how to solve this?

https://www.amazon.de/clouddrive/share/Nqvyd5UNWN0JGp1WykQ7yc65BK9eJO6tcBj53BEITNP

Probably a timing problem
Maybe is not a good idea to set the tab change in the opening event
Try to call it with a timer

1 Like

That works, thank you. The delay looks a bit ugly though. I’ll keep it for now and try to find a better solution.