wwWebControl::Dispose

Key method for clearing state of a control.

It is crucial that every control calls Dispose() when shutting down, especially container controls. If Dispose() is not called it's very likely that there will be hung references with containers.

For details on implementing a custom Dispose() handler please see the implementation of wwWebControl::Dispose(), which demonstrates complete cleanup. In most cases it's sufficient to simple DoDefault() and use the default behavior, but you may have to override for any custom collections or other reference objects you define.

o.Dispose()

Remarks

Any control that contains reference to any other control reference objects (collections of objects especially) should implement a custom Dispose() handler to clean up these objects and child objects. Often you may have to explicitly loop through the child objects.

overrides dispose should call DoDefault(). If a control has child controls that need some sort of explicit cleanup you should implement a custom Dispose and loop through the child controls yourself. The default implementation loops through all controls and childcontrols and calls Dispose() on each.

Example

*** ListControl::Dispose()
FUNCTION Dispose()

*** Don't do if we were already here
IF THIS.lDISPOSECALLED 
   RETURN
ENDIF

*** Clear custom collections
THIS.Items=null
This.SelectedValues = null

*** Let the default handler do its thing
DODEFAULT()
ENDFUNC

See also:

Class wwWebControl

© West Wind Technologies, 1996-2018 • Updated: 10/09/05
Comment or report problem with topic