Skip to main content

JavaHelp and modal dialogs

7 replies [Last post]
Anonymous

I am trying to use Help in an application that includes modal dialogs.
If I launch the Help from the modal dialog, it stays in front of the
dialog, when I would prefer it to be either in front or behind depending
on which has focus.

If I launch the Help from the main window, and keep it open, then open a
modal dialog, I can no longer interact with the Help.

Please forgive me for asking about this. I have searched the archives
and found that the topic crops up regularly but I have never found a
satisfactory answer. Has anyone solved it?

Many thanks,
-Paul

********************************************************************************

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Paul Brown

Thanks for all your help, Binky, it's ben very kind of you.

There is one last point I'd like to make. I've implemented your
solution, caching the original actionWindow and resetting it when my
modal dialog closes (in the windowClosing event).

I notice that after calling setActivationWindow, I also need to call
setDisplayed on the broker again to make things take effect.

Another thing: I only want to keep the Help visible after I close my
dialog if it was visible at the time that the dialog is closed.
Unfortunately, by the time the WindowClosing event is fired in the
modal, the Help window has been closed (as it usually does when a modal
dialog closes).

So, there appears no way that I can know whether the Help was displayed
at the time that the modal dialog was closed. Therefore, I'm left with
either always having it open or always closed. How annoying!

Unless, you know of another workaround for this?

Many thanks,
-Paul

********************************************************************************

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.

Paul Brown

Thanks again Binky.

That is frustrating though. The JDK is missing a few things that would
be nice - including dialogs with the full screen and iconify controls
that frames have. Maybe the JavaDesktop JModalWindow project will
resolve some of these problems.

In the meantime, I will implement your solution. Returning to my first
problem, if I may. You say that there's nothing I can do to have the
Help window or the Modal dialog switch to which is at the front
according to which has the focus. That, too, is frustrating. Given that
is the case, is there anyway that I can ensure that it is always the
modal dialog and not the Help window that is at the front?

Many thanks,
-Paul

********************************************************************************

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.

Roger Brinkley

Paul Brown wrote:

> Thanks again Binky.
>
> That is frustrating though. The JDK is missing a few things that would
> be nice - including dialogs with the full screen and iconify controls
> that frames have. Maybe the JavaDesktop JModalWindow project will
> resolve some of these problems.

I hope so. They're working on some changes here. We'll see.

> In the meantime, I will implement your solution. Returning to my first
> problem, if I may. You say that there's nothing I can do to have the
> Help window or the Modal dialog switch to which is at the front
> according to which has the focus. That, too, is frustrating. Given that
> is the case, is there anyway that I can ensure that it is always the
> modal dialog and not the Help window that is at the front?

Unfortunately no. Neither you nor I have any control over this. If I did
I could fix or at least address the issue.

Binky

********************************************************************************

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.

Paul Brown

Sorry, I should have added that by "interact with the help" I meant that
I want the user to be able to do the following:

1. User running main application
2. Launches Help from the main window (JFrame)
3. The user opens a modal dialog again from the main window; the help
stays open at the page the user left it.
4. With the dialog still open, the user interacts with the help,
scrolling the page, changing the page etc.

Is this not possible? Simply because the dialog is modal and the
activation window of the Help is the original [non-modal] JFrame?

Thanks,
-Paul

********************************************************************************

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.

Roger Brinkley

Paul Brown wrote:

> Sorry, I should have added that by "interact with the help" I meant that
> I want the user to be able to do the following:
>
> 1. User running main application
> 2. Launches Help from the main window (JFrame)
> 3. The user opens a modal dialog again from the main window; the help
> stays open at the page the user left it.
> 4. With the dialog still open, the user interacts with the help,
> scrolling the page, changing the page etc.
>
> Is this not possible? Simply because the dialog is modal and the
> activation window of the Help is the original [non-modal] JFrame?

Correct. But you can correct situation by setting the activation window
to the current modal. If so desired you could cache the current
activation window and then reset it when the modal is killed. This is
the only way to work around the problem.

The real solution here to would be to have a system modality setting
that allows the help dialog to stay up, but alas that isn't available in
the JDK.

Binky

********************************************************************************

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.

Paul Brown

Hi Binky,
thanks for your interest.

I have an action, so that I can initiate help from either a menu item or
a button and in the event handler for that action, I do the following:

wp.setActivationWindow(owner);
broker.setCurrentID(id);
broker.setDisplayed(true);

where wp is the WindowPresentation, obtained from the broker, and owner
is the main JFrame of my application.

The broker is a static so when I later open a modal dialog, I call the
same code and set the ActivationWindow to be the modal dialog.

Any help would be much appreciated.
Thanks,
-Paul

********************************************************************************

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.

Roger Brinkley

Paul Brown wrote:

> I am trying to use Help in an application that includes modal dialogs.
> If I launch the Help from the modal dialog, it stays in front of the
> dialog, when I would prefer it to be either in front or behind depending
> on which has focus.

This has to do with the focus engine and there isn't much you can do
about this.

> If I launch the Help from the main window, and keep it open, then open a
> modal dialog, I can no longer interact with the Help.

How are you activating the main window. Are you using the HelpBroker or
some other means?

Binky

********************************************************************************

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.