ui
ui copied to clipboard
Change window position
Is it somehow possible to change the window position? Every time I call the show
method, my window is in the bottom left corner beneath other windows. I Would really like to bring it to the front into the center.
There is in libui; it will be added to Go after alpha 4. Are you on OS X?
Ye.Would really like to do it somehow from golang
The window not being on top thing is intentional; it works that way so as to not break app bundles. If you run from within an app bundle or through some other Launch Services means, the window will appear on top like normal. See this for details.
There is in libui
Is it somehow possible to call it in ui (the go project)?
If you build libui from source, you can replace the static objects and ui.h file, then add a SetPosition()
(and Center()
) to window.go.
May I ask how you create the other static object files for windows or linux? Would you update the ui dependency to libui? Looks like you use some build scripts. Quite new to the go and c world. I mainly write in Java and never used make before. I get errors all over the place.
Please see https://github.com/andlabs/libui/issues/127#issuecomment-231081446
It's darn inconvenient that the window starts up in OS X right down the bottom left of the screen, instead of in the middle of the screen like every other app. I there a reason why you chose the bottom left for the starting position? Wrapping it in an app bundle doesn't help the unusual positioning issue, and from what I can find, there's no way in the bundle to give an alternate window position.
Because OS X doesn't have a concept of a default position chosen by the OS, so right now it just uses (0, 0). Does every program start centered? If so I can also start centered.
Not every program starts centred I don't think, but it's quite a substantial amount more common than any other position. I've certainly never seen an app that starts at 0,0.
I actually think when you're creating the traditional application in xcode, it defaults to an approximately centered position, and you can adjust it if you want, but most people just leave it where it suggests.
Yes. It's that position I'm not sure about. I suppose I can just auto-center new windows on OS X since the OS doesn't provide any other facility for default placement other than "absolute screen coordinates".
Just to not forget it, there is a patch here that puts window on a better place on macOS, following Java AWT's setLocationByPlatform
.
Just ran into this, too. Would be brillant if the window could be centered. :)
Centered as default seems good default. Ideally to be settable on the window struct window.SetPosition(x int, y int)
.
Push and agree...
This has been sitting for 4 years, what's the big deal? I'm sure there are at least a couple different merge buttons to pick from, that can each fix this problem in one click.
edit: Sorry, wrong issue, this is so confusing. The correct issue would be on the libui repo
~~edit 2: It looks like libui has a uiWindowCenter function.. so is this solved or not? I'm confused now~~
edit 3: Okay, so those functions were removed. Nevermind.
Hi @andlabs, Is there any plan to fix this issue?