Dokumentaro de Gambaso
Compilation & Installation
Components
gb
gb.crypt
gb.qt4
Documents
Indekso de Lingvo
Language Overviews
LeguMin
Lexicon
Registro

Window.Ask (gb.ncurses)

Function Ask ( Opts As String [ , Tries As Integer ] ) As String

This function prompts the user to type any of the characters present in the Opts, optionally stopping after Tries wrong keystrokes. If Tries is omitted, the function will ask until one of the options is chosen.
Either the chosen option character or NULL, in case the number of Tries is exceeded, is returned.

Keep in mind that this function only deals with ASCII characters.

Examples

' Prompt the user to decide if he really wishes to delete the particular file,
' if the he hits Return, y as a default option is chosen. After three wrong keystrokes
' y is assumed.

Window.Print("Would you like to delete this file? [Y/n]", -1, -1)
Select Case Window.Ask("yn\n", 3)
  Case Like "[y\n]"
    DeleteFile()
  Case "n"
    DoNotDeleteFile()
  Case Null
    Window.Print("Bad luck! Today we delete anyway", -1, -1)
    DeleteFile()
End Select