Oppure

Loading
15/05/12 14:29
gzorzi
Buongiorno, ho una routine che gestisce l'evento keypress. Questa routine aggiunge in una arraylist (keyBuffer) ogni singolo carattere selezionato e chiama
la sub KeyPressManager, la quale manda un carattere su seriale, carattere che dovrebbe scatenare un altro handles della seriale. Il problema è che l'handle scatenato dalla pressione del tasto inibisce lo scatenarsi del secondo handle dovuto alla scrittura su seriale, fintanto che la sub keypressManager non finisce.
In pratica fino a quando io sono nella sub keypreemanager, nessun altro handle viene gestito. Come posso risolvere? Grazie

Private Sub KeyPress(ByVal sender As Object, _
                   ByVal e As Windows.Forms.KeyPressEventArgs) Handles txtTerminal.KeyPress


        KeysBuffer.Add(e)
        KeyPressManager()
 End Sub

Private Sub KeyPressManager() 

        Dim e As Windows.Forms.KeyPressEventArgs

        PressManager = True

        While KeysBuffer.Count > 0 
              e = CType(KeysBuffer.Item(0), KeyPressEventArgs)
           

                terminal.writeChar(e.KeyChar)
                e.Handled = True
end while

aaa