[AccessD] Simulate tab in a plain text textbox
John Colby
jwcolby at gmail.com
Wed Apr 5 15:10:14 CDT 2023
Is this a single instance scenario? Because if you need to save state and
it is used in several text boxes you are asking for trouble.
On Mon, Apr 3, 2023, 21:48 Ryan W <wrwehler at gmail.com> wrote:
> Does anyone have some slick code to simulate pressing tab in a plain text
> textbox?
>
> this is what I've got now:
>
> Option Compare Database
> Option Explicit
> Private lPos As Long
> Private lTabCnt As Long
>
> Private Sub Narrative_KeyUp(KeyCode As Integer, Shift As Integer)
> If KeyCode <> vbKeyTab Then
> lPos = Me!Narrative.SelStart
> lTabCnt = 0
> End If
> If KeyCode = vbKeyTab Then
> Dim leftTxt As String, rightTxt As String, tabPOS As Long
> KeyCode = 0
> lTabCnt = lTabCnt + 1
> tabPOS = lPos + (lTabCnt * 4)
> leftTxt = left(Me!Narrative, lPos)
> rightTxt = Mid(Me!Narrative, lPos + 1)
> Me!Narrative = leftTxt & Space(4) & rightTxt
> Me!Narrative.SelStart = tabPOS
> End If
> End Sub
>
> Private Sub Narrative_MouseUp(Button As Integer, Shift As Integer, X As
> Single, Y As Single)
> lPos = Me!Narrative.SelStart
> End Sub
>
>
> It seems to work for most scenarios, but it flashes as if I'm highlighting
> the text when I press tab. Application.Echo and SetPainting have no
> effect.
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
More information about the AccessD
mailing list