Closed lzytaro closed 2 months ago
Easy, get available content size of given window, set pos of the status bar to content_height - status_bar_height - padding
Easy, get available content size of given window, set pos of the status bar to
content_height - status_bar_height - padding
This is a good solution, but when there is too much content on my page that exceeds the size of a single screen, how to ensure that Statusbar is always floating at the bottom of the window
Easy, get available content size of given window, set pos of the status bar to
content_height - status_bar_height - padding
This is a good solution, but when there is too much content on my page that exceeds the size of a single screen, how to ensure that Statusbar is always floating at the bottom of the window
Window's size is fixed, no matter how many widgets inside, it's not the available content size, my bad, should be window size.
Easy, get available content size of given window, set pos of the status bar to
content_height - status_bar_height - padding
This is a good solution, but when there is too much content on my page that exceeds the size of a single screen, how to ensure that Statusbar is always floating at the bottom of the window
Window's size is fixed, no matter how many widgets inside, it's not the available content size, my bad, should be window size.
Sorry I didn't describe it clearly. Can the method you mentioned keep StatusBar in a fixed position at the bottom of the window? Even if there is too much window content and a scroll bar is generated, I still need to keep StatusBar at the bottom of the window where I can see it, rather than having to scroll to the bottom to see it.
@lzytaro you can do like this:
package main
import "github.com/AllenDang/giu"
const statusBarH = 80
var (
windowHeight float32 // store it whenever you want
paddingH float32
)
func loop() {
giu.SingleWindow().Layout(
giu.Custom(func() {
_, windowHeight = giu.GetAvailableRegion()
_, paddingH = giu.GetItemSpacing()
}), // get available region
giu.Child().Layout( // this will be a container for your layout, you can use Style() to make it invisible
giu.Label(`
some
layout
that
has
many
lines
and
is
longer
than
window
height
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
lalala
`),
).Size(giu.Auto, float32(windowHeight-statusBarH-paddingH*2)),
giu.Child().Layout(
giu.Label("put here whatever you want, it will be fied here"),
).Size(giu.Auto, float32(statusBarH)),
)
}
func main() {
wnd := giu.NewMasterWindow("Status Bar [issue 850]", 800, 600, 0)
wnd.Run(loop)
}
@gucio321 that's a good ideal, thanks
Related problem
No response
Your request
I need something like the status bar in my project. Is there a solution for the status bar, or keep the widget on the bottom? Looking forward to your answers
Alternative solution
No response
Additional context
No response