Open Event undefined is not an object

I’ve been having some issue when trying to populate the contents of a container control using the open event.

On machines with slower internet connections I would sometimes get an undefined is not an object javascript error, see link to long to post.

My work around has been to move the code from the open event to the shown event, now the page content loads in what ever order it feels like.

Should you not update content from the open event?

Error Dump

Shown is the right place with web applications
This event is raised once the control is present in the users web browser

I’ve moved everything into the webpage shown event still getting some issues, should I be putting it in each objects shown event. e.g WebLabel, WebTextField and not the webpage shown event?

Error Dump

Initializing controls should be done in the individual controls Shown events.

Is there anyway of checking if a controls shown event has taken place?

There’s no flag on the controls if that’s what you mean. It wouldn’t get you much anyway because you’d have to defer the changes til the next event loop.

Thanks Greg, that makes sense, I’ve moved most bits into the controls shown event now just a few bits left.

Just making sure I’ve got setting up containers correct, Is it okay to modify the setup of a Container before doing EmbedWithin?

This code below is part of the WebPage Shown Event.


    ' Define New Container
     ContainerOrganisationsT = New ContainerControlOrganisations
    
    ' Hide Container By Default
     ContainerOrganisationsT.Visible = False
    
    ' Set Error Flag for Container
     ContainerOrganisationsT.ErrorFlag = False
    
    ' Set Lock Vertical/Horizontal
     ContainerOrganisationsT.LockVertical = False
     ContainerOrganisationsT.LockHorizontal = True
    
    ' Pass Organisations Object Array to Container ByRef
     ContainerOrganisationsT.Organisations = Organisations
    
    ' Set No Scrollbars for Container
     ContainerOrganisationsT.ScrollbarsVisible = WebContainer.ScrollbarsNever
    
    ' Add Handler for Update Owner Height 
     AddHandler ContainerOrganisationsT.UpdateOwnerHeight, AddressOf ContainerOrganisationsUpdateOwnerHeight

    ' Embed Container
     ContainerOrganisationsT.EmbedWithin(Self, 0, 175, ContainerOrganisationsT.Width, ContainerOrganisationsT.DefaultHeight)