Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / July 2008

Tip: Looking for answers? Try searching our database.

Linux/X-Windows unable to set focus on a modal form (Consulting $     anyone)

Thread view: 
caultonpos - 04 Jul 2008 20:03 GMT
It appears whenever a modal window is opened on Linux X-Windows the
focus is stolen from the window and you CANNOT use the keyboard or any
peice of code to return focus to the form - let alone set the focus in
the textbox.

This is not just for my modal forms but for something as fundamental
as JOptionPane or simple code like this:

JFileChooser chooser = new JFileChooser();
if (chooser.showOpenDialog(parentComponent) ==
JFileChooser.APPROVE_OPTION) {
}

From trolling through posts I can see no answers which is really sad
for Linux good for Microsoft I guess.  How can we deploy on Linux if
you are forced to get carpal tunnel clicking on every form with the
mouse ?

I would be willing to pay some consulting dollars to get this
resolved.

Greg
Knute Johnson - 04 Jul 2008 20:51 GMT
> It appears whenever a modal window is opened on Linux X-Windows the
> focus is stolen from the window and you CANNOT use the keyboard or any
[quoted text clipped - 18 lines]
>
> Greg

Either you are not explaining your self adequately or you've got some
odd problem.  If I open a JFileChooser dialog on XP or Fedora 9 I can
close it very easily with the escape key.  On both, focus is returned to
the frame that opened the dialog and I can continue to maneuver with the
keyboard.

However, I am happy to consult.  Please remit a large sum of cash and
you will definitely get my full attention to your problem :-).

Signature

Knute Johnson
email s/nospam/knute2008/

caultonpos - 05 Jul 2008 02:57 GMT
On Jul 4, 3:51 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:
> > It appears whenever a modal window is opened on Linux X-Windows the
> > focus is stolen from the window and you CANNOT use the keyboard or any
[quoted text clipped - 39 lines]
>
> - Show quoted text -

Its not closing it that is the issue, it is getting focus on it
without the mouse.

Have a look at http://www.patientos.org/demo.htm

login with admin/admin and press the Import button

you will notice you cannot type or use the keyboard until you use the
mouse.
Andrew Thompson - 05 Jul 2008 07:17 GMT
> On Jul 4, 3:51 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
...
> > However, I am happy to consult.  ...
...
> Its not closing it that is the issue, it is getting focus on it
> without the mouse.
>
> Have a look athttp://www.patientos.org/demo.htm

I would have tested it, but the signed nature
of that code made me not do so.  E

Can you either ..
a) Post an SSCCE of failing code, or..
b) Take Knute up on the offer of consultancy
(I'd have grabbed it myself but for the fact
I have no Linux box for testing, ..well, that
and I am confident Knute could fix the problem.)

--
Andrew Thompson
http://pscode.org/
Knute Johnson - 05 Jul 2008 17:56 GMT
> On Jul 4, 3:51 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
> wrote:
[quoted text clipped - 33 lines]
> Its not closing it that is the issue, it is getting focus on it
> without the mouse.

On what the modal dialog?

> Have a look at http://www.patientos.org/demo.htm
>
> login with admin/admin and press the Import button
>
> you will notice you cannot type or use the keyboard until you use the
> mouse.

I think you should do as Andrew suggests and post an SSCCE.

Signature

Knute Johnson
email s/nospam/knute2008/

caultonpos - 05 Jul 2008 22:09 GMT
On Jul 5, 12:56 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:
> > On Jul 4, 3:51 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
> > wrote:
[quoted text clipped - 56 lines]
>
> - Show quoted text -

I already posted an short example

JFileChooser chooser = new JFileChooser();
if (chooser.showOpenDialog(parentComponent) ==
JFileChooser.APPROVE_OPTION) {
}

The JFileChooser shows the dialog to browse for files - but unlike
windows the dialog has no focus - you must click on it to do anything.

Perhaps it does not fail on a local linux box but I am using NXClient
- the applet on demo.htm fires up NX and you can see for yourself.

Not sure how else you are going to see the issue without spending a
lot of time setting up a Swing app on a remote linux desktop, setting
on Nx and connecting to it...
Knute Johnson - 05 Jul 2008 22:38 GMT
> On Jul 5, 12:56 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
> wrote:
[quoted text clipped - 66 lines]
> lot of time setting up a Swing app on a remote linux desktop, setting
> on Nx and connecting to it...

I don't like having my time wasted.  I wouldn't have answered you or
tried to duplicate your problem on my Linux and Windows machines if I
had known that you were using some sort of remote access software that I
don't own.

I suggest if you need assistance in the future you completely describe
your problem or use a different name!

Signature

Knute Johnson
email s/nospam/knute2008/

Nigel Wade - 07 Jul 2008 11:04 GMT
> On Jul 5, 12:56 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
> wrote:
[quoted text clipped - 75 lines]
> lot of time setting up a Swing app on a remote linux desktop, setting
> on Nx and connecting to it...

Try this demo:
http://java.sun.com/docs/books/tutorial/uiswing/examples/components/FileChooserD
emoProject/src/components/FileChooserDemo.java


It works here running on a Linux server and displaying via NX on a both a
Windows PC and a Linux PC. I can see no fundamental problem with Java modal
windows and X Windows, or NX. Perhaps that's why you can't find a solution
by "trolling through posts", because there isn't a generic problem to be
solved. Linux continues to be a perfectly valid platform for Java.

When you use NX the modality and focus traversal of those windows is the
responsibility of NX and the platform which is displaying those windows. That
is the client machine, not the server. Hence, unless your client platform is
Linux/UNIX the windows are not being controlled by X Windows. It's almost
certainly the fault of NX, or how you have it configured.

Signature

Nigel Wade

caultonpos - 10 Jul 2008 23:56 GMT
> > On Jul 5, 12:56 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
> > wrote:
[quoted text clipped - 95 lines]
>
> - Show quoted text -

Thanks for the help.  It didn't occur to me to be a NX issue - but I
have logged an issue with NoMachine so we will see if they come up
with something.  Without the proper focus the viability of NX drops
drastically - but as you say could be a configuration issue.

I did determine that if I run Nx in *desktop* mode there is no issue -
works as designed.  In *floating window* mode the issue is there - of
course desktop mode is not desired.  When you did your test - did you
use Desktop mode ?

I will test your standalone code to see if that reproduces the error
on my config.

If floating window fails on my config but works on yours then I think
we are getting somewhere !

thanks!

Greg
caultonpos - 11 Jul 2008 00:23 GMT
> > > On Jul 5, 12:56 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
> > > wrote:
[quoted text clipped - 117 lines]
>
> - Show quoted text -

Ok my testing reveals

a) Both my software and the FileChooserDemo work as designed when
running as X-Windows (slow...)
b) The FileChooserDemo windows fail to get focus when running as
NxClient as a 'floating window'

NX Client for Windows 3.2.0-10
NXSERVER - Version 3.2.0-7 - LFE
NXNODE - Version 3.2.0-5 - LFEN

also reproduced with this configuration

NX Client for Windows 3.2.0-10
NXSERVER - Version 3.2.0-13 - LAS Evaluation
NXNODE - Version 3.2.0-11 - LASN Evaluation

c) So the big question is whether the same issue is seen with your
config using the FileChooserDemo in *floating mode* ?
d) If it works then your client version number and/or configuration
may be pertinent.

thanks!

Greg
Nigel Wade - 11 Jul 2008 10:43 GMT
>> Thanks for the help.  It didn't occur to me to be a NX issue - but I
>> have logged an issue with NoMachine so we will see if they come up
>> with something.  Without the proper focus the viability of NX drops
>> drastically - but as you say could be a configuration issue.

Good luck with getting NoMachine to even admit there's a problem...

I don't know if you've noticed, but the NX client doesn't handle the X backing
store correctly. When I tracked down the reason and informed NoMachine of this
their answer was pretty much of the form "this is how we've interpreted the
meaning of backing store, and we're not changing it" even though it is
blatantly obvious that their interpretation doesn't meet with the requirement.

They basically changed the way it operates, taking away the responsibility of
maintaining the backing store from the server and placing it on the client to
handle all expose events. But this is exactly what the backing store is
supposed to do. The reason they've done this (they actually have to modify the
X source code to break it) is to improve performance.

In their eagerness to optimize the X protocol they've actually broken some of
its functionality. But they won't admit they've broken it and
instead "interpret" how it should work to meet with how their code actually
works. So, they clearly regard how fast NX works as more important than how
correctly it works.

>> I did determine that if I run Nx in *desktop* mode there is no issue -
>> works as designed.  In *floating window* mode the issue is there - of
[quoted text clipped - 19 lines]
> b) The FileChooserDemo windows fail to get focus when running as
> NxClient as a 'floating window'

I always run as a desktop. I don't like floating windows.

If I use floating windows then the same problem arises with the Windows client,
but works ok with the Linux client.

We don't use the NoMachine NX server as their licensing fees are exorbitant.
Instead we use freenx, and I've build my own binaries from the NX server open
source.

Signature

Nigel Wade



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.