473,320 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

on screen keyboard

Hi, i'm kinda new to vb.net and i'm trying to make an on screen
keyboard to use with a touch screen. how do i get it to print a
letter on the screen when the button is pressed in the textbox that is
selected? do i do it as a ascii character?

i'm trying to get data from a user. there are a couple of different
field the user will have to type information into. (i.e. first name,
last name, .etc)

Mar 29 '07 #1
4 7750
On Mar 29, 11:41 am, jonathandr...@gmail.com wrote:
Hi, i'm kinda new to vb.net and i'm trying to make an on screen
keyboard to use with a touch screen. how do i get it to print a
letter on the screen when the button is pressed in the textbox that is
selected? do i do it as a ascii character?

i'm trying to get data from a user. there are a couple of different
field the user will have to type information into. (i.e. first name,
last name, .etc)
Are you trying to write a global on screen keyboard or just one to use
in your application only?

Thanks,

Seth Rowe

Mar 29 '07 #2
Hello Jonathan,

the easiest thing would be to raise an event which contains a variable
with the keycode or the string. However, when developing such a keyboard
(I once wrote one as an OCX, which can be downloaded from
www.henke-hk.com), please keep in mind that there are different layouts
(e.g. on German keyboards you have to press AltGr (Ctrl+Alt)+Q to get
the "@" sign). Considering that .NET supports Unicode, you might need to
consider Chinese/Japanese keyboards and their input methods as well.

Best regards,

Martin

jo***********@gmail.com wrote:
Hi, i'm kinda new to vb.net and i'm trying to make an on screen
keyboard to use with a touch screen. how do i get it to print a
letter on the screen when the button is pressed in the textbox that is
selected? do i do it as a ascii character?

i'm trying to get data from a user. there are a couple of different
field the user will have to type information into. (i.e. first name,
last name, .etc)
Mar 29 '07 #3
On Mar 29, 12:03 pm, "rowe_newsgroups" <rowe_em...@yahoo.comwrote:
On Mar 29, 11:41 am, jonathandr...@gmail.com wrote:
Hi, i'm kinda new to vb.net and i'm trying to make an on screen
keyboard to use with a touch screen. how do i get it to print a
letter on the screen when the button is pressed in the textbox that is
selected? do i do it as a ascii character?
i'm trying to get data from a user. there are a couple of different
field the user will have to type information into. (i.e. first name,
last name, .etc)

Are you trying to write a global on screen keyboard or just one to use
in your application only?

Thanks,

Seth Rowe
it's with my application

Mar 30 '07 #4
On Mar 30, 7:24 pm, jonathandr...@gmail.com wrote:
On Mar 29, 12:03 pm, "rowe_newsgroups" <rowe_em...@yahoo.comwrote:
On Mar 29, 11:41 am, jonathandr...@gmail.com wrote:
Hi, i'm kinda new to vb.net and i'm trying to make an on screen
keyboard to use with a touch screen. how do i get it to print a
letter on the screen when the button is pressed in the textbox that is
selected? do i do it as a ascii character?
i'm trying to get data from a user. there are a couple of different
field the user will have to type information into. (i.e. first name,
last name, .etc)
Are you trying to write a global on screen keyboard or just one to use
in your application only?
Thanks,
Seth Rowe

it's with my application
Then the absolute easiest way would be to create a usercontrol that
will act as the keyboard. Then you just have worry about passing the
pressed key back to the "target" control.

Here's a quick sample I just wrote:

First comes the user control. For it you need to add some labels, one
for each key of the keyboard. I set the label's Textalign to
MiddleCenter and the BorderStyle to single to give it more of a key-
like look, though if this was a profession app, I would do some GDI+
work to make the label look more like a button. The reason you need to
use a label and not a button is that labels don't receive focus when
clicked.

Next, add the following code the user control. Note I changed the
inherits to Panel to prevent the usercontrol from getting focus, so
you'll have to change the inherits in the usercontrol.Designer.vb file
too.

Public Class Keyboard
Inherits Panel

' Wire up all the Label's click events to this event handler
Private Sub Label_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
OnKeyPressed(New KeyPressedEventArgs(DirectCast(sender,
Label).Text))
End Sub

Public Event KeyPressed As KeyPressedEventHandler

Protected Overridable Sub OnKeyPressed(ByVal e As
KeyPressedEventArgs)
RaiseEvent KeyPressed(Me, e)
End Sub

End Class

Public Delegate Sub KeyPressedEventHandler(ByVal sender As Object,
ByVal e As KeyPressedEventArgs)

Public Class KeyPressedEventArgs
Inherits EventArgs

Public Sub New(ByVal keyPressed As String)
Me.KeyPressed = keyPressed
End Sub

Private _KeyPressed As String
Public Property KeyPressed() As String
Get
Return _KeyPressed
End Get
Private Set(ByVal value As String)
_KeyPressed = value
End Set
End Property

End Class

That should be it for the usercontrol, now we just have to worry about
the "host" form. All you have to do is add the new keyboard
usercontrol to a form and then handle the usercontrol's new KeyPressed
event. Use something like the following:

Private Sub Keyboard1_KeyPressed(ByVal sender As System.Object,
ByVal e As KeyPressedEventArgs)
' You'll have to change this cast if you want to send text
' to a control type other than a TextBox
Dim tb As TextBox = TryCast(Me.ActiveControl, TextBox)
If Not tb Is Nothing Then
tb.Text &= e.KeyPressed
tb.SelectionStart = tb.Text.Length
End If
End Sub

Since neither the usercontrol or it's labels can get the focus, the
event handler will try to cast the active control (the control that
had focus before the user clicked the keyboard usercontrol) into a
textbox and then append the text from the KeyPressed event.

I'm guessing there is a more elegant solution to this, but at this
late at night I can't think of one :-) Anyways, I hope it helps you
out!

Thanks,

Seth Rowe

Mar 31 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: gregory_may | last post by:
Is there a way to grab a "Screen Shot" that includes "Tool Tips"? I saw this code someplace, cant remember where. But it doesnt grab "Tool Tips". Is there a better way to do this in .net?...
0
by: Hiroyuki Tanaka | last post by:
Hi, I am trying to develop an application for a touch screen using buttons for the numeric pad with Completion ComboBoxes. At the moment I am having a problem sending the button presses to my...
0
by: Hiroyuki Tanaka | last post by:
Hi All, I am trying to develop an application for a touch screen using buttons for the numeric pad with Completion ComboBoxes. At the moment I am having a problem sending the button presses to...
2
by: Simon Verona | last post by:
I know that Windows has a "clickable" keyboard that can pop up when necessary.. I have a touch-screen based application. Is there anyway that I can utilise this keyboard application in windows...
4
by: =?Utf-8?B?SmltIE9ybXNiZWU=?= | last post by:
Hopefully my solution will help others. I have a MacBook Pro on which I am running WindowsXP Home Edition. It is running totally separate from the Mac OS. I have to reboot to switch between OS's....
4
by: Dennieku | last post by:
Hi, I have to develop an on-screen keyboard and on-screen numeric keypad for a touchscreen UI. The hardest thing with this is that it has to be multi-lingual. Has anybody have ideas how to...
0
by: =?Utf-8?B?S2VpdGggVw==?= | last post by:
My sons computer is password protected and his Logitech wireless keyboard does not work @ the windows logon screen. The mouse works but that is it. I plugged in a ps2 keyboard and it works when i'm...
3
by: Scotter | last post by:
Hi everyone, I was wondering if anyone knows a way that i can get the on screen keyboard in windows xp pro to show up on login. I have a touch screen monitor, and I still want the usual login...
5
by: bdy120602 | last post by:
Is it possible, when a user or viewer of your Web page, prints or takes a screen shot of a Web page with mousover (roll-over) text in it, to have that text printed or captures as part of the screen...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.