Differenze tra le versioni di "Individuare i tasti premuti della tastiera mediante il Componente gb.ncurses"
Da Gambas-it.org - Wikipedia.
Riga 21: | Riga 21: | ||
Public Sub WinCurses_Read() | 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 | 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