jroimartin / gocui

Minimalist Go package aimed at creating Console User Interfaces.
BSD 3-Clause "New" or "Revised" License
9.91k stars 608 forks source link

move window to foreground #37

Closed djcas9 closed 8 years ago

djcas9 commented 8 years ago

Is this possible ATM with multiple windows with the same demolitions?

jroimartin commented 8 years ago

In gocui, the last created view is always on top of the existing ones. Some time ago, I was considering to allow setting the view's z-position, but most of the time this is not needed and only adds complexity. For instance, the most common case of overlapping views is when you want to show a dialog, which is already supported with the current design.

djcas9 commented 8 years ago

@jroimartin here is my usecase - building an irssi type clone in go https://github.com/mephux/komanda-cli - keeping the views in my case lowers the complexity.

So is the only work around deleting the view and recreating it? Or is it possible to move the view or resize it to 1x1 px.?

jroimartin commented 8 years ago

I added *Gui.SetViewOnTop to support this use-case. You can check it on branch view-on-top commit 2defea8aed70d401b46e7738879a3ed8e81d83e3. Let's see if it works for your use case.

However, I wouldn't like to add much more complexity regarding z-position. With this patch, a view will be on top when:

djcas9 commented 8 years ago

@jroimartin That works great - thank you.

jroimartin commented 8 years ago

Cool! Merged on master.