Tech Tip: Hiding Class Properties
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: July 11, 2023
4Dv20 allows classes to have declared properties by using the property keyword. Properties will then appear in the autocomplete suggestions which can assist with writing code. In some cases, there may be the need to not expose certain properties. To hide a property from the autocomplete list, add an underscore character to the start of the property. This will also apply to other items like functions and even classes.
The following image shows how the _hiddenProperty and _hiddenFunc are not in the autocomplete suggestions:
The following image shows how even a class can be hidden:
The property can still be used and will be visible in the debugger, however the property will no longer appear in the list of suggestions for autocompleting.