Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Mar 2013
    Posts
    9

    Unanswered: How do I write code to type any combination of letters and serve me a letter

    Good evening to all members of forum. I would like to give me your lights and your assistance in following my question. How do I write code to type any combination of letters and serve me a letter.For examble:

    Fds --->L
    Fd------->B etc.

    The table uses the Braille for the combinations are the following

    Code:
    1.  f	   4.  j
    2.  d	   5.  k
    3.  s	   6.  l

    It is a picturesque Braille
    Code:
    f	  a	a
    fd	  b	b
    fj	  c	c
    fjk	  d	d
    fk	  e	e
    fdjk	  f	f
    fdjk	  g	g
    fjk	  h	h
    dj	  i	i
    djkl	  j	j
    jl	  k	k
    fds	  l	l
    fsj	  m	m
    fsjk	  n	n
    fsk	  o	o
    fdsj	  p	p
    fdjkl	  q	q
    fdsk	  r	r
    dsj	  s	s
    dsjk	  t	t
    fsl	  u	u
    fdsl	  v	v
    djkl	  w	w
    fsjl	  x	x
    fsjkl	  y	y
    fskl	  z	z
    keno
    Punctuation marks
    Code:
    	 
    l	,	,
    dk	:	3
    ds	∙	2
    dkl	.	4
    dl	;	5
    dsk	!	6
    s	_‘	'
    sss	…	''
    dsl	“	8
    skl	”	0
    dskl	(	7
    dskl	)	7
    keno	΄	"
    Thanks in advance

    Alexander
    Attached Files Attached Files
    Last edited by Pat Phelan; 12-29-13 at 21:51. Reason: added code blocks for readability

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    1. Create a table names Tbl_Lookup, as follows:
    Code:
    Sequence	Lower	Upper
    dj	        i	i
    djkl	        j	j
    dk	        :	3
    dkl	        .	4
    dl	        ;	5
    ds	        キ	2
    dsj	        s	s
    dsjk	        t	t
    dsk	        !	6
    dskl	        (	7
    dsl	        ・	8
    f	        a	a
    fd	        b	b
    etc...
    2. Paste this code in the Form module (see the note).
    Code:
    Option Compare Database
    Option Explicit
    
    '
    ' Note: The property KeyPreview of the form must be set to True.
    ' ----
    '
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    
        Static strBuffer As String
        Static booShift As Boolean
        
        If Shift And 1 = 1 Then booShift = True
        If KeyCode <> 27 Then       ' Escape key.
            strBuffer = strBuffer & Chr(KeyCode)
        ElseIf KeyCode = 8 Then     ' Backspace key.
            strBuffer = Left(strBuffer, Len(strBuffer) - 1)
        ElseIf KeyCode = 46 Then    ' Delete key.
            strBuffer = ""
        Else                        ' Any other key (Should filter to kep valid keys only).
            If booShift = False Then
                Me.Text0.Value = Nz(Me.Text0.Value, "") & Nz(DLookup("Lower", "Tbl_Lookup", "Sequence='" & strBuffer & "'"), "")
            Else
                Me.Text0.Value = Nz(Me.Text0.Value, "") & Nz(DLookup("Upper", "Tbl_Lookup", "Sequence='" & strBuffer & "'"), "")
            End If
            strBuffer = ""
            booShift = False
        End If
        KeyCode = 0
        
    End Sub
    3. The only constraint is that the user must press the Escape key to close a sequence and force the generation of a character corresponding to that sequence.
    Have a nice day!

  3. #3
    Join Date
    Mar 2013
    Posts
    9
    Sinndho!!!!

    First I want to thank you for the quick reply I gave. Also thank you for the valuable working site represented. We will customize your instructions to the base to see apotelesma.Tis best wishes for the new year from Greece.

    Best Regards
    Alexander

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    If it wasn't for the fact that your codes are not uniquely identifiable (ferintance fd, fds would casue problems without some from of termination character) you could have refined Sinndho's code so that you don't need to press the escape key by testing after each key is released to see if completes off a revised keycode. but that is not possible. Is this coding of your own making, I can find no reference to it elsewhere.
    If it were me I think I'd prefer to go down the route of using a keyboard overlay.

    However irrespective of what route you go down your could further enhance the code playing playing the letter after the keycode is entered.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

  6. #6
    Join Date
    Mar 2013
    Posts
    9
    Dear Sinndho

    Unfortunately it does not work neither with the code. Maybe it needs a timer between each keystroke.
    You tried it and it worked on you; If it worked swamp at the base attached.

    Alexander
    Attached Files Attached Files

  7. #7
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Your project does not work because you used the event handler for the KeyDown event for the TextBox (text0):
    Code:
    Private Sub text0_KeyDown(KeyCode As Integer, Shift As Integer)
    while I used the KeyDown event handler of the Form:
    Code:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Moreover, in my project the name of the TextBox was Text0, while in you project, the name of the TextBox is Text1. You then need to change the code accordingly:
    Code:
            If booShift = False Then
                Me.text1.Value = Nz(Me.text1.Value, "") & Nz(DLookup("Lower", "Tbl_Lookup", "Sequence='" & strBuffer & "'"), "")
            Else
                Me.text1.Value = Nz(Me.text1.Value, "") & Nz(DLookup("Upper", "Tbl_Lookup", "Sequence='" & strBuffer & "'"), "")
    Have a nice day!

  8. #8
    Join Date
    Mar 2013
    Posts
    9
    Dear Sinndho!!

    Keyboards 3 simultaneous key to display a letter. ( examples keyboards CAB give us L ) . When I press the form displays each separately gramma.Ego but I getting 3 letters in a letter.
    Also when the preview button is not working fals diameter as indicated in the notes.
    I tried the code and form the event below and TEXTO but not working .
    I have done the table like you said and still nothing .
    I send you the base just like you told me to do.
    Can you pass me the code and send me a sample of the Convention ;
    Although I think it does not change anything .

    Alexander
    Attached Files Attached Files

  9. #9
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    In the last database you posted the KeyPreview property of the form was not set to True, meaning that the Form_KeyDown event handler was never called.

    In the attached database everything works as expected. I just made a little modification (for reasons that would be too long to explain here): the variables strBuffer and booShift are now private members of the form instead of being static variables.
    Attached Thumbnails Attached Thumbnails Properties.jpg  
    Attached Files Attached Files
    Have a nice day!

  10. #10
    Join Date
    Mar 2013
    Posts
    9
    Dear Sinndho!!

    Eventually I could not type a single button on the base that you sent me. It does not work. In your PC it works?

    Alexander

  11. #11
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Alexander,

    Yes, as I wrote in my last message, here it woks as expected. I tested it both with Access 2003 SP3 (11.8321.8405) on a XP machine and with Access 2010 (14.0.6129.5000) on a Windows 7 machine.

    Set a breakpoint at the beginning of the procedure Form_KeyDown and see whether it's called or not. if it's called, progress forward step by step in the procedure and see what happens.
    Have a nice day!

  12. #12
    Join Date
    Dec 2013
    Posts
    43
    Provided Answers: 1
    Alexander,

    I think when your database opens, you have to enable the code to run.

    If you haven't then it would behave as you explain.

    Wayne

  13. #13
    Join Date
    Mar 2013
    Posts
    9
    Wayne !!!

    I understand the technique and philosophy of the base. I tried the code step by step. I tried the base and I saw that it loads into memory. The first letter keeps the fade from the text box you and it write the second it keeps both letters in memory etc.
    All these I can see through the code.
    In the text box of the form , I can not write letters .
    However, if there are 3 letters in combinations table starting from the same letters that will recognize what is the next letter to stop? Think about when someone writes very quickly what will happen should I introduce some routines that restrict their combinations. I think we need four routines because letters starting combinations in the table is 4 .
    The F , d , g ,j...
    Finally run the code does not ring but can not write in the text box.

    Alexander

  14. #14
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Quote Originally Posted by alexander156 View Post
    However, if there are 3 letters in combinations table starting from the same letters that will recognize what is the next letter to stop?
    Finally run the code does not ring but can not write in the text box.
    Did you keep in mind that the Escape key must be hit to close the sequence and allow the letter corresponding to what's in the buffer to be added to the textbox?

    The code I provided was intended to suggest a path to a possible solution and a template for implementing that solution. I never pretended that it was a full functional optimized solution. If you're looking for such a ready-to-use solution, dbforums is probably not the best place to search. We try to help people, not to provide a free consultancy service.
    Have a nice day!

  15. #15
    Join Date
    Mar 2013
    Posts
    9
    Ok Sinndho!!

    Iam never tried to take ready solutions.Sorry Sinndho I had forgotten the escape.Its ok.
    On the chance see a new approach to the desired (unfinished).
    Code:
    Option Compare Database
    Option Explicit
    
    Private strBuffer As String
    Private BlnShift As Boolean
    
    
    
    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
        Dim strTemp As String, tmpCode As Long
        tmpCode = KeyCode
         KeyCode = 0
        If Shift And 1 = 1 Then BlnShift = True
    
       If tmpCode = vbKeyBack Then
    '        strBuffer = Left(strBuffer, Len(strBuffer) - 1)
            Exit Sub
        ElseIf tmpCode = vbKeyDelete Then
            strBuffer = ""
            Exit Sub
            
            Else
            strBuffer = strBuffer & Chr(tmpCode)
            
        End If                     ' Any other key (Should filter to kep valid keys only).
        
        If Shift = 0 Then
            strTemp = Nz(DLookup("Lower", "Tbl_Lookup", "Sequence='" & strBuffer & "'"), "")
        Else
            strTemp = Nz(DLookup("Upper", "Tbl_Lookup", "Sequence='" & strBuffer & "'"), "")
        End If
        If strTemp <> "" Then strBuffer = ""
        Me.Text1.Text = Me.Text1.Text & strTemp
        Me.Text1.SelStart = Len(Me.Text1.Text)
       
    End Sub
    
    Private Sub Εντολή2_Click()
        strBuffer = ""
    End Sub
    We are always try.
    Finally I want to thank you once again for all your interest in my solution. He showed me how to look better my solution. I wish you many years. HAPPY NEW YEAR.

    Alexander

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •