Click or drag to resize

ArrayDeProtect Function (Array)

Removes write protection from an entire array.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.4a
Syntax
 FUNCTION ArrayDeProtect(
	aTarget AS ARRAY
) AS LOGIC
View Source

Parameters

aTarget
Type: Array
The array to deprotect.

Return Value

Type: Boolean
TRUE if the array was successfully deprotected; otherwise, FALSE.
Remarks
ArrayDeprotect() removes the protection placed on an array by the ArrayProtect() function, allowing their values to be changed.
Examples
This example stores values to array elements, protects the elements, then removes the protection so they can be changed:
X#
 1FUNCTION Start()
 2    LOCAL aWriteProtect AS ARRAY
 3    aWriteProtect := ArrayCreate(2)
 4    ArrayPut(aWriteProtect, 1, "Origin")
 5    ArrayPut(aWriteProtect, 2, "Origin")
 6    ArrayProtect(aWriteProtect)
 7    // Write allowed in calling function
 8    ArrayPut(aWriteProtect, 1, "Main Function")
 9    // Write not allowed in called function
10    TryChange(aWriteProtect)
11    ArrayDeprotect(aWriteProtect)
12    // Write allowed (no protection)
13    TryChange(aWriteProtect)
14FUNCTION TryChange(aPassed)
15    ArrayPut(aPassed, 1, "Sub Function")
See Also