Solved

500 POINTS - Using same form for multiple textbox input

Posted on 2010-08-18
7
341 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now