3 using Tizen.NUI.BaseComponents;
5 using Tizen.NUI.Components;
7 namespace Tizen.NUI.Samples
9 using tlog = Tizen.Log;
10 public class RemoveAllChildrenTest : IExample
12 const string tag = "NUITEST";
14 public void Activate()
18 public void Deactivate()
22 private TextLabel t1, t2, t3, t4;
23 private Window window;
24 private ScrollableBase scroll;
29 window = NUIApplication.GetDefaultWindow();
30 window.KeyEvent += OnKeyEvent;
34 Size = new Size(400, 100),
35 Position = new Position(10, 10),
37 BackgroundColor = Color.Yellow,
44 Size = new Size(400, 150),
45 Position = new Position(10, 120),
47 BackgroundColor = Color.Green,
52 scroll = new ScrollableBase()
54 Size = new Size(400, 500),
55 Position = new Position(10, 280),
56 BackgroundColor = Color.Red,
57 ScrollingDirection = ScrollableBase.Direction.Vertical,
58 Layout = new LinearLayout()
60 LinearOrientation = LinearLayout.Orientation.Vertical,
62 Padding = new Extents(20, 20, 20, 20),
69 Layout = new GridLayout()
71 GridOrientation = GridLayout.Orientation.Vertical,
75 WidthSpecification = 390,
76 HeightSpecification = 590,
77 BackgroundColor = new Color(global::System.Drawing.Color.FromName("SlateBlue")),
78 Padding = new Extents(5, 5, 5, 5),
83 for (int i = 0; i < 9; i++)
85 var t = new TextLabel()
87 Size = new Size(100, 180),
89 BackgroundColor = new Color(0.5f, (100 + 10 * i) / 255.0f, 0.5f, 1),
90 Margin = new Extents(2, 2, 2, 2),
98 WidthSpecification = LayoutParamPolicies.MatchParent,
99 HeightSpecification = 200,
100 Text = "TextLable-3",
101 BackgroundColor = Color.Magenta,
102 Margin = new Extents(10, 10, 10, 10),
109 WidthSpecification = LayoutParamPolicies.MatchParent,
110 HeightSpecification = 200,
111 Text = "TextLable-4",
112 BackgroundColor = new Color(global::System.Drawing.Color.FromName("HotPink")),
113 Margin = new Extents(10, 10, 10, 10),
120 public void OnKeyEvent(object sender, Window.KeyEventArgs e)
122 if (e.Key.State == Key.StateType.Down)
124 if (e.Key.KeyPressedName == "1")
126 ChangeScrollableBaseSizeBigger();
128 else if (e.Key.KeyPressedName == "2")
130 ChangeScrollableBaseSizeSmaller();
132 else if (e.Key.KeyPressedName == "3")
134 RemoveAllChildrenDisposeFalse();
136 else if (e.Key.KeyPressedName == "4")
138 RemoveAllChildrenDisposeTrue();
140 else if (e.Key.KeyPressedName == "5")
142 AddChildrenInScrollableBase();
148 void ChangeScrollableBaseSizeBigger()
150 tlog.Debug(tag, "ChangeScrollableBaseSizeBigger test");
151 t2.Position += new Position(10, -100);
152 scroll.Position += new Position(0, -100);
153 scroll.HeightSpecification += 100;
157 void ChangeScrollableBaseSizeSmaller()
159 tlog.Debug(tag, "ChangeScrollableBaseSizeSmaller test");
160 t2.Position += new Position(-10, 100);
161 scroll.Position += new Position(0, 100);
162 scroll.HeightSpecification -= 100;
167 void AddChildrenInScrollableBase()
169 tlog.Debug(tag, "AddChildrenInScrollableBase test");
173 Layout = new GridLayout()
175 GridOrientation = GridLayout.Orientation.Vertical,
179 WidthSpecification = 390,
180 HeightSpecification = 590,
181 BackgroundColor = new Color(global::System.Drawing.Color.FromName("SlateBlue")),
182 Padding = new Extents(5, 5, 5, 5),
187 for (int i = 0; i < 9; i++)
189 var t = new TextLabel()
191 Size = new Size(100, 180),
193 BackgroundColor = new Color(0.5f, (100 + 10 * i) / 255.0f, 0.5f, 1),
194 Margin = new Extents(2, 2, 2, 2),
195 Name = $"sub-tl-{i}",
202 WidthSpecification = LayoutParamPolicies.MatchParent,
203 HeightSpecification = 200,
204 Text = "TextLable-3",
205 BackgroundColor = Color.Magenta,
206 Margin = new Extents(10, 10, 10, 10),
213 WidthSpecification = LayoutParamPolicies.MatchParent,
214 HeightSpecification = 200,
215 Text = "TextLable-4",
216 BackgroundColor = new Color(global::System.Drawing.Color.FromName("HotPink")),
217 Margin = new Extents(10, 10, 10, 10),
224 void RemoveAllChildrenDisposeTrue()
226 tlog.Debug(tag, "RemoveAllChildrenDisposeTrue test");
228 scroll.RemoveAllChildren(true);
232 void RemoveAllChildrenDisposeFalse()
234 tlog.Debug(tag, "RemoveAllChildrenDisposeFalse test");
236 scroll.RemoveAllChildren(false);