The RootObject operator is a member of the selfVM context. it returns the specific object instance that was used to open (root) the current ViewModel. It is read-only regarding the referenceâmeaning you cannot change which object is the root while the view is openâbut you can modify the attributes of that object.
Example 1
selfVM.RootObject->notEmpty
This checks if the view is rooted
Example 2
selfVM.RootObject->safeCast(Thing).SomeString:='a new value'
Why is the selfVM.RootObject not typed but requires a cast to be used with the real root? Because OCL is a statically typed language and selfVM is context sensitive - meaning it is available in all ViewModels - there is no one answer to what type the RootObject should have. If you are in the context of a ViewModel, you will however know what type it has and can safely cast.
