Creating keyboards in C#?

by Michael S. Kaplan, published on 2007/03/16 07:59 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/03/16/1894023.aspx


In theory, you can create just about any program using any programming language. And in my time I have seen a lot of tasks that many considered to be impossible happen. But that fact alone does not make it always a good reason to try to do such a thing.

Just the other day, Sumon asked me:

hi!

i want to make a program using c#.net which will convert my keyboard into my mother language keyboard.

such as if i press "J" letter then it will show one of the letter of my mother language (bangla) in text file.

thanks
sumon

Certainly one could create such a program, inject it into any or indeed every UI thread, and use it to try to create a keyboard layout.

But such a solution would be very unstable, very resource intensive, and is really using the wrong tool to get the job done....

The first answer I would always give here is Microsoft Keyboard Layout Creator. :-)

For keyboards which need to go a bit beyond what MSKLC can do (since as I pointed out previously not even MSKLC 1.4 can do everything!), Keyman Developer from Tavultesoft is what next comes to mind for me.

But developing keyboards in C# is definitely an effective use of neither the C# language nor the .NET runtime. It just isn't the kind of approach I would ever recommend....

 

This post brought to you by(U+099c, a.k.a. BENGALI LETTER JA)


Jeffrey L. Whitledge on 16 Mar 2007 2:48 PM:

But C# is such a joy to use that I want to write my checks, shopping lists, monthly reports, and Christmas cards in it.

Michael S. Kaplan on 16 Mar 2007 5:53 PM:

That has to be one of the scariest things I have read today, Jeffrey!

Srinivas K on 25 May 2008 9:06 AM:

hi

But the point is- I want to implement a keyboard only for one language. Lot less features than Tavultesoft .

 - Budget doest let me buy Tavultesoft.

 - Need a map for my keyboard

 - MSKLC is not enough..

 - I think I'm a programmer.

That leads one to google for ideas as to how to implement keymapping.

So what do you suggest is the solution. Use something like C for the job?

-Sv

Michael S. Kaplan on 25 May 2008 9:51 AM:

The keyboarding architecture of Windows is (for the most part) not subject to "programming".

Why not start with the requirements. What makes MSKLC not enough yet Keyman too much?

On the whole, its is impossible to suggest a solution when the problem has not been defined.

Srinivas K on 25 May 2008 12:38 PM:

Actually, Keyman served my purpose except that I cant afford it. I tried out their trial version and was more than happy with their "language". (IDL, sort of, to create the mapping). This is the feature that I couldn't find in MSKLC. If I'm wrong, then please point me to it.

The limitation of MSKLC(I'm using WinXP, MSKLC 1.4):

1. I cant define a key with, say, six unicode characters. Keyman lets me do it. e.g, assign "\u0c15\u0c4d\u0c37\u0c4d\u0c2e\u0c40" to one key.

2. MSKLC doesnt let you do context sensitive stuff(change the character depending on the previous characters typed.)  It is needed to produce the above sort of characters.

The keyboard will have \u0c15 as one key and \u0c37 as another key. When pressed first key + link key + second key produces \u0c15\u0c4d\u0c37 ). In keyman I write some statements to achieve this effect using 'store', any(), Index() and other mappings.

I need a keyboard for the TELUGU language (South Indian).  "Can I achieve what keyman does without all the functionality of providing the interface language etc.?" is what motivated me to look at programming solution.

I'm all ears (or eyes, if you will) for your inputs.

-Sv

Michael S. Kaplan on 25 May 2008 2:50 PM:

MSKLC does not do it because the Windows input architecture does not -- Keyman works around this by providing several diferent methods, including TSF-based ones.

Have you looked into the series I wrote about the Table Driven Text Service? It provides exactly what you are looking for.

Srinivas K on 26 May 2008 9:57 AM:

The series you pointed to is directed at Vista. I'm still in XP and I'll need it to be XP and below(yes...98 to be exact) for a while.  

I still did not quite comprehend the series. I'll give it another read. But tell me, those suggestion boxes popup for all keystrokes.?

In my case, I'll be giving the keyboard to typists who will be converting large volumes of manuscripts to unicode documents. They won't be able to keep choosing the options!! Second they are used to certain keyboard which is proprietory and  non-unicode. So I have to build my own keyboard that uses unicode and matches the keystrokes.

I have done a transliteration mapping in JS, modifying the wikipedia transliteration script. Not satisfactory(as a temp solution) and that is not the way to go about it.

So any XP specific ideas!!

Thanks

Michael S. Kaplan on 26 May 2008 3:38 PM:

For XP, there is no solution here built into Windows other than the full Text Services Framework (TSF). I have never seen anybody create a full TSF Text Input Profile (TIP) in C# and to be honest I doubt this is actually possible....


go to newer or older post, or back to index or month or day