-
Sometimes you have to call NewFrame in order to lay out several widgets horizontally, but when NewFrame is nested, the layout is shuffled. The demo is a Windows kernel-driven loader, and the expected layout is that the load and unload buttons are laid out horizontally, but the two horizontal buttons should be displayed vertically relative to the struct display widget above it, and the last vertical element is the log display control. However, the layout changes from the position of the two buttons, and the problem with the presentation is that the nested NewFrame does not inherit the layout orientation of the parent |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
func driver() {
b := gi.NewAppBody("driver tools")
hSplits := widget.NewHSplits(b)
lefFrame := gi.NewFrame(hSplits)
v := giv.NewStructView(lefFrame)
v.SetStruct(&DriverLoad{
ReloadPath: "",
ReloadPath1: "ff",
ReloadPath2: "ff",
ReloadPath3: "cc",
ReloadPath4: "vg",
})
buttonsFrame := gi.NewFrame(lefFrame)
buttonsFrame.Style(func(s *styles.Style) {
s.Direction = styles.Row
})
gi.NewButton(buttonsFrame).SetText("load")
gi.NewButton(buttonsFrame).SetText("unload")
log := texteditor.NewEditor(lefFrame)
log.SetBuf(texteditor.NewBuf())
rightFrame := gi.NewFrame(hSplits) //?
vSplits := widget.NewVSplits(rightFrame)
texteditor.NewEditor(vSplits)
texteditor.NewEditor(vSplits)
b.NewWindow().Run().Wait()
}
type DriverLoad struct {
ReloadPath string
ReloadPath1 string
ReloadPath2 string
ReloadPath3 string
ReloadPath4 string
} |
Beta Was this translation helpful? Give feedback.
Can you style each frame with the correct direction?