- Welcome, Guest. Please Login or Register
MindFusion  
  We have released initial version of MindFusion.Scheduling library for HTML5 & JavaScript.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Suppress Windows On-screen Keyboard
Read 28 times

Art Bragg   Offline
YaBB Newbies
*
Posts: 1
I Love MindFusion!


   
     
 
Suppress Windows On-screen Keyboard
Mar 10th, 2019 at 9:21pm
 
Hi - I've implemented an on-screen keyboard using the MindFusion keyboard for my WinForms application and it's a great success - I was able to do everything I wanted to do with it.  My question is - is there any way to suppress the Windows On-Screen keyboard while my app is running?  The app will be running on a small Windows tablet that does not have a hardware keyboard.

Thanks!
 
 
 
IP Logged    
 
     

Slavcho   Offline
YaBB Moderator
*****
Posts: 1597
Gender: male
tech.support


   
     
 
Re: Suppress Windows On-screen Keyboard
Reply #1 - Mar 11th, 2019 at 1:03pm
 
Sadly there does not seem to exist any API to disable the OSK for specific application or controls. Google shows some suggestions like killing the OSK process or disabling registry settings but that does not sound proper thing to do. I was able to prevent it from appearing with some event handling and toggling the controls' ReadOnly property like this -

Code:
void SetReadOnly(TextBox tb, bool value)
{
    tb.ReadOnly = value;
    tb.BackColor = Color.Black;
    tb.ForeColor = Color.Black;
    tb.BackColor = Color.White;
}

private void Form1_Load(object sender, EventArgs e)
{
    var vk = new MindFusion.UI.WinForms.VirtualKeyboard();
    vk.Dock = DockStyle.Bottom;
    Controls.Add(vk);
    vk.IsStandAlone = false;
    vk.PreventActivation = true;
    //textBox1.AccessibleRole = AccessibleRole.StaticText;
    //textBox2.AccessibleRole = AccessibleRole.StaticText;

    vk.KeyPressed += Vk_KeyPressed;

    SetReadOnly(textBox1, true);
    SetReadOnly(textBox2, true);

    textBox1.KeyPress += OnTextBoxKeyPress;
    textBox2.KeyPress += OnTextBoxKeyPress;
}


private void OnTextBoxKeyPress(object sender, KeyPressEventArgs e)
{
    var timer = new Timer();
    timer.Interval = 3;
    timer.Tick += (s, a) =>
    {
        SetReadOnly(textBox1, true);
        SetReadOnly(textBox2, true);
        timer.Stop();
    };
    timer.Start();
}

private void Vk_KeyPressed(object sender, MindFusion.UI.WinForms.VirtualKeyEventArgs e)
{
    SetReadOnly(textBox1, false);
    SetReadOnly(textBox2, false);
}
 



I have tested this only on desktop machine with touch screen and win10 tablet mode enabled. You should be able to extend it to support more edit boxes by following currently focused control rather than setting ReadOnly on specific boxes.

Regards,
Slavcho
Mindfusion
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print