Keyboard.sel

#!./Selene
-- Keyboard functions

Selene.UseCurses()

local pwnd = SelCurses.init()
local NORM, UND, BOLD = SelCurses.CharAttrConst("NORMAL"), SelCurses.CharAttrConst("UNDERLINE"), SelCurses.CharAttrConst("BOLD")

pwnd:attrset( UND )
pwnd:print("Enter at least 7 chars :")
pwnd:attrset( BOLD )
local s = pwnd:getnstr(7)
pwnd:attrset( NORM )
pwnd:print("Response : '" .. s .."'\n")
pwnd:refresh()

pwnd:attrset( UND )
pwnd:print("Unlimited entry :\n")
pwnd:attrset( BOLD )
s = pwnd:getstr()
pwnd:attrset( NORM )
pwnd:print("Response : '" .. s .."'\n")
pwnd:refresh()

pwnd:attrset( UND )
pwnd:print("Now, from the center of the screen :\n")
pwnd:attrset( BOLD )
local w,h = pwnd:GetSize()
pwnd:attrset( NORM )
s = pwnd:GetstrAt(w/2,h/2)
pwnd:print("Response : '" .. s .."'\n")
pwnd:refresh()

pwnd:attrset( UND )
pwnd:print("Type some keys ")
pwnd:attrset( NORM )
pwnd:print(" ('X' to quit)\n")
SelCurses.noecho()
SelCurses.cbreak()
pwnd:keypad( true )

local c
repeat
	c = pwnd:getch()
	io.write( string.format("%02x ", c) )
	pwnd:refresh()
until c == 88

SelCurses.endwin()
generated by LDoc 1.4.6 Last updated 2022-09-05 22:24:50