WebPage 2b or <> 2b

Have a page that I’m embedding a Container Control programmatically.
After using/showing the page, adding one (or more of the Container Controls) then come back to show the WebPage again those controls are still there, plus any new one that have been added this time.

To overcome this problem have change the WebPage from Implicit Instance “ON” to “OFF”, and change the .show instruction to:

if app.WPwpUserIssueDetails <> nil then app.WPwpUserIssueDetails = nil end if app.WPwpUserIssueDetails = new wpUserIssueDetails app.WPwpUserIssueDetails.show

and added a property: WPwpUserIssueDetails as wpUserIssueDetails

Is this correct way to do this?
Also is the last line required? (I ran once with the line comment out, and it ran ok.)

Yes.
Implicit instance quite literally creates ONE instance - which you then modified by adding controls to it.
It uses code something like

function wpUserIssueDetails() as wpUserIssueDetails
         static implicitInstance as wpUserIssueDetails
         if implicitInstance is nil then
              implicitInstance = new wpUserIssueDetails
         end if
         return implicitInstance
end function      

Even when you hide it/close it that one instance still exists so the things you added last time are still there.

[quote=116381:@Jim Smith]To overcome this problem have change the WebPage from Implicit Instance “ON” to “OFF”, and change the .show instruction to:

if app.WPwpUserIssueDetails <> nil then
app.WPwpUserIssueDetails = nil
end if
app.WPwpUserIssueDetails = new wpUserIssueDetails
app.WPwpUserIssueDetails.show
and added a property: WPwpUserIssueDetails as wpUserIssueDetails

Is this correct way to do this?
Also is the last line required? (I ran once with the line comment out, and it ran ok.)[/quote]
The last line is optional if you have Visible set to true in the IDE. There are situations where you want to leave Visible false, which allows you to make modifications to the webpage (like embedding a container) before it is shown.

The first three lines, on the other hand, are completely unnecessary.

  if app.WPwpUserIssueDetails <> nil then
    app.WPwpUserIssueDetails = nil
  end if

The reference to any current page is released when you create the new one:

  app.WPwpUserIssueDetails = new wpUserIssueDetails

This one line may be all that you need.

Thanks Tim.

I[quote][/quote]
think I remember reading that.