customized a flex layout
This commit is contained in:
parent
410099e314
commit
0d302d887b
18
main.go
18
main.go
|
@ -7,15 +7,15 @@ import (
|
|||
func main() {
|
||||
app := tview.NewApplication().
|
||||
EnableMouse(true)
|
||||
modal := tview.NewModal().
|
||||
SetText("Do you want to quit the application?").
|
||||
AddButtons([]string{"Quit", "Cancel"}).
|
||||
SetDoneFunc(func(buttonIndex int, buttonLabel string) {
|
||||
if buttonLabel == "Quit" {
|
||||
app.Stop()
|
||||
}
|
||||
})
|
||||
if err := app.SetRoot(modal, false).SetFocus(modal).Run(); err != nil {
|
||||
flex := tview.NewFlex().SetDirection(tview.FlexColumn).SetFullScreen(true).
|
||||
AddItem(tview.NewFlex().SetDirection(tview.FlexRow).
|
||||
AddItem(tview.NewBox().SetBorder(true).SetTitle("Map"), 0, 2, true).
|
||||
AddItem(tview.NewBox().SetBorder(true).SetTitle("Details"), 0, 1, false), 0, 1, true).
|
||||
AddItem(tview.NewFlex().SetDirection(tview.FlexRow).
|
||||
AddItem(tview.NewBox().SetBorder(true).SetTitle("Character"), 0, 1, false).
|
||||
AddItem(tview.NewBox().SetBorder(true).SetTitle("Actions"), 0, 1, false), 20, 1, false)
|
||||
|
||||
if err := app.SetRoot(flex, false).SetFocus(flex).Run(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue