[dba-VB] Cursor control

paul.hartland at fsmail.net paul.hartland at fsmail.net
Tue Jan 27 09:52:19 CST 2004


To Bill,
 
Hopefully this should get you started in the right direction
 
Public pubCursor As Integer
 
Private Sub cmdLeft_Click()
    Me.Text0.SetFocus
    If (pubCursor > 0) Then
        pubCursor = pubCursor - 1
        Me.Text0.SelStart = pubCursor
    End If
End Sub
 
Private Sub cmdRight_Click()
    Me.Text0.SetFocus
    If (pubCursor < Len(Trim(Me.Text0))) Then
        pubCursor = pubCursor + 1
        Me.Text0.SelStart = pubCursor
    End If
End Sub
 
Private Sub Form_Open(Cancel As Integer)
    pubCursor = 0
End Sub
 
Private Sub Text0_GotFocus()
    Me.Text0.SelStart = pubCursor
End Sub
 
The Text0_GotFocus moves the cursor to the last position known to pubCursor, then the cmdLeft & cmdRight buttons move the cursor to either the left or right of the last position.
 
Paul






Message date : Jan 27 2004, 03:29 PM
>From : bkollodge at parkindustries.com
To : dba-VB at databaseadvisors.com
Copy to : 
Subject : [dba-VB] Cursor control
Hi, can anyone help with the following problem:

I'm trying to control the cursor location in a textbox's caption. On
the keyboard the left and right arrows do exactly what I need, but on my
project, there will be no keyboard - only a touchscreen, so I want to
add buttons to my form that will mimic the left and right arrows. This
will allow the user to move the cursor across the displayed caption for
editing.

Thanks!

Bill Kollodge
CNC Engineering


_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com
Freeserve AnyTime - HALF PRICE for the first 3 months - Save £7.50 a month 
www.freeserve.com/anytime


More information about the dba-VB mailing list