Yield keyboard focus upon leaving the ingame chat tab
This commit is contained in:
committed by
Matthias Mailänder
parent
975da89400
commit
e9cc89a336
@@ -81,6 +81,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (tabContainer != null)
|
if (tabContainer != null)
|
||||||
tabContainer.IsVisible = () => true;
|
tabContainer.IsVisible = () => true;
|
||||||
|
|
||||||
|
var chatPanel = widget.Get(panels[IngameInfoPanel.Chat].Panel);
|
||||||
|
|
||||||
for (var i = 0; i < numTabs; i++)
|
for (var i = 0; i < numTabs; i++)
|
||||||
{
|
{
|
||||||
var type = visiblePanels[i];
|
var type = visiblePanels[i];
|
||||||
@@ -90,7 +92,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (tabButton != null)
|
if (tabButton != null)
|
||||||
{
|
{
|
||||||
tabButton.Text = info.Label;
|
tabButton.Text = info.Label;
|
||||||
tabButton.OnClick = () => activePanel = type;
|
tabButton.OnClick = () =>
|
||||||
|
{
|
||||||
|
if (activePanel == IngameInfoPanel.Chat)
|
||||||
|
LeaveChatPanel(chatPanel);
|
||||||
|
|
||||||
|
activePanel = type;
|
||||||
|
};
|
||||||
tabButton.IsHighlighted = () => activePanel == type;
|
tabButton.IsHighlighted = () => activePanel == type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,5 +168,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
Game.LoadWidget(world, "CHAT_CONTAINER", chatPanelContainer, new WidgetArgs() { { "isMenuChat", true } });
|
Game.LoadWidget(world, "CHAT_CONTAINER", chatPanelContainer, new WidgetArgs() { { "isMenuChat", true } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void LeaveChatPanel(Widget chatPanelContainer)
|
||||||
|
{
|
||||||
|
chatPanelContainer.Get<TextFieldWidget>("CHAT_TEXTFIELD").YieldKeyboardFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user