2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using System.Runtime.InteropServices;
21 using Tizen.NUI.BaseComponents;
22 using Tizen.NUI.Constants;
26 class Example : NUIApplication
28 public Example() : base()
32 public Example(string stylesheet) : base(stylesheet)
36 public Example(string stylesheet, WindowMode windowMode) : base(stylesheet, windowMode)
40 protected override void OnCreate()
46 public void Initialize()
48 Window window = Window.Instance;
49 window.BackgroundColor = Color.White;
51 View view1 = new View()
53 Position2D = new Position2D(10, 10),
54 BackgroundColor = Color.Magenta,
55 Size2D = new Size2D(200, 200),
59 View view2 = new View()
61 Position2D = new Position2D(10, 240),
62 BackgroundColor = Color.Red,
63 Size2D = new Size2D(200, 200),
70 FocusManager.Instance.SetCurrentFocusView(view1);
71 view2.UpFocusableView = view1;
72 view1.DownFocusableView = view2;
74 view1.KeyEvent += (obj, e) =>
76 if (e.Key.State != Key.StateType.Down)
80 Tizen.Log.Debug("NUI", "View1 KeyPressedName: " + e.Key.KeyPressedName);
81 Adaptor.Instance.FeedKeyEvent(e.Key);
85 view2.KeyEvent += (obj, e) =>
87 if (e.Key.State != Key.StateType.Down)
89 // Tizen.Log.Debug("NUI", "View2 key state != Down");
93 // Tizen.Log.Debug("NUI", "View2 KeyPressedName: " + e.Key.KeyPressedName);
97 Tizen.Log.Debug("NUI", "View2 received view1 feed event: " + e.Key.KeyPressedName);
101 Tizen.Log.Debug("NUI", "View2 received event: " + e.Key.KeyPressedName);
108 static void _Main(string[] args)
110 Example example = new Example();