aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--support/hololens/ServoApp/BrowserPage.cpp12
-rw-r--r--support/hololens/ServoApp/BrowserPage.h4
-rw-r--r--support/hololens/ServoApp/BrowserPage.xaml18
3 files changed, 33 insertions, 1 deletions
diff --git a/support/hololens/ServoApp/BrowserPage.cpp b/support/hololens/ServoApp/BrowserPage.cpp
index a9de7e2942d..98521ccd7da 100644
--- a/support/hololens/ServoApp/BrowserPage.cpp
+++ b/support/hololens/ServoApp/BrowserPage.cpp
@@ -7,6 +7,7 @@
#include "BrowserPage.h"
#include "BrowserPage.g.cpp"
+using namespace std::placeholders;
using namespace winrt::Windows::Foundation;
using namespace winrt::Windows::UI::Xaml;
using namespace winrt::Windows::UI::Core;
@@ -50,6 +51,17 @@ void BrowserPage::BindServoEvents() {
});
servoControl().OnCaptureGesturesEnded(
[=] { navigationBar().IsHitTestVisible(true); });
+ urlTextbox().GotFocus(std::bind(&BrowserPage::OnURLFocused, this, _1));
+}
+
+void BrowserPage::OnURLFocused(Windows::Foundation::IInspectable const &) {
+ urlTextbox().SelectAll();
+}
+
+void BrowserPage::OnURLKeyboardAccelerator(
+ Windows::Foundation::IInspectable const &,
+ Windows::UI::Xaml::Input::KeyboardAcceleratorInvokedEventArgs const &) {
+ urlTextbox().Focus(FocusState::Programmatic);
}
void BrowserPage::LoadServoURI(Uri uri) {
diff --git a/support/hololens/ServoApp/BrowserPage.h b/support/hololens/ServoApp/BrowserPage.h
index 8c3a540d4c1..6c1af3f9059 100644
--- a/support/hololens/ServoApp/BrowserPage.h
+++ b/support/hololens/ServoApp/BrowserPage.h
@@ -26,6 +26,10 @@ public:
Windows::UI::Xaml::RoutedEventArgs const &);
void OnURLEdited(Windows::Foundation::IInspectable const &,
Windows::UI::Xaml::Input::KeyRoutedEventArgs const &);
+ void OnURLFocused(Windows::Foundation::IInspectable const &);
+ void OnURLKeyboardAccelerator(
+ Windows::Foundation::IInspectable const &,
+ Windows::UI::Xaml::Input::KeyboardAcceleratorInvokedEventArgs const &);
void Shutdown();
void LoadServoURI(Windows::Foundation::Uri uri);
void SetTransientMode(bool);
diff --git a/support/hololens/ServoApp/BrowserPage.xaml b/support/hololens/ServoApp/BrowserPage.xaml
index 87aa72321a6..3cd8aabff55 100644
--- a/support/hololens/ServoApp/BrowserPage.xaml
+++ b/support/hololens/ServoApp/BrowserPage.xaml
@@ -94,18 +94,34 @@
<StackPanel Orientation="Horizontal" Grid.Column="0">
<Button Style="{StaticResource NavigationBarButton}" x:Name="backButton" IsTabStop="true" IsEnabled="false" Click="OnBackButtonClicked" AutomationProperties.Name="Back">
<Image Source="Assets/UI/back.png" Height="12"></Image>
+ <Button.KeyboardAccelerators>
+ <KeyboardAccelerator Key="Left" Modifiers="Menu" />
+ </Button.KeyboardAccelerators>
</Button>
<Button Style="{StaticResource NavigationBarButton}" x:Name="forwardButton" IsTabStop="true" IsEnabled="false" Click="OnForwardButtonClicked" AutomationProperties.Name="Forward">
<Image Source="Assets/UI/forward.png" Height="12"></Image>
+ <Button.KeyboardAccelerators>
+ <KeyboardAccelerator Key="Right" Modifiers="Menu" />
+ </Button.KeyboardAccelerators>
</Button>
<Button Style="{StaticResource NavigationBarButton}" x:Name="reloadButton" IsTabStop="true" IsEnabled="false" Visibility="Visible" Click="OnReloadButtonClicked" AutomationProperties.Name="Reload">
<Image Source="Assets/UI/reload.png" Height="12"></Image>
+ <Button.KeyboardAccelerators>
+ <KeyboardAccelerator Key="R" Modifiers="Control" />
+ </Button.KeyboardAccelerators>
</Button>
<Button Style="{StaticResource NavigationBarButton}" x:Name="stopButton" IsTabStop="true" IsEnabled="false" Visibility="Collapsed" Click="OnStopButtonClicked" AutomationProperties.Name="Stop">
<Image Source="Assets/UI/stop.png" Height="12"></Image>
+ <Button.KeyboardAccelerators>
+ <KeyboardAccelerator Key="Escape" Modifiers="None" />
+ </Button.KeyboardAccelerators>
</Button>
</StackPanel>
- <TextBox Text="" IsTabStop="true" InputScope="Url" PlaceholderText="Type a URL" x:Name="urlTextbox" Grid.Column="1" KeyUp="OnURLEdited" IsSpellCheckEnabled="False" Margin="3,0"/>
+ <TextBox Text="" IsTabStop="true" InputScope="Url" PlaceholderText="Type a URL" x:Name="urlTextbox" Grid.Column="1" KeyUp="OnURLEdited" IsSpellCheckEnabled="False" Margin="3,0">
+ <TextBox.KeyboardAccelerators>
+ <KeyboardAccelerator Key="L" Modifiers="Control" Invoked="OnURLKeyboardAccelerator"/>
+ </TextBox.KeyboardAccelerators>
+ </TextBox>
<ProgressRing x:Name="urlbarLoadingIndicator" Grid.Column="2" Margin="10,0"/>
</Grid>
<local:ServoControl TabIndex="0" x:Name="servoControl" Grid.Row="1"/>