You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm using flex as the main window in the app, so what I need to do is hide some of the items of the flex, I archived it setting the the item proportion to 0 so the item became hidden, which works great, except when you try to set the proportion to 0 of the last item added in the flex.
package main
import"github.com/rivo/tview"funcmain() {
app:=tview.NewApplication()
test1:=tview.NewBox().SetBorder(true).SetTitle("test1")
test2:=tview.NewBox().SetBorder(true).SetTitle("test2")
test3:=tview.NewBox().SetBorder(true).SetTitle("test3")
flex:=tview.NewFlex().
AddItem(test1, 0, 0, false).
AddItem(test2, 0, 1, false).
// Becase the last item is added with 0 its gonna panic// with integer division by zeroAddItem(test3, 0, 0, false)
iferr:=app.SetRoot(flex, true).Run(); err!=nil {
panic(err)
}
}
Same thing happen if you try to resize the last item with:
flex.ResizeItem(test3, 0, 0)
You gonna get: panic: runtime error: integer divide by zero [recovered] panic: runtime error: integer divide by zero
The text was updated successfully, but these errors were encountered:
natemago
added a commit
to natemago/tview
that referenced
this issue
Aug 19, 2019
Hello, I'm using flex as the main window in the app, so what I need to do is hide some of the items of the flex, I archived it setting the the item proportion to 0 so the item became hidden, which works great, except when you try to set the proportion to 0 of the last item added in the flex.
Same thing happen if you try to resize the last item with:
You gonna get:
panic: runtime error: integer divide by zero [recovered] panic: runtime error: integer divide by zero
The text was updated successfully, but these errors were encountered: