fyne icon indicating copy to clipboard operation
fyne copied to clipboard

Proposal: Move Window.Resize() and Window.CenterOnScreen() to desktop package

Open andydotxyz opened this issue 4 years ago • 4 comments

On thinking more about this I realise that having no-op functions at the top level isn't smart. I propose deprecating these and moving them to the desktop package, something like:

if win, ok := thisWin.(desktop.Window); ok {
    win.Resize(fyne.NewSize(200, 200))
}

It is a little more hidden away, but it does more truly stick to what will happen when called...?

andydotxyz avatar Jul 02 '20 09:07 andydotxyz

I guess it makes sense that any "Desktop" related features are available from the desktop package instead of having to write noop functions etc. for other drivers.

mortzdk avatar Jul 02 '20 09:07 mortzdk

I think the feedback on moving CenterOnScreen is getting approval - but the Resize() feature is used far too much to bury away. I wonder if it should be renamed to indicate that it may not do what is expected - maybe RequestSize() could warrant it staying at the main Window interface?

andydotxyz avatar Jul 15 '20 20:07 andydotxyz

How to get the resolution of the computer screen and center the whole program interface?

aohanhongzhi avatar Jul 11 '22 01:07 aohanhongzhi

You center a window by calling Window.CenterOnScreen

andydotxyz avatar Jul 11 '22 04:07 andydotxyz