gannon Posted April 22, 2009 Posted April 22, 2009 Hello, Last summer at the DEVCON, I was pleased to be introduced to ScriptMaster plugin. I've recently been testing it in order to use it in a production environment. All works as expected on OSX 10.5.6. The problem arises on the Windows platform. None of the examples that require user interface windows (dialog boxes, file chooser dialog, color picker dialog, JDialog objects, etc.) will work as expected. The main problem is the fact that the modal state is not preserved on Windows. Well it actually is preserved regarding the user's input, but the modal windows/dialogs shift to the background if the user clicks on FileMaker. Then the user is lost, FileMaker waiting for a validation of the dialog box, and the user not seeing the dialog box... Am I missing something here ? I didn't find any details on this topic on the forum. Configurations tested FileMaker Pro 9 and 10 Java version 1.6.0_13 Windows XP SP2 and SP3 This issue is important, as all Swing modal dialogs aren't usable on Windows platform. Thank you for your reply, Francis
patate Posted April 28, 2009 Posted April 28, 2009 Bonjour Francis We have the exact same problem and never got it to work. I posted the question but no one answered. http://fmforums.com/forum/showtopic.php?tid/197654/
TheTominator Posted July 31, 2009 Posted July 31, 2009 (edited) Turn your frown upside down. After beating my head against this problem on Vista, I found a following workaround to get the modal dialogs based on JOptionPane (FileDialog, etc.) to display. Unfortunately this workaround breaks the Macintosh version so you need to code differently on each platform. (So much for Java's portability.) The key is to use FileDialog(JOptionPane.getRootFrame(),title); on Macintosh. This is what is normally recommended. And use FileDialog((Frame)null, title); on Windows. In my tests using Java 6 Standard Edition on Vista (build 1.6.0_14-b08), this reliably brought up the modal dialog on top of the FileMaker window instead of being hidden behind. This code causes an error on a Mac running Mac OS X with all the updates. (I think the latest is Java 5.) This may be the difference between Java 6 and Java 5 or differences between the Windows and Mac builds of Java or ScriptMaster for some reason. I dunno. I'm just pleased to get something working. In the case of the File Chooser Dialog, I coded it with an additional parameter "isWindows". Choose File (isWindows) // use "true" or 1 or something when Windows and leave blank otherwise import java.awt.*; import javax.swing.JOptionPane; FileDialog dialog; String title = "Example File Chooser"; if (isWindows == null) { dialog = new FileDialog(JOptionPane.getRootFrame(),title); } else { dialog = new FileDialog((Frame)null, title); } dialog.show(); if (dialog.getFile() != null) { return dialog.getDirectory() + dialog.getFile(); } else { return 0; } Edited July 31, 2009 by Guest Added code sample
patate Posted September 25, 2009 Posted September 25, 2009 Hey thanks a lot TheTominator! I will try your code shortly!
metroart Posted September 25, 2009 Posted September 25, 2009 I tried TheTominator's workaround for Win XP: dialog = new FileDialog((Frame)null, title); Sorry, but it doesn't work for me. I'm using FM 10 Advanced on Win XP SP3 and as far as I can tell, even with the workaround, ALL of the modal dialog functions like SelectFile or FormattedDialogWithDynamicButtons just crash FM if the user clicks on the FM app anywhere outside the modal dialogs. The program just freezes. Scriptmaster seems like a pretty cool idea, and apparently work fines on a Mac, but these guys don't seem to be doing much testing on Windows machines. Too bad.
Smef Posted September 28, 2009 Posted September 28, 2009 I've been testing the Select File script on XP, Vista, and Windows 7 without any trouble. I will pass this information on to the developers for them to look at as well. Are you all using the most up-to-date version of java? My machines are all updated though windows update and using Java 6.
Tanner Posted November 15, 2009 Posted November 15, 2009 The problem appears to be when you have the database window maximized. If I have the window maximized then the script master modal dialogs (like the file chooser) show up behind the filemaker windows. If the database window is not maximized then it appears to behave normally. I agree that this is pretty useless on windows. Anyone have any suggestions?
Smef Posted November 16, 2009 Posted November 16, 2009 (edited) I have been able to reproduce the pop up behind issue issue with the "Select File" module. The "Choose Folder" module does not have this issue as it uses a different java class to generate a prompt, so it seems to be specific to that class. Choose Folder can be used to select files by changing the "JFileChooser.DIRECTORIES_ONLY" parameter to "JFileChooser.FILES_ONLY" or "JFileChooser.FILES_AND_DIRECTORIES" on line four of the module. I hope this solution will work for you. Edited November 16, 2009 by Guest
Tanner Posted November 17, 2009 Posted November 17, 2009 It looks like that is going to work great. The behavior of the choose directory on the mac is not very good but I can use this to get around the issue on the PC and if it is on a mac still use the choose file command. Thanks for your help!
Jesse Barnum Posted February 5, 2010 Posted February 5, 2010 Hey, I know this is an old thread but this is now fixed in ScriptMaster version 3.31.
Electric_Soul Posted September 28, 2016 Posted September 28, 2016 (edited) Hello I just tested the follwoing snippet I found somewhere on the internet. I am on windows 7. The gui opens in the background. I'd like to understand why Please I tested Scriptmaster 4.205 Is there a way to make it stick to the foreground? import groovy.swing.SwingBuilder; import java.awt.FlowLayout; swing = new SwingBuilder(); gui = swing.frame(title:'Test 2', size:[400,200]) { panel(layout:new FlowLayout()) { panel(layout:new FlowLayout()) { for (name in ["Tom", "Dick", "Harry", "Bill"]) { checkBox(text:name); } } panel(layout:new FlowLayout()) { comboBox(items:["Red", "Green", "Blue", "Orange"], selectedIndex:2); } } } gui.show(); Edited September 28, 2016 by Electric_Soul
Electric_Soul Posted September 28, 2016 Posted September 28, 2016 gui.setAlwaysOnTop (true) that works
Recommended Posts
This topic is 3069 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now