Component Node 2D
How is the Component Node 2D plugin similar to the one shown in the diagram implemented? I haven't found it in Kanzi and am currently trying to implement dynamic layout indicator lights.
-
I Cannot upload images.。。。。。。
0 -
Component node 2D
In Kanzi, a Component Node 2D refers to a 2D node that you create within the scene graph. Here's what the knowledge sources tell us:
What is a 2D Node (Node2D)?
Node2Dis the base class of all 2D nodes in Kanzi. It implements functionality common to all 2D nodes, such as rendering, layout, and hit testing. [Node2D Java API] [Node2D Runtime API]To build UI graphs, you use classes derived from
Node2D, such as:-
Image2D -
EmptyNode2D -
StackLayout2D -
TextBlock2D
Creating a Component Node 2D via Command
In Kanzi Studio, you can create a 2D node using the
CreateComponentNode2Dcommand:CreateComponentNode2D parent itemName componentTypeName
Examples:
# Create a Content Layout 2D node named "My Content Layout" in the RootPage node CreateComponentNode2D "/Screens/Screen/RootPage" "My Content Layout" Kanzi.ContentLayout2D # Create a Prefab View 2D node named "My Prefab View" in the RootPage node CreateComponentNode2D "/Screens/Screen/RootPage" "My Prefab View" Kanzi.PrefabView2DImplementing a Custom 2D Node
If you need custom rendering and layout, you can derive your own class from
kanzi::Node2D:class ExampleNode2D : public kanzi::Node2D { public: static PropertyType<float> ExampleProperty; KZ_METACLASS_BEGIN(ExampleNode2D, Node2D, "MyNamespace.ExampleNode2D") KZ_METACLASS_PROPERTY_TYPE(ExampleProperty) KZ_METACLASS_END() static ExampleNode2DSharedPtr create(Domain* domain, string_view name); protected: explicit ExampleNode2D(Domain* domain, string_view name); void initialize(); Vector2 measureOverride(Vector2 availableSize) override; void updateRenderOverride() override; };0 -
Please sign in to leave a comment.
Comments
2 comments