Solved

500 POINTS - Using same form for multiple textbox input

Posted on 2010-08-18
7
346 Views
Last Modified: 2012-05-10
Hi,
   I have an on screen keyboard which I use for my touchscreen application.  On my form I have 8 testboxes called text1 to text8, I have a button which I press to launch an on screen keyboard.  What I want to do is use this same form to allow the user to enter characters in the various textboxes depending on which one is focused.

How can I do this?

Cheers
0
Comment
Question by:damianb123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 18

Expert Comment

by:Anil Golamari
ID: 33468867
http://www.tek-tips.com/faqs.cfm?fid=6470  
You need to implement similar to the code in this code.

Hope it helps you

Good Luck.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 33469705
0
 
LVL 1

Accepted Solution

by:
Dymer2 earned 500 total points
ID: 33496657
Hi,
I dont know exactly what you mean with on-line keyboard. Is it a part of the same form as the textboxes or is it a separate form (from what it sounds you have created the online keyboard yourself).
My suggestion is:
trigger the doubleclick event for each textbox, store the textbox name in a global variable.
Depending on your online keyboard, enable it in the doubleclick event, and disable it on Enter or "OK" from your keyboard.

Good Luck!
Option Explicit
Dim Textbox As String
Dim ActiveKeyboard As Boolean
Dim Message As String
Private Sub Text1_DblClick()
    Textbox = Text1
    ActiveKeyboard = True
End Sub

Sub KeyboardClick(OnlineChar As String)
    If ActiveKeyboard Then
        If OnlineChar = vbCrLf Then
            Message = ""
            ActiveKeyboard = False
        Else
            Message = Message & OnlineChar
            Me.Controls(Textbox).Text = Message
        End If
    End If
End Sub

Open in new window

0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 3

Expert Comment

by:Genetic_Wolf
ID: 33613368

first...  as you've noticed (and know) when you TOUCH your "visual" keyboard, this TAKE the focus.
and you NEED to eitheir KEEP that focus or WRITE inside that "textbox"

The best way to handle the problem is first to remove all Textbox (to avoid very bad problem with focus) and replacing it with LABEL Box...
BorderStyle set to 1
background set to White

this will IMITATE a textbox.

I called mine lblTextBox
now I've set up an ARRAY of theses, so I have lblTextBox(0) and lblTextBox(1)
no limit in dimension.

when you HIT (screen click) a textbox, you'll need to change the reference ID of the CURRENT USED textbox.

then you apply a filter to send the key stroke to the emulation function.

give me a second, I'm writing the app.  should take less then 10 minutes.
0
 
LVL 3

Expert Comment

by:Genetic_Wolf
ID: 33613836
just a note:
I'm using the TAG attribute in my keyboard exemple, so I don't need to Align the CORRECT Array number wich is fastidius and need to be completely redone everytime you ADD or remove a Letter in the keyboard.
using the TAG attribute allow me to Set for exemple  the letter A to cmdMyKeyboard(0) and B to cmdMyKeyboard(77) or completely change the layout of my keyboard without the fuss of rewriting the app to change the array definition.

I've finally used Textbox instead of the proposed label, in order to be enable to have the "visual" effect of the cursor.  and I used the LOCKED attribute so the text is handle by code and not by real keyboard entry.   I've also removed the Tab Stop attribute to all textbox, in order to avoid a possible problem.  Since this App will be run with Touch Screen, the Tab function is not needed.
if you "need" the tabstop function, you'll need to ensure that glngFocussedTextBox stay syncronized.  it could be done with the Getfocus fonction.







KeyboardEx.zip
0
 
LVL 3

Expert Comment

by:Genetic_Wolf
ID: 33613850
I've written the remark as I programed and I forgot to revise it.
The TabStop have been re-instated in the Exemple, but to my opinion, if this will be ONLY a Touch Screen program with no use for Tab Key, you would be better removing that feature.  Although the current version of the exemple seem to be bug free from that.  There is note in the code how I fixed it with the GotFocus Event.

I've used only Number, but since the Tag Attribute is set as numerical, you can use any Keyboard function or letter  you'll like and since we're using an EMULATED keyboard, you can even ADD function that doesn't exist on a keyboard and implement it through code.
(exemple a button that will calculate copy or paste)

I didn't implement Select for cut and paste, but that's easyly done with the way I programmed the rest.
0
 

Author Closing Comment

by:damianb123
ID: 33733491
Great, this worked perfect.  Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month4 days, 10 hours left to enroll

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question