private View OnPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e) { if (e.CurrentView != null && !e.ProposedView) { int index = Int32.Parse(e.CurrentView.Name); if (e.Direction == View.FocusDirection.Left) { index--; } if (e.Direction == View.FocusDirection.Right) { index++; } if (index < 1) { index = _textButton.Length; } if (index > _textButton.Length) { index = 1; } e.ProposedView = _textButton[index - 1]._button; } if (!e.ProposedView && !e.CurrentView) { e.ProposedView = _textButton[0]._button; } return(e.ProposedView); }
/// <summary> /// Callback when the keyboard focus is going to be changed. /// </summary> /// <param name="resource">FocusManager.Instance</param> /// <param name="e">event</param> /// <returns> The view to move the keyboard focus to.</returns> private View OnKeyboardPreFocusChange(object resource, FocusManager.PreFocusChangeEventArgs e) { View CurrentView = e.CurrentView; View nextView = e.ProposedView; if (!CurrentView && !nextView) { // Set the initial focus to the first tile in the current page should be focused. nextView = mpages[scrollView.FocusedItemIndex].GetChildAt(new TableView.CellPosition(0, 0)); } else if (!nextView) { // ScrollView is being focused but nothing in the current page can be focused further // in the given direction. We should work out which page to scroll to next. uint currentPage = (uint)scrollView.FocusedItemIndex; uint newPage = currentPage; if (e.Direction == View.FocusDirection.Left) { newPage--; } else if (e.Direction == View.FocusDirection.Right) { newPage++; } newPage = global::System.Math.Max(0, global::System.Math.Min(mTotalPages - 1, newPage)); if (newPage == currentPage) { if (e.Direction == View.FocusDirection.Left) { newPage = mTotalPages - 1; } else if (e.Direction == View.FocusDirection.Right) { newPage = 0; } } // Scroll to the page in the given direction //scrollView.ScrollTo(newPage); if (e.Direction == View.FocusDirection.Left) { // Work out the cell position for the last tile uint remainingExamples = numOfSamples - newPage * EXAMPLES_PER_ROW * ROWS_PER_PAGE; currentRow = (remainingExamples >= EXAMPLES_PER_ROW * ROWS_PER_PAGE) ? ROWS_PER_PAGE - 1 : ((remainingExamples % (EXAMPLES_PER_ROW * ROWS_PER_PAGE) + EXAMPLES_PER_ROW) / EXAMPLES_PER_ROW - 1); currentColumn = remainingExamples >= EXAMPLES_PER_ROW * ROWS_PER_PAGE ? EXAMPLES_PER_ROW - 1 : (remainingExamples % (EXAMPLES_PER_ROW * ROWS_PER_PAGE) - currentRow * EXAMPLES_PER_ROW - 1); // Move the focus to the last tile in the new page. nextView = mpages[newPage].GetChildAt(new TableView.CellPosition(currentRow, currentColumn)); } else { // Move the focus to the first tile in the new page. nextView = mpages[newPage].GetChildAt(new TableView.CellPosition(0, 0)); } } return(nextView); }
private View OnKeyboardPreFocusChangeSignal(object source, FocusManager.PreFocusChangeEventArgs e) { View nextView = null; switch (e.Direction) { case View.FocusDirection.Up: Console.WriteLine("FocusPreChanged Up"); break; case View.FocusDirection.Down: Console.WriteLine("FocusPreChanged Down"); break; case View.FocusDirection.Left: Console.WriteLine("FocusPreChanged Left "); break; case View.FocusDirection.Right: Console.WriteLine("FocusPreChanged Right"); break; default: Console.WriteLine("FocusPreChanged Unknown"); break; } return(nextView); }
private View OnPreFocusChange(object obj, FocusManager.PreFocusChangeEventArgs e) { if (e.CurrentView != null && !e.ProposedView) { if (e.Direction == View.FocusDirection.Down) { View view = e.CurrentView.Parent as View; if (view.Name == "UpperListTable") { e.ProposedView = midListTable.GetChildAt(new TableView.CellPosition(0, 0));; } else if (view.Name == "MidListTable") { e.ProposedView = bottomListTable.GetChildAt(new TableView.CellPosition(0, 0));; } } else if (e.Direction == View.FocusDirection.Up) { View view = e.CurrentView.Parent as View; if (view.Name == "BottomListTable") { e.ProposedView = midListTable.GetChildAt(new TableView.CellPosition(0, 0));; } else if (view.Name == "MidListTable") { e.ProposedView = upperListTable.GetChildAt(new TableView.CellPosition(0, 0));; } } } if (!e.ProposedView && !e.CurrentView) { e.ProposedView = upperListTable.GetChildAt(new TableView.CellPosition(0, 0));; } return(e.ProposedView); }
private View Instance_PreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e) { View nextView; Tizen.Log.Debug("NUI", "Instance_PreFocusChange = " + e.Direction.ToString()); //added if (e.CurrentView == null) { e.CurrentView = label[0]; } if (e.ProposedView == null) { e.ProposedView = label[0]; } int index = Array.FindIndex(label, x => x == e.CurrentView); Tizen.Log.Debug("NUI", "index = " + index); switch (e.Direction) { case View.FocusDirection.Up: index = (index + numOfSamples - 2) % numOfSamples; //changed _ani.Play(); break; case View.FocusDirection.Down: index = (index + 2) % numOfSamples; //changed Tizen.Log.Debug("NUI", "pushbutton1 Visible=" + pushButton1.Visible + " pushbutton2 Visible=" + pushButton2.Visible); //added break; case View.FocusDirection.Left: //added pushButton1.Show(); pushButton2.Show(); break; case View.FocusDirection.Right: //added pushButton1.Hide(); pushButton2.Hide(); break; default: break; } Tizen.Log.Debug("NUI", "next index = " + index); nextView = label[index]; if (e.CurrentView.HasFocus()) { //currentView?.ClearKeyInputFocus(); //removed } //nextView?.SetKeyInputFocus(); //removed return(nextView); }
private View OnPreFocusChange(object obj, FocusManager.PreFocusChangeEventArgs e) { if (!e.ProposedView && !e.CurrentView) { e.ProposedView = listTable.GetChildAt(new TableView.CellPosition(0, 0));; } return(e.ProposedView); }
// Callback for KeyboardFocusManager private View OnPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e) { if (!e.ProposedView && !e.CurrentView) { e.ProposedView = _contentContainer.GetChildAt(1); } return(e.ProposedView); }
/// <summary> /// Callback when the keyboard focus is going to be changed. /// </summary> /// <param name="resource">FocusManager.Instance</param> /// <param name="e">event</param> /// <returns> The view to move the keyboard focus to.</returns> private View PreFocusChange(object resource, FocusManager.PreFocusChangeEventArgs e) { View currentView = e.CurrentView; View nextView = e.ProposedView; if (currentView == null && nextView == null) { nextView = pushButton; } return(nextView); }
private View A1_PreFocusChange(object o, FocusManager.PreFocusChangeEventArgs e) { View v1 = e.CurrentView; e.CurrentView = v1; View v2 = e.ProposedView; e.ProposedView = v2; View.FocusDirection b1 = e.Direction; e.Direction = b1; return(v1); }
private View OnPreFocusChange(object obj, FocusManager.PreFocusChangeEventArgs e) { if (e.CurrentView != null && !e.ProposedView) { if (e.Direction == View.FocusDirection.Down) { e.ProposedView = listTable; } if (e.Direction == View.FocusDirection.Up) { e.ProposedView = detailButton; } } if (!e.ProposedView && !e.CurrentView) { e.ProposedView = detailButton; } return(e.ProposedView); }
private View OnPreFocusChange(object obj, FocusManager.PreFocusChangeEventArgs e) { if (e.CurrentView != null && !e.ProposedView) { if (e.Direction == View.FocusDirection.Left) { e.ProposedView = buttonClose; } if (e.Direction == View.FocusDirection.Right) { e.ProposedView = buttonSend; } } if (!e.ProposedView && !e.CurrentView) { e.ProposedView = buttonSend; } return(e.ProposedView); }
public void FocusManagerPreFocusChange() { tlog.Debug(tag, $"FocusManagerPreFocusChange START"); FocusManager a1 = FocusManager.Instance; a1.PreFocusChange += A1_PreFocusChange; a1.PreFocusChange -= A1_PreFocusChange; tlog.Debug(tag, $"112"); object o1 = new object(); FocusManager.PreFocusChangeEventArgs e = new FocusManager.PreFocusChangeEventArgs(); tlog.Debug(tag, $"113"); A1_PreFocusChange(o1, e); tlog.Debug(tag, $"114"); tlog.Debug(tag, $"FocusManagerPreFocusChange END (OK)"); Assert.Pass("FocusManagerPreFocusChange"); }
private View OnPreFocusChange(object obj, FocusManager.PreFocusChangeEventArgs e) { if (e.CurrentView != null && !e.ProposedView) { if (e.Direction == View.FocusDirection.Down) { e.ProposedView = optionList;//.GetChildAt(0); } if (e.Direction == View.FocusDirection.Up) { e.ProposedView = contentTable;//.GetChildAt(0); } Tizen.Log.Fatal("NUISamples", "proposed view is null "); // Console.WriteLine("================== Proposed view null"); } if (!e.ProposedView && !e.CurrentView) { e.ProposedView = contentTable;//.GetChildAt(0); } return(e.ProposedView); }
private View OnKeyboardPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e) { View nextFocusView = e.ProposedView; // When nothing has been focused initially, focus the text field in the first spin if (!e.CurrentView && !e.ProposedView) { nextFocusView = _spinYear.SpinText; } else if (e.Direction == View.FocusDirection.Left) { // Move the focus to the spin in the left of the current focused spin if (e.CurrentView == _spinMonth.SpinText) { nextFocusView = _spinYear.SpinText; } else if (e.CurrentView == _spinDay.SpinText) { nextFocusView = _spinMonth.SpinText; } } else if (e.Direction == View.FocusDirection.Right) { // Move the focus to the spin in the right of the current focused spin if (e.CurrentView == _spinYear.SpinText) { nextFocusView = _spinMonth.SpinText; } else if (e.CurrentView == _spinMonth.SpinText) { nextFocusView = _spinDay.SpinText; } } return(nextFocusView); }
private View OnKeyboardPreFocusChangeSignal(object source, FocusManager.PreFocusChangeEventArgs e) { // Reset the action reminder timer, as the user has provided input. _actionReminderTimer.Stop(); _actionReminderTickCounter = 0; _actionReminderTimer.Start(); View view = null; if (_menu.ScrollMenu().IsActive) { int id = _menu.ScrollMenu().FocusedItemID; if (e.Direction == View.FocusDirection.Up) { _menu.Focus(false, true); view = _posterMenus[_currentMenuIndex].Focus(true); } else if (e.Direction == View.FocusDirection.Left) { --id; if (id < 0) { _menu.Focus(false, false); view = _systemMenu.Show(true, View.FocusDirection.Left); MoveSourceMenuAnimation(true); } } else if (e.Direction == View.FocusDirection.Right) { ++id; if (id >= _menu.Count) { id = _menu.Count - 1; } } if (view == null) { id = id % _menu.Count; if (id != _currentMenuIndex) { UpdateActivePosterMenu(id); } view = e.ProposedView; } } else if (_posterMenus[_currentMenuIndex].ScrollMenu().IsActive) { if (e.Direction == View.FocusDirection.Down) { _posterMenus[_currentMenuIndex].Focus(false); if (_systemMenu.FocusedIcon >= 0) { _menu.Show(true); view = _systemMenu.Show(true, View.FocusDirection.Down); MoveSourceMenuAnimation(true); } else { view = _menu.Focus(true, true); } } else { view = e.ProposedView; } } else if (_systemMenu.IsActive) { int icon = _systemMenu.FocusedIcon; if (e.Direction == View.FocusDirection.Left) { --icon; if (icon < 0) { icon = 0; } } else if (e.Direction == View.FocusDirection.Right) { ++icon; if (icon > 2) { icon = -1; _systemMenu.Show(false, View.FocusDirection.Right); MoveSourceMenuAnimation(false); view = _menu.Focus(true, false); } } else if (e.Direction == View.FocusDirection.Up) { _systemMenu.Show(false, View.FocusDirection.Up); MoveSourceMenuAnimation(false); _menu.Focus(false, true); view = _posterMenus[_currentMenuIndex].Focus(true); } if (view == null) { _systemMenu.FocusedIcon = icon; view = _systemMenu._systemIcons[icon]; } } return(view); }
private View Instance_PreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e) { Tizen.Log.Debug("NUI", "..."); View currentView = (e.CurrentView) ?? lastFocusedView; View nextView = null; Tizen.Log.Debug("NUI", "NUI-4 " + "PreFocusChange-" + e.Direction); if (currentView != null && currentView.HasBody()) { Tizen.Log.Debug("NUI", "NUI-5 " + " Current-" + currentView.Name); } if (currentView) { switch (e.Direction) { case View.FocusDirection.Left: nextView = currentView.LeftFocusableView; if (nextView == null) { Tizen.Log.Debug("NUI", "NUI-6 " + "LeftFocusableView is NULL!!!!"); } else { Tizen.Log.Debug("NUI", "NUI-7 " + currentView.Name + ".LeftFocusableView =" + nextView.Name); } break; case View.FocusDirection.Right: nextView = currentView.RightFocusableView; if (nextView == null) { Tizen.Log.Debug("NUI", "NUI-8 " + "RightFocusableView is NULL!!!!"); } else { Tizen.Log.Debug("NUI", "NUI-9 " + currentView.Name + ".RightFocusableView =" + nextView.Name); } break; case View.FocusDirection.Up: nextView = currentView.UpFocusableView; if (nextView == null) { Tizen.Log.Debug("NUI", "NUI-10 " + "UpFocusableView is NULL!!!!"); } else { Tizen.Log.Debug("NUI", "NUI-11 " + currentView.Name + ".UpFocusableView =" + nextView.Name); } break; case View.FocusDirection.Down: nextView = currentView.DownFocusableView; if (nextView == null) { Tizen.Log.Debug("NUI", "NUI-12 " + "DownFocusableView is NULL!!!!"); } else { Tizen.Log.Debug("NUI", "NUI-13 " + currentView.Name + ".DownFocusableView =" + nextView.Name); } break; default: nextView = null; //added break; } } if (e.ProposedView == null) { Tizen.Log.Debug("NUI", "NUI-14 " + "ProposedView in NULL!!"); } else if (e.ProposedView.HasBody()) { Tizen.Log.Debug("NUI", "NUI-15 " + "ProposedView-" + e.ProposedView.Name); } else { Tizen.Log.Debug("NUI", "NUI-16 " + "ProposedView does NOT have body!!!" + e.ProposedView); } nextView = nextView ?? (e.ProposedView) ?? currentView; lastFocusedView = nextView; if (nextView != null && nextView.HasBody()) { Tizen.Log.Debug("NUI", "NUI-17 " + "Next-" + nextView.Name); } return(nextView); }
/// <summary> /// Callback when the keyboard focus is going to be changed. /// </summary> /// <param name="source">FocusManager.Instance</param> /// <param name="e">event</param> /// <returns> The view to move the keyboard focus to.</returns> private View OnKeyboardPreFocusChangeSignal(object source, FocusManager.PreFocusChangeEventArgs e) { if (!e.CurrentView && !e.ProposedView) { return(_menuContainer); } View actor = _menuContainer.Container; if (e.Direction == View.FocusDirection.Up) { // Move the Focus to Poster ScrollContainer and hide Bottom Container (Menu ScrollContainer) if (_menuContainer.IsFocused) { actor = _postersContainer[_currentPostersContainerID].GetCurrentFocusedActor(); _menuContainer.SetFocused(false); _postersContainer[_currentPostersContainerID].SetFocused(true); //HideBottomContainer(); } } else if (e.Direction == View.FocusDirection.Down) { // Show Bottom Container (Menu ScrollContainer) and move the Focus to it if (!_menuContainer.IsFocused) { ShowBottomContainer(); actor = _menuContainer.GetCurrentFocusedActor(); _postersContainer[_currentPostersContainerID].SetFocused(false); _menuContainer.SetFocused(true); } } else { // Set the next focus view. actor = e.ProposedView; } if (e.Direction == View.FocusDirection.Left) { if (_menuContainer.IsFocused) { int id = _menuContainer.FocusedItemID % _totalPostersContainers; if (id != _currentPostersContainerID) { Hide(_postersContainer[_currentPostersContainerID]); _currentPostersContainerID = id; Show(_postersContainer[_currentPostersContainerID]); } } } else if (e.Direction == View.FocusDirection.Right) { if (_menuContainer.IsFocused) { int id = _menuContainer.FocusedItemID % _totalPostersContainers; if (id != _currentPostersContainerID) { Hide(_postersContainer[_currentPostersContainerID]); _currentPostersContainerID = id; Show(_postersContainer[_currentPostersContainerID]); } } } return((View)actor); }