Skip to content

Commit

Permalink
Spellbook list to always accept keyboard input
Browse files Browse the repository at this point in the history
Does not require mouse over list control when AlwaysAcceptKeyboardInput = true.
Do not use this flag when multiple lists are present in same UI.
  • Loading branch information
Interkarma committed Feb 1, 2021
1 parent 0d501c1 commit 2bf156c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Assets/Scripts/Game/UserInterface/ListBox.cs
Expand Up @@ -251,6 +251,12 @@ public HorizontalScrollModes HorizontalScrollMode
set { horizontalScrollMode = value; }
}

/// <summary>
/// List will accept keyboard input even when mouse not over control.
/// Do not set this when multiple lists are used within same UI.
/// </summary>
public bool AlwaysAcceptKeyboardInput { get; set; }

#endregion

#region Constructors
Expand All @@ -266,7 +272,7 @@ public override void Update()
{
base.Update();

if (MouseOverComponent)
if (MouseOverComponent || AlwaysAcceptKeyboardInput)
{
if (DaggerfallUI.Instance.LastKeyCode == KeyCode.UpArrow)
SelectPrevious();
Expand Down
Expand Up @@ -351,6 +351,7 @@ void SetupMain()
spellsListBox.OnUseSelectedItem += SpellsListBox_OnUseSelectedItem;
spellsListBox.OnMouseScrollDown += SpellsListBox_OnMouseScroll;
spellsListBox.OnMouseScrollUp += SpellsListBox_OnMouseScroll;
spellsListBox.AlwaysAcceptKeyboardInput = true;
mainPanel.Components.Add(spellsListBox);

// Spells list scroller
Expand Down

0 comments on commit 2bf156c

Please sign in to comment.