Class ScriptableProperty
Definition
- Assembly:
- Tizen.NUI.dll
Adds this attribute to any property belonging to a view (control) you want to be scriptable from JSON.
public class ScriptableProperty : Attribute
- Inheritance
-
objectScriptableProperty
Remarks
Example:
class MyView : public CustomView { [ScriptableProperty()] public int MyProperty { get { return _myProperty; } set { _myProperty = value; } } }
Internally the following occurs for property registration ( this only occurs once per Type, not per Instance):
- The controls static constructor should call ViewRegistry.Register() (only called once for the lifecycle of the app).
- Within Register() the code will introspect the Controls properties, looking for the ScriptableProperty() attribute.
- For every property with the ScriptableProperty() attribute, TypeRegistration.RegisterProperty is called.
- TypeRegistration.RegisterProperty calls in to DALi C++ Code Dali::CSharpTypeRegistry::RegisterProperty().
- DALi C++ now knows the existance of the property and will try calling SetProperty, if it finds the property in a JSON file (loaded using builder).
The DALi C# example:
class MyView : public CustomView {
[ScriptableProperty()] public double Hours { get { return seconds / 3600; } set { seconds = value * 3600; } } }
Equivalent code in DALi C++: in MyControl.h class MyControl : public Control { struct Property { enum { HOURS = Control::CONTROL_PROPERTY_END_INDEX + 1 } } }
in MyControl-impl.cpp
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::MyControl, Toolkit::Control, Create ); DALI_PROPERTY_REGISTRATION( Toolkit, MyControl, "Hours", INTEGER, DISABLED ) DALI_TYPE_REGISTRATION_END()
Constructors
View SourceScriptableProperty(ScriptableType)
Declaration
public ScriptableProperty(ScriptableProperty.ScriptableType type = ScriptableType.Default)
Parameters
Type | Name | Description |
---|---|---|
ScriptableProperty.ScriptableType | type |
Remarks
Example:
class MyView : public CustomView { [ScriptableProperty()] public int MyProperty { get { return _myProperty; } set { _myProperty = value; } } }
Internally the following occurs for property registration ( this only occurs once per Type, not per Instance):
- The controls static constructor should call ViewRegistry.Register() (only called once for the lifecycle of the app).
- Within Register() the code will introspect the Controls properties, looking for the ScriptableProperty() attribute.
- For every property with the ScriptableProperty() attribute, TypeRegistration.RegisterProperty is called.
- TypeRegistration.RegisterProperty calls in to DALi C++ Code Dali::CSharpTypeRegistry::RegisterProperty().
- DALi C++ now knows the existance of the property and will try calling SetProperty, if it finds the property in a JSON file (loaded using builder).
The DALi C# example:
class MyView : public CustomView {
[ScriptableProperty()] public double Hours { get { return seconds / 3600; } set { seconds = value * 3600; } } }
Equivalent code in DALi C++: in MyControl.h class MyControl : public Control { struct Property { enum { HOURS = Control::CONTROL_PROPERTY_END_INDEX + 1 } } }
in MyControl-impl.cpp
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::MyControl, Toolkit::Control, Create ); DALI_PROPERTY_REGISTRATION( Toolkit, MyControl, "Hours", INTEGER, DISABLED ) DALI_TYPE_REGISTRATION_END()
Fields
View Sourcetype
Declaration
public readonly ScriptableProperty.ScriptableType type
Field Value
Type | Description |
---|---|
ScriptableProperty.ScriptableType |
Remarks
Example:
class MyView : public CustomView { [ScriptableProperty()] public int MyProperty { get { return _myProperty; } set { _myProperty = value; } } }
Internally the following occurs for property registration ( this only occurs once per Type, not per Instance):
- The controls static constructor should call ViewRegistry.Register() (only called once for the lifecycle of the app).
- Within Register() the code will introspect the Controls properties, looking for the ScriptableProperty() attribute.
- For every property with the ScriptableProperty() attribute, TypeRegistration.RegisterProperty is called.
- TypeRegistration.RegisterProperty calls in to DALi C++ Code Dali::CSharpTypeRegistry::RegisterProperty().
- DALi C++ now knows the existance of the property and will try calling SetProperty, if it finds the property in a JSON file (loaded using builder).
The DALi C# example:
class MyView : public CustomView {
[ScriptableProperty()] public double Hours { get { return seconds / 3600; } set { seconds = value * 3600; } } }
Equivalent code in DALi C++: in MyControl.h class MyControl : public Control { struct Property { enum { HOURS = Control::CONTROL_PROPERTY_END_INDEX + 1 } } }
in MyControl-impl.cpp
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::MyControl, Toolkit::Control, Create ); DALI_PROPERTY_REGISTRATION( Toolkit, MyControl, "Hours", INTEGER, DISABLED ) DALI_TYPE_REGISTRATION_END()