StringPointer
elements.StringPointer (Typedef)
Function type for accessing and modifying string values by reference.
This type definition enables functional-style string value manipulation, commonly used in the elements UI system for two-way data binding between UI components and text data models. Unlike other pointer types, this includes an additional erase parameter for special text operations.
Usage example:
var myString = "Hello";
var pointer:StringPointer = (val, erase) -> {
if (val != null) myString = val;
// Handle erase operation if needed
if (erase == true) myString = "";
return myString;
};
// Read current value
var current = pointer();
// Set new value
pointer("World");
// Erase content
pointer(null, true);
See: TextFieldView, FieldView