Fyne: Modal dialog/window

Created on 3 Jun 2019  路  12Comments  路  Source: fyne-io/fyne

Is there a way to block the parent window when a dialog (or child window) is shown?

question

All 12 comments

We have recently added a modal overlay which greys out the window and positions the content within but over the top. Would this be what you were thinking of?
I was considering moving dialogs to use this instead as we don't have a cross-platform way to force windows to block in that way.

modal overlay which greys out the window and positions the content within but over the top

Just like html5 does.

Would this be what you were thinking of?

Yes, something like that.

We have recently added a modal overlay

How can i use it?

Many thanks for your help.

It will be part of the 1.1 release which we expect in a couple of weeks.
It's probably easiest to wait for release if you can?

Yes, probably.

I'll wait to the next release, then.

Many thx!

Sorry for reviving this old issue.

I came here in search for a GUI library for go that allows me to display a dialog which can't be ignored. I need to write a go program that sits in the background and waits for a certain time. When the point in time is reached the program needs to display a dialog with some text in it. This dialog needs to be the topmost window. Other windows can still be visible in the background but my dialog must not be put into the background (at least until the OK button is clicked.

I ran your fyne_demo and very much like what I see. When using the 1.1 version will I be able to create such a dialog, in my case on Windows ?

You can use Window.RequestFocus() to ask any window to raise, this is just a request, however, and the operating system may choose to ignore it depending on circumstances.

We don't support a "force on top" feature at this time. Also note that our dialogs currently require a parent window so you should use a regular window instead.

Thanks for your suggestion. I modified the fyne_demo and added w.RequestFocus() to the centered windows test. The newly opened window is initially on top but can be put into the background afterwards. Both the parent windows or any other task (in my example calc) can overlay it.
So I think I need to look for a different solution.

grafik

That sounds like a bug - a new window should always appear above its parent unless you have some strange configuration in your OS?...

Sorry for the confusion: it comes up on top but I can position/move it like shown on the screen

Your application has no rights to control over other windows from outside your application - therefore it can not control stacking, block, etc... it is the job of the desktop/window manager to control this - and for good reasons that I won't get into. So if that's the case you may be asking well then how does it work? Well every platform will be different. On Linux we would send hints to the window manager to request that our window be managed in this way. I'm sure other platforms like Mac and Windows will be similar.

Long story short - Fyne would have to expose an API to you to make this possible. And then Fyne would have to handle the backend native code to set up these hints. This can be problematic and a chore unless we can get the exact behavior to work cross platform. Else we will have applications having inconsistent behavior. We can look at doing this but no promises!

As I mentioned above @mar1ged we don鈥檛 support the always on top hints. As @okratitan points out this could be difficult. That said it鈥檚 not something that can be supported on all platforms (i.e. on iOS there is no such thing) so should we add it at all?

I am fine (fyne ? ;-)) with that, just wanted to make sure I don't miss something. I understand that a generic solution can't support all platform specific stuff

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andydotxyz picture andydotxyz  路  9Comments

lusingander picture lusingander  路  3Comments

semyon-dev picture semyon-dev  路  4Comments

Geo25rey picture Geo25rey  路  7Comments

bulatenkom picture bulatenkom  路  7Comments