![]()
Non riesco ad intercettare che tasto ho premuto su di un oggetto, tipo CheckBox, se il tasto premuto è un tasto che mi sposta il fuoco tipo TAB e le frecce di movimento.
![]()
Esiste forse qualche API che mi puo' aiutare?![]()
GRAZIE.
![]()
![]()
![]()
Non riesco ad intercettare che tasto ho premuto su di un oggetto, tipo CheckBox, se il tasto premuto è un tasto che mi sposta il fuoco tipo TAB e le frecce di movimento.
![]()
Esiste forse qualche API che mi puo' aiutare?![]()
GRAZIE.
![]()
![]()
prova l'evento keypress o keyup...
le frecce vengono riconosciute e mi sembra (mi sembra anche il TAB)
Let's your dream came true!
No, il TAB nn viene riconosciuto.
Puoi usare questa API:
codice:Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long Private Sub Command1_Click() Dim Buffer(255) As Byte Call GetKeyboardState(Buffer(0)) If Buffer(Asc(vbTab)) <> 0 Then MsgBox "Tasto Tab Premuto!" End If End Sub
E' la prima cosa che ho fatto ma su di un CheckBox non ha nessun effetto. ( NON SONO COSI' IMBRANATO.prova l'evento keypress o keyup...
le frecce vengono riconosciute e mi sembra (mi sembra anche il TAB))
Sto provando con l'API segnalata da IGUANA13 ma non riesco a capire cosa non va:
La GetKeyboardState sembra valorizzare un buffer di tipo posizionale con il codice ascii del taso per indice ma, visualizzando l'intero buffer vengono valorizzati parecchi elementi che non c'entrano niente con il tasto premuto. Con il tasto TAB sembra funzionare ma con le frecce di movimento no.
Provate questo esempio incollando in un form 2 oggetti Check e 2 oggetti TextBox in queste posizioni:
Check1 Text1
Check2 Text2
La mia intenzione è imtercettare sul Check1 la pressione del tasto FrecciaGiu per poter scendere al Check2 saltando Text1
Premendo il TAB sul Check1 viene visualizzato correttamente il messaggio ma, sostiuendo la IF di verifica con questaOption Explicit
Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long
Private Sub Check1_KeyDown(KeyCode As Integer, Shift As Integer)
MsgBox "Evento KeyDown"
End Sub
Private Sub Check1_KeyPress(KeyAscii As Integer)
MsgBox "Evento KeyPress"
End Sub
Private Sub Check1_KeyUp(KeyCode As Integer, Shift As Integer)
MsgBox "Evento KeyUP"
End Sub
Private Sub Check1_LostFocus()
Dim i As Integer
Dim Buffer(255) As Byte
Call GetKeyboardState(Buffer(0))
For i = 0 To 255 Step 2
Debug.Print "idx(" & CStr(i) & ") = " & CStr(Buffer(i)) & " " & "idx(" & CStr(i + 1) & ") = " & CStr(Buffer(i + 1))
Next i
If Buffer(Asc(vbTab)) <> 0 Then
MsgBox "Tasto TAB premuto!"
End If
End Sub
non riesco ad intercettare un bel niente....
If Buffer(Asc(vbKeyDown)) <> 0 Then
MsgBox "Tasto FrecciaGiu premuto!"
End If
SBAGLIO QUALCOSA![]()
![]()
![]()