Solved

500 POINTS - Using same form for multiple textbox input

Posted on 2010-08-18
7
344 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
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 85

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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending receiving text messages in vb.net 15 48
Finding the IIS version 5 22
how to just get time from a date 6 34
Input parameteres to DragOver 2 20
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

821 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