Solved

500 POINTS - Using same form for multiple textbox input

Posted on 2010-08-18
7
345 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
Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

 
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

739 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