How to know how many Popover exist & when do they go out of scope?

Hello all,

With the code below, I create a popover.

Dim pop As New PopcntSiteInformationWide
pop.ShowPopover(grdSites, WebContainer.DisplaySides.Top, 200, 500)
pop.Initialize( True, SID )

When I close it, I use this code

Self.Visible = False
Call ClearFields
Me.Close

Is the above correct?
Tim

To be consistent with the rest of the language, they should go out of scope when the variable does, closing on its own. if you wanted it to hang around, you’d make a property to hold it open somewhere. Otherwise they’re going to leak.

@Ricardo_Cruz ?

Popovers are single use and are destroyed when they’re hidden. Trying to show a previously shown Popover results in the following in Web:

All this is to say that tracking them doesn’t really matter. You should discard the reference to a popover after it’s shown and use events on the WebContainer with AddHandler to perform functions.

2 Likes

I was hoping they would go out of scope and be destroyed when it is closed.
Tim

The framework is already taking care of cleaning up when using Popovers as @Anthony_G_Cyphers described. Reusing popovers isn’t supported at the moment.

For convenience, it isn’t necessary to hold a reference (as happens with a WebDialog).

That said, I’ve just seen it isn’t being cleaned up, unless you Close it programmatically. Clicking outside closes the Popover, and it must be cleaned up.

Here is the bug report:
Issue #79359

Thanks!

2 Likes