Differenze tra le versioni di "Individuare i tasti premuti della tastiera mediante il Componente gb.ncurses"
Da Gambas-it.org - Wikipedia.
(Creata pagina con "Le risorse del Componente "''gb.ncurses''" di Gambas consentono, fra l'altro, di individuare il tasto della tastiera premuto. Mostriamo un semplice esempio pratico: Private...") |
|||
(Una versione intermedia di uno stesso utente non è mostrata) | |||
Riga 1: | Riga 1: | ||
− | Le risorse del Componente | + | Le risorse del Componente ''gb.ncurses'' di Gambas consentono, fra l'altro, di individuare il tasto della tastiera premuto. |
Mostriamo un semplice esempio pratico: | Mostriamo un semplice esempio pratico: | ||
Riga 5: | Riga 5: | ||
− | + | Public Sub Main() | |
<FONT Color=gray>' ''Non mostra il tasto premuto della tastiera:''</font> | <FONT Color=gray>' ''Non mostra il tasto premuto della tastiera:''</font> | ||
Riga 17: | Riga 17: | ||
End With | End With | ||
− | + | End | |
− | + | Public Sub WinCurses_Read() | |
− | + | ||
Dim tasto As Integer | Dim tasto As Integer | ||
− | + | ||
+ | With wn | ||
<FONT Color=gray>' ''Intercetta il tasto premuto della tastiera:''</font> | <FONT Color=gray>' ''Intercetta il tasto premuto della tastiera:''</font> | ||
− | + | tasto = .Read() | |
− | |||
− | |||
.Print(Chr(tasto), 1, 1) | .Print(Chr(tasto), 1, 1) | ||
.Raise() | .Raise() | ||
End With | End With | ||
− | + | ||
− | + | End | |
− | |||
Versione attuale delle 08:51, 7 giu 2024
Le risorse del Componente gb.ncurses di Gambas consentono, fra l'altro, di individuare il tasto della tastiera premuto.
Mostriamo un semplice esempio pratico:
Private wn As Window Public Sub Main() ' Non mostra il tasto premuto della tastiera: Screen.Echo = False With wn = New Window(True, 0, 0, 300, 20) As "WinCurses" .Border = Border.ACS .Background = Color.Green .Caption = "Console ncurses" .SetFocus() End With End Public Sub WinCurses_Read() Dim tasto As Integer With wn ' Intercetta il tasto premuto della tastiera: tasto = .Read() .Print(Chr(tasto), 1, 1) .Raise() End With End