closing containercontrol is slow

In my Windows-Desktop App i have a mainwindow with a pagepanel with 2 pages.
On the first page there is a listbox with a list of invoices. When the user doubleclicks on one of the rows the invoice-details are shown
I’m doing this by instanciating a container control with the invoice-details, loading the data, and embedding these details into the second page.

Going back to the invoice-list i’m closing the container control, using self.close, and returning to the first page of the panel.

Now im wondering why the closing needs a quite long time, about 2-3 seconds. It’s not very user-friendly waiting such a long time to see the list again. Is there a way to make it faster?

Have you profiled the code? That’ll give you a little insight as to what method(s) is(are) taking so long.

Cheat! Make the container invisible and switch the page panel value. THEN close the container. It may still take that amount of time but user probably won’t see it unless they’re quickly clicking on items to see the details.

.[quote=331387:@Tim Parnell]Have you profiled the code? That’ll give you a little insight as to what method(s) is(are) taking so long.[/quote]
Hello Tim, yes, i did. The profile only tells me, that it takes so long, but not why…

How much code have you got in the cancel close events and close events of the various controls on the cc ?
How much in the lost focus events ?

[quote=331391:@Norman Palardy]How much code have you got in the cancel close events and close events of the various controls on the cc ?
How much in the lost focus events ?[/quote]
Hi Norman, this is a good thought… in the container control, described above, i have several sub container controls, and they really have a lot of controls with the lost focus event.

Thank you Bob, your idea is not so bad. I’ve tried it and i can only see the delay when clicking very quick after closing, or better to say, the cheat-closing.