bug fix (There is a small bug on inputBox again)

This commit is contained in:
2024-09-27 14:38:39 +02:00
parent 3b2ff24c1f
commit cf93b3383f
7 changed files with 83 additions and 89 deletions
+11 -7
View File
@@ -8,17 +8,21 @@ import (
)
func main() {
text := colors.Red + "This is a div!"
width, h := osui.GetTerminalSize()
paginator := ui.Paginator(
ui.Div(
ui.Text("Welcome to the example! Press tab to go to the next page or press tab to go to a previous page"),
ui.Text("Welcome to the example! Press tab to go to the next page or press shift + tab to go to a previous page"),
),
ui.Div(
cutils.WithPosition((width-30)/2, (h-4)/2,
cutils.WithSize(30, 4,
cutils.WithStyle(&ui.DivStyle{Background: colors.Blue, Foreground: colors.Red},
ui.Div(cutils.WithPosition(0, 0, ui.Text("This is a test!"))),
)))),
ui.Div(
cutils.WithPosition(26, 2, ui.Text("This is a InputBox. It takes user input just like a GUI")),
cutils.WithPosition(0, 1, ui.InputBox(20)),
),
ui.Div(cutils.WithPosition((width-30)/2, (h-4)/2, cutils.WithSize(30, 4, cutils.WithStyle(&ui.DivStyle{Background: colors.Blue}, ui.Div(ui.Text(text)))))),
// ui.Div(
// ui.Text("This is a InputBox. It takes user input and"),
// cutils.WithPosition(0, 2, ui.InputBox(20)),
// ),
)
screen := osui.NewScreen(paginator)
screen.Run()