Individuare i tasti premuti della tastiera mediante il Componente gb.ncurses

Da Gambas-it.org - Wikipedia.

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
 
' Intercetta il tasto premuto della tastiera:
  tasto = Window.Read()
  
  With wn
   .Print(Chr(tasto), 1, 1)
   .Raise() 
 End With
  
End



Riferimenti