NativeJFileChooser icon indicating copy to clipboard operation
NativeJFileChooser copied to clipboard

Modality

Open miho opened this issue 8 years ago • 7 comments

Hi there, I tried somethings similar in the past but I was missing modality support. Any ideas on how to achieve this?

miho avatar Oct 16 '17 12:10 miho

Unfortunately no. Nothing I have tried so far worked. I'm aware that the parent window is still clickable (despite being entirely white). I also asked on Stackoverflow about this more than two years ago.

steffen678 avatar Oct 16 '17 21:10 steffen678

Hmm, that is bad. For my use case modality cannot be optional. I use it for a fairly complex application (VRL-Studio) which crashes if I use JavaFX dialogs and violate modality. I will let you know if I found a solution.

miho avatar Oct 16 '17 22:10 miho

not quite modal but the commented lines (126 & 137) help a lot if uncommented: people can still loose the filedialog behind other windows but they at least cannot click anything in the calling application. However, just uncommenting them will lead to NPEs if showOpenDialog is called with the null component. This can be fixed by only changing the enable status if parent != null. This works like a charm for me; I'll be happy to provide a patch or pull request (although it's just two lines to be fixed)

timobaumann avatar Mar 28 '18 23:03 timobaumann

I previously had the issue that those lines would cause the parent window to minimize upon choosing a file. That's why they are uncommented, if I remember correctly.

edit: Okay, I just tested it and it doesn't seem to be happening anymore. For me, at least.

steffen678 avatar Mar 29 '18 06:03 steffen678

it didn't happen for me either (linux/GTK), so I'm leaving it in. The alternative was much more disturbing: actions in the parent window would not yield any responses while the filedialog is shown but all be executed after the filedialog is dismissed. I think the potential for confusion is even larger than minimization in that case.

timobaumann avatar Apr 02 '18 13:04 timobaumann

I published a new version which enables this behaviour by default. Still unsure about “real” modality, but better than nothing, I guess.

steffen678 avatar Apr 05 '18 09:04 steffen678

thank you so much!

timobaumann avatar Apr 06 '18 21:04 timobaumann