Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Osklib/ComOnScreenKeyboardController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public override void Show()
{
StartTabTip();
// on some devices starting TabTip don't show keyboard, on some does ¯\_(ツ)_/¯
Thread.Sleep(1000);
if (!IsOpened())
{
ToggleByCom();
Expand Down
7 changes: 4 additions & 3 deletions Osklib/NewWindows10OnScreenKeyboardController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private static void StartTabTip()
}
}

private static void ShowByCom()
private static void ToggleByCom()
{
try
{
Expand All @@ -105,16 +105,17 @@ public override void Show()
{
if (!IsOpened())
{
ShowByCom();
ToggleByCom();
}
}
else
{
StartTabTip();
// on some devices starting TabTip don't show keyboard, on some does ¯\_(ツ)_/¯
Thread.Sleep(1000);
if (!IsOpened())
{
ShowByCom();
ToggleByCom();
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions Osklib/Windows10OnScreenKeyboardController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,12 @@ private static void StartTabTip()
}
}

private static void ShowByCom()
private static void ToggleByCom()
{
ITipInvocation instance = null;
try
{
instance = (ITipInvocation)Activator.CreateInstance(ComTypes.TipInvocationType);
var window = NativeMethods.GetDesktopWindow();
instance.Toggle(NativeMethods.GetDesktopWindow());
}
finally
Expand All @@ -75,16 +74,17 @@ public override void Show()
//Console.WriteLine( "Style {0:X8}", style );
if (!NativeMethods.IsWin10OnScreenKeyboardVisible())
{
ShowByCom();
ToggleByCom();
}
}
else
{
StartTabTip();
// on some devices starting TabTip don't show keyboard, on some does ¯\_(ツ)_/¯
Thread.Sleep(1000);
if (!IsOpened())
{
ShowByCom();
ToggleByCom();
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions WpfSample/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<CheckBox Margin="0,5,0,5" x:Name="richBoxToggle" Content="RichTextBox" Checked="ToggleButton_Checked" Unchecked="ToggleButton_Checked"/>
<CheckBox Margin="0,5,0,5" x:Name="passwordBoxToggle" Content="PasswordBox" Checked="ToggleButton_Checked" Unchecked="ToggleButton_Checked"/>
<TextBlock Text="Warning: DatePickerTextBox has TextBox as parent!" TextWrapping="Wrap"/>
<Button Content="Show Keyboard" Click="Show"></Button>
<Button Content="Hide Keyboard" Click="Hide"></Button>
</StackPanel>
</GroupBox>
<GroupBox Grid.Column="1" Header="Text boxes">
Expand Down
10 changes: 10 additions & 0 deletions WpfSample/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,15 @@ private void MenuItem_Click(object sender, RoutedEventArgs e)
wnd.Owner = this;
wnd.Show();
}

private void Show(object sender, RoutedEventArgs e)
{
OnScreenKeyboard.Show();
}

private void Hide(object sender, RoutedEventArgs e)
{
OnScreenKeyboard.Close();
}
}
}