George from Pittsburgh Posted June 30, 2007 Posted June 30, 2007 (edited) In my solution I have "Help" buttons which open new windows and, hopefully, enlighten the user. My problem is that I need to locate and close any "help" windows which may still be open prior to Quitting FMP from my base window. Edited June 30, 2007 by Guest
Ender Posted June 30, 2007 Posted June 30, 2007 If you know the name(s) of your help windows, you can close them by name using the Close Window[] step. If you wish to test for the presence of a specific window, you can use: patterncount(¶ & windowNames & ¶; "¶Help¶") But if you're Quitting FileMaker anyway, you don't need to explicitly close any database windows. They will close anyway when the application quits.
George from Pittsburgh Posted June 30, 2007 Author Posted June 30, 2007 I am using Auto Navigator written by David Kachel. The shutdown script makes note of the last layout and it can't be any unclosed help window. Therefore, I must locate and close all help windows before the AN shutdown script executes. I have tried a loop to close help windows by naming them all "Help"; however, the script closes my base window and fouls up the AN navigating mechanism. I need to just pickoff the help windows prior to quitting FMP. I can't figure out how to identify them and close them.
Ender Posted June 30, 2007 Posted June 30, 2007 Try that pattercount() test with a loop and the Close Window[] step.
normanicus Posted July 1, 2007 Posted July 1, 2007 I know nothing about FM window management but I assume you could do something like this: 1. Create your help windows via script. 2. Have a global field dedicated to holding window names. 3. Each time you create a window add a new line to that global containing the field name. 4. Write a script that picks up the names from that global in LIFO order (last in, first out) and close them. Apologies if this is rubbish but ... Decided to try it: Two scripts (I'm having trouble printing these as text) Script 1: New Help Window Set Variable [ $Next Help Window; Value: Case ( IsEmpty ( Tests::gWindow List ); "Help 1"; "Help " & GetAsText ( GetAsNumber ( MiddleWords ( Tests::gWindow List; 2; 1) ) + 1 ) ) ] Set Field [ Test::gWindow List; $Next Help Window & "¶" & Tests::gWindow List ] New Window [ Name: $Next Help Window ] Script 2: Remove Help Windows Loop Set Variable [ $Last Help Window; Value:LeftWords ( Tests::gWindow List; 2) ] Close Window [ Name: $Last Help Window ] Set Variable [ $Last Help Window; Value:$Last Help Window & "¶" ] Set Field [ Tests::gWindow List; Substitute ( Tests::gWindow List; $Last Help Window; "") ] Exit Loop If [ WordCount ( Tests::gWindow List ) < 1 ] End Loop -------------------- I hope that didn't get messed up in the copy/pasting. Indentation in the last script didn't come over. Worked for me, Norman
George from Pittsburgh Posted July 3, 2007 Author Posted July 3, 2007 Normanicus, Thank you for your thoughts. The first script worked as advertised. I could indeed use it to open new windows; however, my solution will contain probably dozens of help layouts, pre-designed and available to the user. Thus I looked closely at your second script for removing windows. I created a field to hold the help layout names and set the gWindowList to those values in a new first line of your script. I ran the script with my debugger on and noted that for some reason the last value in the gWindowList was not set to "" and the loop was not exited. Set Field [gWindow List; Layout Names ] Loop Set Variable [ $Last Help Window; Leftwords ( Tests::gWindow List; 2) ] Close Window [ Name: #Last Help Window ] Set Variable [ $Last Help Window; Value:$Last Help Window & "¶" ] Set Field [ Tests::gWindow List; Substitute ( Tests::gWindow List; #Last Help Window; "") ] Exit Loop if [ Word Count ( Tests::gWindow List < 1 ] I don't understand the purpose of "  " in the script. Including it caused the script to fail. When excluding it, the script didn't close and take out the last value in gWindow List. To further complicate matters, if a user opened the same window more than once, the script , if working would only take out one copy; gWindow List by design having only one listing for each embedded help window. I could, perhaps, some how use PatternCount to alert the user not to leave any help windows open, but not only is it inelegant, I can't take the chance the user would always comply. I am in a quandry! Thanks for your interest and asssistance. George
George from Pittsburgh Posted July 4, 2007 Author Posted July 4, 2007 Ender, Oh me of little faith! You are right it works beautifully. Happy Fourth.
Recommended Posts
This topic is 6353 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