Displaying the numeric keypad in Windows 10 [duplicate] - windows

We're working on a desktop WPF app that runs on Windows 7 tablets and are adding some Surface Pro units with windows 8 to the mix.
We noticed immediately that the little keyboard icon no longer displays when a TextBox receives focus. We solved it by running "tabtip.exe" on the MouseDown event for all TextBoxes.
We have some numeric textboxes though (quantity for an item on an order), and want to open the on-screen keyboard for numeric entry, but it opens with qwerty keys by default.
I have been searching extensively for any command-line arguments I can pass to tabtip.exe to change its input mode, but have had no luck. This seems like a trivial task with a metro-style app, but impossible on the desktop side.
Is there a command-line argument to tabtip.exe I can use to accomplish this?

Following on from the answer #tymes provided, here is a quick console app which demonstrates opening the keyboard and changing various settings (C#).:
using System;
using System.Diagnostics;
using Microsoft.Win32;
namespace CSharpTesting
{
class Program
{
/// <summary>
/// The different layout types on the virtual keyboard.
/// </summary>
public enum KeyboardLayoutMode
{
Default,
ThumbLayout,
Handwriting
}
/// <summary>
/// The registry key which holds the keyboard settings.
/// </summary>
private static readonly RegistryKey registryKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\TabletTip\\1.7");
static void Main(string[] args)
{
SetKeyboardDockedMode(true);
SetKeyboardLayoutMode(KeyboardLayoutMode.ThumbLayout);
ShowKeyboard(true);
}
/// <summary>
/// Shows the onscreen keyboard.
/// </summary>
/// <param name="killExistingProcess">If true, kill any existing TabTip.exe process.</param>
public static void ShowKeyboard(bool killExistingProcess)
{
if (killExistingProcess)
{
// If the user presses the close button on the keyboard then TabTip.exe will still run in the background. If we have made registry
// changes to the keyboard settings, they don't take effect until the process is started again so killing this ensures the keyboard
// will open with our new settings.
foreach (var process in Process.GetProcessesByName("TabTip"))
{
process.Kill();
}
}
string onScreenKeyboardPath = #"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe";
Process.Start(onScreenKeyboardPath);
}
/// <summary>
/// Sets if the keyboard is in docked or floating mode.
/// </summary>
/// <param name="isDocked">If true set to docked, if false set to floating.</param>
private static void SetKeyboardDockedMode(bool isDocked)
{
registryKey.SetValue("EdgeTargetDockedState", Convert.ToInt32(isDocked), RegistryValueKind.DWord);
}
/// <summary>
/// Changes the layout mode of the keyboard.
/// </summary>
/// <param name="mode">The layout mode to use.</param>
private static void SetKeyboardLayoutMode(KeyboardLayoutMode mode)
{
switch (mode)
{
case KeyboardLayoutMode.Handwriting:
registryKey.SetValue("KeyboardLayoutPreference", 0, RegistryValueKind.DWord);
registryKey.SetValue("LastUsedModalityWasHandwriting", 1, RegistryValueKind.DWord);
break;
case KeyboardLayoutMode.ThumbLayout:
registryKey.SetValue("KeyboardLayoutPreference", 1, RegistryValueKind.DWord);
registryKey.SetValue("LastUsedModalityWasHandwriting", 0, RegistryValueKind.DWord);
// 0 = small, 1 = medium, 2 = large
registryKey.SetValue("ThumbKeyboardSizePreference", 2, RegistryValueKind.DWord);
break;
default:
registryKey.SetValue("KeyboardLayoutPreference", 0, RegistryValueKind.DWord);
registryKey.SetValue("LastUsedModalityWasHandwriting", 0, RegistryValueKind.DWord);
break;
}
}
}
}

in HKEY_CURRENT_USER\Software\Microsoft\TabletTip\1.7 (Windows 8)
change the REG_DWORD KeyboardLayoutPreference
value of 0 is the regular layout
value of 1 is the split keyboard with the numberpad in the middle
the REG_DWORD LastUsedModalityWasHandwriting also has to be 0 or if 1, when tabtip is started again it will open with the pen handwriting area.

You may control input mode by registry setting for Tabtip. Look for the registry entry with name KeyboardLayoutPreference.

I've never used win 8 but in win 10 you can use InputScope to control what on-screen keyboard is used:
<TextBox Grid.Row="0"
InputScope="Number" />
<TextBox Grid.Row="1"
InputScope="Default" />

Related

Youtube Fullscreen without Iframe

Related to: YouTube iframe embed - full screen
Is it possible to pass the allowFullscreen without iframe? I'm developing for Xamarin and I'm using a WebView that simply opens the embed url itself, I don't see the need for iframe here, but I'd like to have the fullscreen possibility...
To enable full-screen support in a Xamarin Forms WebView for Android, you can create custom fullScreen_webview to do.
public class FullScreenEnabledWebView : WebView
{
/// <summary>
/// Bindable property for <see cref="EnterFullScreenCommand"/>.
/// </summary>
public static readonly BindableProperty EnterFullScreenCommandProperty =
BindableProperty.Create(
nameof(EnterFullScreenCommand),
typeof(ICommand),
typeof(FullScreenEnabledWebView),
defaultValue: new Command(async (view) => await DefaultEnterAsync((View)view)));
/// <summary>
/// Bindable property for <see cref="ExitFullScreenCommand"/>.
/// </summary>
public static readonly BindableProperty ExitFullScreenCommandProperty =
BindableProperty.Create(
nameof(ExitFullScreenCommand),
typeof(ICommand),
typeof(FullScreenEnabledWebView),
defaultValue: new Command(async (view) => await DefaultExitAsync()));
/// <summary>
/// Gets or sets the command executed when the web view content requests entering full-screen.
/// The command is passed a <see cref="View"/> containing the content to display.
/// The default command displays the content as a modal page.
/// </summary>
public ICommand EnterFullScreenCommand
{
get => (ICommand)GetValue(EnterFullScreenCommandProperty);
set => SetValue(EnterFullScreenCommandProperty, value);
}
/// <summary>
/// Gets or sets the command executed when the web view content requests exiting full-screen.
/// The command is passed no parameters.
/// The default command pops a modal page off the navigation stack.
/// </summary>
public ICommand ExitFullScreenCommand
{
get => (ICommand)GetValue(ExitFullScreenCommandProperty);
set => SetValue(ExitFullScreenCommandProperty, value);
}
private static async Task DefaultEnterAsync(View view)
{
var page = new ContentPage
{
Content = view
};
await Application.Current.MainPage.Navigation.PushModalAsync(page);
}
private static async Task DefaultExitAsync()
{
await Application.Current.MainPage.Navigation.PopModalAsync();
}
}
More detailed info about enable full-screen support in xamarin.android Webview, you can take a look this sample:
https://github.com/microsoft/CSSClientAppsXamarinSampleCode/tree/main/FullScreenWebView
You can click Iframe in the red box at the bottom right to full-screen, the screenshot:

Xamarin forms android tablet masterdetailpage issue

I've just started to test my app on android tablet and have found a strange bug:
I wanted to being masterpage enabled only when my main page is opened.
So I created Custom NavigationPage and overrided methods:
/// <summary>
/// Отключение бокового меню при добавлении на главный экран новых страниц
/// </summary>
/// <param name="child"></param>
protected override void OnChildAdded(Element child)
{
base.OnChildAdded(child);
if (this.Navigation.NavigationStack.Count > 1)
App.detailPage.IsGestureEnabled = false;
}
/// <summary>
/// Включение бокового меню при наличии только одной страницы на главном экране
/// </summary>
/// <param name="child"></param>
protected override void OnChildRemoved(Element child)
{
base.OnChildRemoved(child);
if (this.Navigation.NavigationStack.Count < 2)
App.detailPage.IsGestureEnabled = true;
}
here is my landscape main page:
When I push some pages to my NavigationPage, the master page disappears:
and after that, when I return on my main page, the masterpage is still not available:
At least I need to show my MasterPage on my MainPage, and it would be perfect if somebody tell me, how to hide masterpage to the left and use it with swipe gestures, like on phones. Thanks in advance.
By the way, I've found the answer for my issue :)
Right now, I end up with adding behavior for Tablet idiom in my MasterPage.
Constructor's code:
public MasterDetailPage1()
{
InitializeComponent();
/// Some coding
if (Device.Idiom == TargetIdiom.Tablet)
MasterBehavior = MasterBehavior.Popover;
/// Some coding
}
Hope that helps somebody.

Telerik UI For WinForms RadMessageBox font size

Is there a way to increase the default font size of the RadMessageBox for the whole application without having to create a custom theme?
If not, how to just increase the font on the default theme in Visual Style Builder? I tried just increasing the label and button font sizes, but the style builder reset the whole form that hosts the message box to look very plain and cutting the text of the label (see attached screenshot).
Thank you.
It is possible to customize the font for all RadMessageBoxes within an application.
Implement a method ('SetTelerikControlStyles') which is called before any form and/or RadMessageBox is created. You only need to call this method once!
Add the following lines of code in the created method of step 1:
RadMessageBox.Instance.FormElement.TitleBar.Font = new Font("Calibri", 25f);
RadMessageBox.Instance.Controls["radLabel1"].Font = new Font("Calibri", 50f, FontStyle.Regular);
The FormElement.TitleBar.Font, as the name already reveals, is the title bar of the RadMessageBox.
Telerik is using dynamic named controls, so in this case radLabel1 represents the RadMessageBox text area.
Complete Program.cs sample:
using System;
using System.Drawing;
using System.Windows.Forms;
using Telerik.WinControls;
namespace WindowsFormsApplication
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
SetTelerikControlStyles();
Application.Run(new Form1());
}
private static void SetTelerikControlStyles()
{
RadMessageBox.Instance.FormElement.TitleBar.Font = new Font("Calibri", 25f);
// I added this additional check for safety, if Telerik modifies the name of the control.
if (RadMessageBox.Instance.Controls.ContainsKey("radLabel1"))
{
RadMessageBox.Instance.Controls["radLabel1"].Font = new Font("Calibri", 50f, FontStyle.Regular);
}
}
}
}

How to Hide the overflow icon in Hardware menu button in Xamarin Android

I need to Hide the overflow icon in Hardware menu button in my Xamarin Android app(three dots) - refer the screen shot.
How do i do this?
I did not find the overflow icon in my nexus 6, but I would like give you some suggestions:
For the xamarin android project the Android.App.Activity is different between the Activity of Java android.
We can find the source code of the Android.App.Activity when the activity create a menu it will call the following function:
// Summary:
// Initialize the contents of the Activity's standard options menu.
//
// Parameters:
// menu:
// The options menu in which you place your items.
//
// Returns:
// To be added.
//
// Remarks:
// ///
// Initialize the contents of the Activity's standard options menu. You /// should
// place your menu items in to menu. /// ///
// ///
// This is only called once, the first time the options menu is /// displayed. To
// update the menu every time it is displayed, see /// Android.App.Activity.OnPrepareOptionsMenu(Android.Views.IMenu).
// /// ///
// ///
// The default implementation populates the menu with standard system /// menu items.
// These are placed in the Android.Views.Menu.CATEGORY_SYSTEM group so that ///
// they will be correctly ordered with application-defined menu items. /// Deriving
// classes should always call through to the base implementation. /// ///
// ///
// You can safely hold on to menu (and any items created /// from it), making modifications
// to it as desired, until the next /// time onCreateOptionsMenu() is called. ///
// ///
// ///
// When you add items to the menu, you can implement the Activity's /// Android.App.Activity.OnOptionsItemSelected(Android.Views.IMenuItem)
// method to handle them there.
// ///
// /// /// [Android Documentation] /// ///
// ///
[Register("onCreateOptionsMenu", "(Landroid/view/Menu;)Z", "GetOnCreateOptionsMenu_Landroid_view_Menu_Handler")]
public virtual bool OnCreateOptionsMenu(IMenu menu);
This onCreateOptionsMenu function will be called as default. Xamarin android encapsulates onCreateOptionsMenu function of Java Android. I think you can override the function in you MainActivity as follows:
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
}
public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
{
return false;
}
}
The menu should be created as default.
That depends on a Particular Device and Its OS , some of them create options menu like your device but some on right corner of the top

Icon Handler shows black icons

I am using Sharpshell to change my pdf and xlsx icons. Most of the times it works fine, but sometimes it shows black icons. Refreshing or restarting explorer has no effect on it.
Moreover, it works fine in certain Icon Views - for example in Details, Content it works fine, but not in Medium Icons or Tiles. Also, the icons work fine in the Server Manager tool.
There is one more thing - if I change the name of the file that has got the black icon, the correct icon immediately appears.
This is the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using SharpShell.SharpIconHandler;
using SharpShell.Attributes;
using SharpShell.Configuration;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using SharpShell.Diagnostics;
using SharpShell.Interop;
namespace IconHandlerTry2
{
[ComVisible(true)]
[COMServerAssociation(AssociationType.ClassOfExtension, ".pdf", ".xlsx")]
public class Class1 : SharpIconHandler
{
/// <summary>
/// Gets the icon.
/// </summary>
/// <param name="smallIcon">if set to <c>true</c> provide a small icon.</param>
/// <param name="iconSize">Size of the icon.</param>
/// <returns>
/// The icon for the file.
/// </returns>
protected override Icon GetIcon(bool smallIcon, uint iconSize)
{
string prefix = "C:\\Windows\\IconsForYou\\";
string filename = SelectedItemPath;
string iconFileName;
string[] splits = filename.Split('.');
string extension = splits[splits.Length - 1];
if (extension == "pdf")
iconFileName = prefix + "pdfDefault.ico";
else if (extension == "xlsx")
iconFileName = prefix + "xlsxDefault.ico";
else
iconFileName = prefix + "default.ico";
Icon icon = new Icon(iconFileName);
// Return the icon with the correct size. Use the SharpIconHandler 'GetIconSpecificSize'
// function to extract the icon of the required size.
return GetIconSpecificSize(icon, new Size((int)iconSize, (int)iconSize));
}
}
}
This is the simpler version. I will be working on hundreds of icons. Does anybody have any suggestion?
EDIT: I now see that the icons are assigned randomly. Whenever I clear the icon cache, some random icons are displayed. Sometimes there is nothing, so it becomes either full black or white. Same thing is happening in the Server Manager Tool. Please help!

Resources