Closed casey-SK closed 7 months ago
Turns out it was the cursor. Fixed
import tui_widget
import illwill, options
var inputBox = newInputBox(1, 1, consoleWidth(), 3, "message", bgColor=bgBlack)
var display = newDisplay(1, 4, consoleWidth(), consoleHeight(), "board", statusbar=false)
var app = newTerminalApp(title="tui widget")
let enterEv: EnterEventProcedure = proc(arg: string) =
display.add(inputBox.value & "\n")
display.render()
inputBox.value("")
inputBox.resetCursor()
inputBox.onEnter= enterEv
app.addWidget(inputBox)
app.addWidget(display)
app.run()
hi @casey-SK , thanks for trying out the library. It is still under development and testing locally to do resetCursor()
on value changes. Like what you experience, is due the cursor has not been updated after a new value assigned to the widget.
The event API and value function will change, it may look something like this after the update.
let enterEv: EnterEventProcedure = proc(arg: string) =
display.add(inputBox.value & "\n")
inputBox.value("") # or inputBox.value = ""
thank you.
Hello, I am just playing around with this library, I have the following tui, where line 12 seems to create unexpected behaviour. The entire program becomes unusable with
inputBox.value("")
included. otherwise the program runs as expected.Thanks, Casey