Class ScriptableProperty

Definition

Namespace:
Tizen.NUI
Assembly:
Tizen.NUI.dll
API Level:
3

Adds this attribute to any property belonging to a view (control) you want to be scriptable from JSON.

C#
Copy
[AttributeUsage(AttributeTargets.Property)] public class ScriptableProperty : Attribute
Inheritance
System.Object
ScriptableProperty
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 Source

ScriptableProperty(ScriptableProperty.ScriptableType)

Declaration
C#
Copy
public ScriptableProperty(ScriptableProperty.ScriptableType type = ScriptableProperty.ScriptableType.Default)
Parameters
Type Name Description
ScriptableProperty.ScriptableType type
API Level: 3

Fields

Declaration
C#
Copy
[Obsolete("Deprecated in API9, will be removed in API11, Use Type")] public readonly ScriptableProperty.ScriptableType type
Field Value
Type Description
ScriptableProperty.ScriptableType
API Level: 3