Multiple DialogBoxes, bringing one to the front of others - a conundrum.

344 views
Skip to first unread message

King_V

unread,
Nov 18, 2011, 2:51:45 PM11/18/11
to Google Web Toolkit
All,

Ok, so I'm still, after a bit of hiatus, trying to create a Window-
type of class that extends DialogBox. I'm going to call it MyWindow
for now.

I'm MOST of the way there. I've been able to create a Caption class
that will have minimize, maximize, and close buttons.

I've been able to get it to change the cursor for a resizable MyWindow
- though I haven't yet implemented the code that does the resizing.

The real roadblock I have right now is how to bring one of the
MyWindow objects to the front of the others.

Normally, DialogBox will have the most recently shown one in front of
previous ones.

Now, they ALL seem to have a z-index of 0. Yet, obviously, there are
some on top of others.

For the MyWindow class, I want to be able to click on one of these
objects, and have it brought to the front.

Two solutions I've tried have drawbacks that make them non-viable
solutions.
1 - If I rely on incrementing the zIndex, other objects, such as
menu items in a MenuBar, wind up being concealed by any MyWindow
that's in the area.
2 - Using the hide() followed by show() in an override of
onBrowserEvent solved that problem, but introduced issues with being
unable to focus on certain components inside the MyWindow.

I have detailed what I've encountered in the thread "DialogBoxes and
MenuBars . . . zIndexing a bad thing?" located at:
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/9a819fd58c9a15bb/ea04ac89956cda4c

So, my question - how do I get around this? How can I get true window-
like behavior, being able to pop a MyWindow up in front of other
MyWindow objects, without these unintended side-effects?

Any help on this matter would be GREATLY appreciated!

geert3

unread,
Nov 24, 2011, 7:39:43 AM11/24/11
to google-we...@googlegroups.com
use a CSS class e.g "active" that has a higher z-index. Only the clicked window shall have that class, causing it pop up in front the others. (basically your approach 1).
popup menus etc need to have a fixed z-index higher than the active window.
i don't see further problems with that?

King_V

unread,
Nov 28, 2011, 1:21:42 PM11/28/11
to Google Web Toolkit
What you've suggested appears to ALMOST work.

I have two styles in my CSS.... one called "activeWindow" and the
other called "nonWindowZIndex"

The former has a z-index of 1, the latter of 2.

The trick I found was that I could not add the nonWindowZIndex style
to the MenuBar objects. It has to apply to the gwt-MenuBarPopup
style.... that was frustrating until I finally figured that bit out.

Now I'm hoping I don't run into any other oddities like that!

Otherwise, so far so good - thanks for the pointer.

Reply all
Reply to author
Forward
0 new messages