TextUnload Method

Object List Next Object

Defined By:
File

Description:

Controls which properties are saved out when saving as text. All properties are saved out by default. It is used by the Text-based object saving mechanism that is used by the write module (as text) functions.

Declaration:

Function TextUnload(ByVal indent As String,cmds as String) As Integer

Details:

TextUnload is a method used to create the lines that appear inside the With block for a particular object. It is used during writing of the .eto file. If an object inherits a TextUnload method, it can be overridden to provide different text-writing behavior for that object.

Commands is a String containing all properties to be written out, along with their values. This string can be edited to add or remove properties. Indent is a String containing the number of leading spaces on each line in the Commands String. Setting the return value of TextUnload to False will cause NONE of the properties to be written out as text.

When an object has a TextUnload method, no properties defined by this object will be output by default.

The return value for TextUnload is True if inherited properties were handled by the TextUnload and False if the default output for inherited properties were used.

If you want to change how properties defined by your object write out, but not how inherited properties are written out, implement a TextUnload and return False.

If you want to change how inherited properties write out, implement a TextUnload and return True. When you do this, it is the responsibility of the TextUnload method to output all the properties for that object. There are two ways to output properties for an object:

  1. Call the TextUnload method of a base class.

  2. Use the TextFieldUnload function to output a specific property.

Example:

The following TextUnload method does not change how the default properties write out.

Function TextUnload(ByVal indent As String, cmds As String) As Integer
' Now that this object has a TextUnload, we are completely reponsible
' for writing unique properties to this object.
'
' Append to 'cmds' any
cmds = cmds & TextFieldUnload(me, indent, "MyUniqueProperty")

' Have inherited properties write out.
TextUnload = False
End Function

Function TextUnload(ByVal indent As String, cmds As String) As Integer
' Now that this object has a TextUnload, we are completely reponsible
' for writing unique properties to this object.

' Inhibit writing of inherited properties
TextUnload = True

End Function

See Also:

Globals , TextFieldUnload method