/// <summary> /// Text Sample Application initialisation. /// </summary> private void Initialize() { Window.Instance.BackgroundColor = Color.Black; guide = new TextLabel(); guide.HorizontalAlignment = HorizontalAlignment.Center; guide.VerticalAlignment = VerticalAlignment.Center; guide.PositionUsesPivotPoint = true; guide.ParentOrigin = ParentOrigin.TopLeft; guide.PivotPoint = PivotPoint.TopLeft; guide.Size2D = new Size2D(1920, 96); guide.FontFamily = "Samsung One 600"; guide.Position2D = new Position2D(0, 94); guide.MultiLine = false; guide.PointSize = DeviceCheck.PointSize15; //guide.PointSize = 15.0f; guide.Text = "CheckBox Sample \n"; guide.TextColor = Color.White; //guide.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f); Window.Instance.GetDefaultLayer().Add(guide); testText = new TextLabel(); testText.HorizontalAlignment = HorizontalAlignment.Center; testText.VerticalAlignment = VerticalAlignment.Center; testText.PositionUsesPivotPoint = true; testText.ParentOrigin = ParentOrigin.TopLeft; testText.PivotPoint = PivotPoint.TopLeft; testText.Size2D = new Size2D(300, 100); testText.FontFamily = "Samsung One 600"; testText.Position2D = new Position2D(810, 200); testText.MultiLine = false; //testText.PointSize = 15.0f; testText.PointSize = DeviceCheck.PointSize15; testText.Text = "Test Text \n"; testText.TextColor = Color.Black; testText.BackgroundColor = Color.White; Window.Instance.GetDefaultLayer().Add(testText); CheckBoxGroup checkBoxGroup = new CheckBoxGroup(); checkBoxGroupView = checkBoxGroup.GetCheckBoxGroup(); Tizen.NUI.Components.CheckBox checkbox1 = checkBoxGroup.GetCheckBox1(); Tizen.NUI.Components.CheckBox checkbox2 = checkBoxGroup.GetCheckBox2(); Tizen.NUI.Components.CheckBox checkbox3 = checkBoxGroup.GetCheckBox3(); checkbox1.StateChangedEvent += CheckBoxStateChanged; checkbox2.StateChangedEvent += CheckBoxStateChanged; checkbox3.StateChangedEvent += CheckBoxStateChanged; checkBoxGroupView.Position = new Position(810, 400, 0); Window.Instance.GetDefaultLayer().Add(checkBoxGroupView); FocusManager.Instance.SetCurrentFocusView(checkbox1); }
/// <summary> /// Popups initialisation. /// </summary> private void OnIntialize() { _toggleButton = new Tizen.NUI.Components.CheckBox(); _toggleButton.Focusable = true; _toggleButton.ParentOrigin = ParentOrigin.TopLeft; _toggleButton.PivotPoint = PivotPoint.TopLeft; _toggleButton.Size2D = new Size2D(150, 80); _toggleButton.CheckImageURLSelector = new StringSelector() { Normal = normalOffImage, Selected = normalOnImage, Focused = focusedOffImage, SelectedFocused = focusedOnImage }; }
/// <summary> /// checkboxbutton initialisation. /// </summary> /// <param name="text">text</param> private void OnIntialize(string text) { _checkboxbutton = new Tizen.NUI.Components.CheckBox(); _checkboxbutton.Text = text; _checkboxbutton.TextColor = Color.White; _checkboxbutton.PointSize = DeviceCheck.PointSize8; _checkboxbutton.TextPadding = new Extents(20, 12, 0, 0); _checkboxbutton.Size2D = new Size2D(300, 48); _checkboxbutton.Focusable = true; _checkboxbutton.ParentOrigin = ParentOrigin.TopLeft; _checkboxbutton.PivotPoint = PivotPoint.TopLeft; _checkboxbutton.CheckImageURLSelector = new StringSelector() { Normal = normalImagePath, Selected = selectImagePath, Focused = focusImagePath, SelectedFocused = focusSelectImagePath }; }
/// <summary> /// The event will be triggered when have key clicked and focus on spin. /// </summary> /// <param name="source">checkbox.</param> /// <param name="e">event</param> /// <returns>The consume flag</returns> private void CheckBoxStateChanged(object source, EventArgs e) { Tizen.NUI.Components.CheckBox checkbox = source as Tizen.NUI.Components.CheckBox; // Show testText's shadow or not. if (checkbox.Text == "Shadow") { } // The testText auto scroll or not. else if (checkbox.Text == "Color") { if (checkbox.IsSelected) { testText.TextColor = Color.Red; } else { testText.TextColor = Color.White; } } // Show testText's underline or not. else if (checkbox.Text == "Underline") { PropertyMap underlineMapSet = new PropertyMap(); if (checkbox.IsSelected) { underlineMapSet.Add("enable", new PropertyValue("true")); underlineMapSet.Add("color", new PropertyValue("black")); underlineMapSet.Add("height", new PropertyValue("3.0f")); } else { underlineMapSet.Add("enable", new PropertyValue("false")); } testText.Underline = underlineMapSet; } }
/// <summary> /// CheckBoxButtonGroup initialisation. /// </summary> private void Initialize() { checkBoxGroup = new View(); checkBoxGroup.ParentOrigin = ParentOrigin.TopLeft; checkBoxGroup.PivotPoint = PivotPoint.TopLeft; checkBoxGroup.Size2D = new Size2D(300, 200); CheckBox radioSample1 = new CheckBox("Shadow"); checkBox1 = radioSample1.GetCheckBoxButton(); checkBox1.Position = new Position(0, 0, 0); CheckBox radioSample2 = new CheckBox("Color"); checkBox2 = radioSample2.GetCheckBoxButton(); checkBox2.Position = new Position(0, 50, 0); CheckBox radioSample3 = new CheckBox("Underline"); checkBox3 = radioSample3.GetCheckBoxButton(); checkBox3.Position = new Position(0, 100, 0); checkBoxGroup.Add(checkBox1); checkBoxGroup.Add(checkBox2); checkBoxGroup.Add(checkBox3); // Move focus from checkBox1. checkBox1.KeyEvent += (obj, e) => { if (e.Key.KeyPressedName == "Down" && Key.StateType.Up == e.Key.State) { MoveFocusTo(checkBox2); } else if (e.Key.KeyPressedName == "Left" && Key.StateType.Up == e.Key.State) { MoveFocusTo(checkBoxGroup.LeftFocusableView); } else if (e.Key.KeyPressedName == "Right" && Key.StateType.Up == e.Key.State) { MoveFocusTo(checkBoxGroup.RightFocusableView); } return(false); }; // Move focus from checkBox1. checkBox2.KeyEvent += (obj, e) => { if (e.Key.KeyPressedName == "Down" && Key.StateType.Up == e.Key.State) { MoveFocusTo(checkBox3); } else if (e.Key.KeyPressedName == "Up" && Key.StateType.Up == e.Key.State) { MoveFocusTo(checkBox1); } else if (e.Key.KeyPressedName == "Left" && Key.StateType.Up == e.Key.State) { MoveFocusTo(checkBoxGroup.LeftFocusableView); } else if (e.Key.KeyPressedName == "Right" && Key.StateType.Up == e.Key.State) { MoveFocusTo(checkBoxGroup.RightFocusableView); } return(false); }; // Move focus from checkBox3. checkBox3.KeyEvent += (obj, e) => { if (e.Key.KeyPressedName == "Up" && Key.StateType.Up == e.Key.State) { MoveFocusTo(checkBox2); } else if (e.Key.KeyPressedName == "Left" && Key.StateType.Up == e.Key.State) { MoveFocusTo(checkBoxGroup.LeftFocusableView); } else if (e.Key.KeyPressedName == "Right" && Key.StateType.Up == e.Key.State) { MoveFocusTo(checkBoxGroup.RightFocusableView); } return(false); }; }