Non-modal dialog

425 views
Skip to first unread message

pack

unread,
May 17, 2006, 10:35:00 PM5/17/06
to Google Web Toolkit
Hi

Dose GWT support non-modal dialog? Or any widget that can float over
existing client area?

Thanks in advance

Regards,
Prakash

stro...@gmail.com

unread,
May 18, 2006, 12:10:58 AM5/18/06
to Google Web Toolkit
Yep, check the component here:

http://code.google.com/webtoolkit/documentation/com.google.gwt.user.client.ui.DialogBox.html

For an example, go to the e-mail demo and click "about"

pack

unread,
May 18, 2006, 5:18:26 AM5/18/06
to Google Web Toolkit
Thanks for your replay but unfortunaltely this is a modal dialogue. It
would not allow user to click on any other link until you close the
dialog. I was looking for a non-modal one.


-- Pack

zz

unread,
May 18, 2006, 5:29:45 AM5/18/06
to Google Web Toolkit
Maybe you can use a Label instead, except you can not drag it.

pack

unread,
May 18, 2006, 5:44:55 AM5/18/06
to Google Web Toolkit
I am going to try and use the popup.... and see if that works.

-- Pack

Strobhen

unread,
May 18, 2006, 3:45:06 PM5/18/06
to Google-We...@googlegroups.com
Oops, my mistake.

fin

unread,
May 18, 2006, 4:13:24 PM5/18/06
to Google Web Toolkit
PopupDialogs can be used both as modals and as non-modals.
Actually this dialog is just a movable iframe, but it has funcionality
that can prevent this dialog from losing focus: its in a onEventPreview
method.
This method called each time any event occurs, if dialog registred in
DOM.addEventPreview funcionality.
So anytime when you call dialog.show(), its registering himself in
addmethodpreview.
But you can use dialog without calling dialog.show() method, but just
placing it somewhere by that method lie this:
RootPanel.get().add(this).
yes, its a workarround, but it seems to work.

here is a fragmet of code of onEventPreview from PopupDialog if you
interessed whats going on there, and a bit lazy to look inside it:


/**
* Called when a browser event occurs and this event preview is on
top of the
* preview stack.
*
* @param event the browser event
* @return <code>false</code> to cancel the event
* @see DOM#addEventPreview(EventPreview)
*/

public boolean onEventPreview(Event event) {
int type = DOM.eventGetType(event);
switch (type) {

.
.
.
case Event.ONMOUSEDOWN:
case Event.ONMOUSEUP:
case Event.ONMOUSEMOVE:
case Event.ONCLICK:
case Event.ONDBLCLICK: {
// Don't eat events if event capture is enabled, as this can
interfere
// with dialog dragging, for example.
if (DOM.getCaptureElement() == null) {
// Disallow mouse events outside of the popup.
Element target = DOM.eventGetTarget(event);
if (!DOM.isOrHasChild(getElement(), target)) {
// If it's a click event, and auto-hide is enabled: hide
the popup
// and _don't_ eat the event.
if (autoHide && (type == Event.ONCLICK)) {
hide(true);
return true;
}
return false;
}
}
.
.
.

krishna...@gmail.com

unread,
May 22, 2006, 1:40:12 PM5/22/06
to Google Web Toolkit
I tried this approach. There are a few issues with it though.
a) If the non-modal dialog is shown (initially) over a list or a
drop-down, then the list shows through part of the dialog
b) When multiple dialogs are added, then their z level is created in
the order these dialogs are crated, so only one stays on top and the
rest stay in the backgroud.
c) Instad of hiding the windows, you have to remove the instances when
one is closed..

Thanks

Reply all
Reply to author
Forward
0 new messages