TECLA TAB

SCAVICCHIA 28/08/2009 12:33:08
#321222
Boa tarde,
alguém poderia me informar qual o código ASCII da tecla Tab ou como faço para criar um código que toda vez que pressionar a tecla TAB focar uma outra textbox
MARCELO.TREZE 28/08/2009 12:42:49
#321225
mas colega sem código a tecla tab já faz isto.
SCAVICCHIA 28/08/2009 13:09:46
#321229
Marcelo, acho que vc não entendeu a minha pergunta, a tecla tab ela faz realmente o que você falou, mas ela vai obedecer a sequencia da TabIndex da Textbox, o que acontece é o seguinte, quando for pressionado a tecla TAB é focar uma textbox independente dessa sequencia.
ROBIU 28/08/2009 13:40:09
#321234
Também não estou entendendo a finalidade. Se você precisa percorrer focos alternados, independente do Tabindex, é só definir para onde vai o foco quando sair de uma textbox. Ex.:

TextBox1 - Tabindex=0
Textbox2 - TabIndex=1
TextBox3 - TabIndex=2

Para ir direto para o textbox3:

Private Sub Text1_LostFocus()
Text3.SetFocus
End Sub


SCAVICCHIA 28/08/2009 13:48:19
#321237
Amigo, se puderem só informar o código ASCII da tecla TAB ja ficaria agradecido
LCSD 28/08/2009 14:05:09
#321240
pesquisando no famoso site PAIS DOS BURROS encontrei este material. LEIA-O!!!

Tabela ASCII Estendida

Ao ler este material, verá que o código ASCII da tecla ESPECIAL TAB é 9
O difícil será VC capturar este ascii, mas BLZ.... Se é só isso que VC precisa (por enquanto), boa sorte....
ASHKATCHUP 28/08/2009 14:20:52
#321241
Amigos: a tecla TAB não é detectada no evento [Ô]keypress[Ô] ou [Ô]keydown[Ô] do Textbox.
USUARIO.EXCLUIDOS 28/08/2009 14:44:44
#321250
Resposta escolhida
Siga este exemplo: para debugar crie 1 novo projeto (1 form com 2 textbox) nao mude nome nenhum e cole isso no codigo:
eu testei aqui e deu certo, ele trabalha a Tecla tab porém identifica q vc pressionou.

Qq coisa me mande e-mail (externamente)

Option Explicit

Private Declare Function GetKeyboardState _
Lib [Ô]user32[Ô] (pbKeyState As Byte) As Long

Private Const VK_TAB = &H9
Private Const VK_SHIFT = &H10
Private Const VK_LBUTTON = &H1

Private btArray(255) As Byte

Private Sub Text1_GotFocus()
Call DisplayKey
Call HighLightBox(ActiveControl)
End Sub

Private Sub Text2_GotFocus()
Call DisplayKey
Call HighLightBox(ActiveControl)
End Sub

Private Sub HighLightBox(TBox As TextBox)
If Not MouseClicked Then
With TBox
.SelStart = 0
.SelLength = Len(.Text)
End With
End If
End Sub

Private Function Tabbed(Optional RefreshState As Boolean = False) _
As Boolean
Call RefreshKeyState(RefreshState)
If ((btArray(VK_TAB) And &H80) = &H80) Then
Tabbed = True
End If
End Function

Private Function Shifted(Optional RefreshState As Boolean = False) _
As Boolean
Call RefreshKeyState(RefreshState)
If ((btArray(VK_SHIFT) And &H80) = &H80) Then
Shifted = True
End If
End Function

Private Function MouseClicked(Optional RefreshState As Boolean = False) _
As Boolean
Call RefreshKeyState(RefreshState)
If ((btArray(VK_LBUTTON) And &H80) = &H80) Then
MouseClicked = True
End If
End Function

Private Sub RefreshKeyState(RefreshState As Boolean)
If RefreshState Then
Call GetKeyboardState(btArray(0))
End If
End Sub

Private Sub DisplayKey()
Dim bShifted As Boolean
Dim bTabbed As Boolean
Dim sMessage As String

If MouseClicked(True) Then
Me.Caption = Timer & [Ô] Used mouse[Ô]
Else
bShifted = Shifted(False)
bTabbed = Tabbed(False)
If bTabbed Or bShifted Then
sMessage = [Ô] Pressed [Ô]
If bShifted Then
sMessage = sMessage & [Ô]Shift-[Ô]
End If
If bTabbed Then
sMessage = sMessage & [Ô]Tab[Ô]
End If
Me.Caption = Timer & sMessage
End If
End If

End Sub

SCAVICCHIA 28/08/2009 15:22:54
#321267
Rafael, obrigado pela dica..... me ajudou muito
e obrigado aos demais também que disponibilizaram as suas opiniões
Tópico encerrado , respostas não são mais permitidas