E Gish Posted July 1, 2004 Posted July 1, 2004 We often place multiple buttons along the top of our headers to launch specific scripts. On some of our layouts thre is now quite a bit of buttons collecting up top. Are we able to create a value list which upon selecting an item launches a particular script : This is similar to what we find in Microsoft Access drop down menus. I am a newbiw with many of the new features in FM7 and passing parametrs around. Any help is greatly appreciated. It would eliminate a lot of button clutter.
-Queue- Posted July 1, 2004 Posted July 1, 2004 If the field is formatted as a menu and you are only using Windows, then Go to Field [yourfield] Pause/Resume Script [1 second] If [yourfield = "this"] Perform Script [this] Else If [yourfield = "that"] Perform Script [that] ... End If Unfortunately, you can't call the script dynamically. You could pass a single script the parameter of the field, but then it will have to cycle through the Ifs anyway.
E Gish Posted July 1, 2004 Author Posted July 1, 2004 I did as you instructed above. My field on my layout is a POP menu that displays a given value list. To get the script to run I assigned a script to the button. But then it does not display the value list. This works, but, it does not allow me to change any values on the value list. Since it is a button it does not display a value list. If I edit the field contents to something different it will execute the script next time it is run since it has captured the contents. But I want it to execute which portion of the scipt depending on the value I selct int he value list. What am I missing here? How do I get the button and value list to coexist?
-Queue- Posted July 1, 2004 Posted July 1, 2004 The script should display the menu. Disallow access to the field. That way you only have entry by script. And an Exit Record/Request as the first step in the script, just in case you're already in the record.
E Gish Posted July 2, 2004 Author Posted July 2, 2004 Thank you for the continued help, but I am afraid I am missing something simple here... How do you get a script to display a value list? and at a given location... that I belive is done by the GOTO FIELD command you mentioned above
-Queue- Posted July 2, 2004 Posted July 2, 2004 The Go to Field step does the same thing as putting your cursor in a particular field. It is more useful, however, because it doesn't require having 'Allow entry into field' set. So, if your field is formatted as a menu, then Go to Field [thatfield] will activate the menu to display, just as if you had allowed entry. And to clarify/reiterate, format the field itself as a button calling (Performing) the script.
E Gish Posted July 2, 2004 Author Posted July 2, 2004 Queue, Thank you very much for your help in this matter. It is greatly appreciated. I got it too work in a new file. I will have to go back and see what the bug a boo is in my old file. The only problem I have now is this... once you make a selection from the menu, the script does not immediately execute for some reason. You have to click off on to the layout then click on the button once again. Then it executes properly. Not quite perfect but it works. I never found the exit records script step you were talking about. Sorry for being so dense. See attached file EventDrivenMenus.zip
-Queue- Posted July 2, 2004 Posted July 2, 2004 Ah, it would be Commit Records/Requests in version 7. Sorry about that. If you are using Windows, it should work, as long as the field is formatted as a menu. Attached is a simple demo that should help. Menu.zip
E Gish Posted July 6, 2004 Author Posted July 6, 2004 Ok I have changed the line in the scripts to Commit Records/Request Still having the problem of selecting the menu item, then clicking on the layout, then back to the menu item to get it to execute my scripts is as follows Commit records/request (skip data validation and perform without dialog = On) Goto field [select/perform: Menu action] (select/perform and goto target fields = on) If[menuasctions=Contacts] perform script ="Contacts" If[menuasctions="Fax"] perform script ="Fax" If[menuasctions="Home"] perform script ="Home" End if End IF End if I think I have all the scripts steps set to execute automatically FYI, if you take and make a selection with your file it executes right away. But if you make another selection right away afterwards, then it does nothing. THe problem is in the repeating the processes over and over again. sample file is attached thanks again for the help EventDrivenMenus.zip
-Queue- Posted July 6, 2004 Posted July 6, 2004 It appears you forgot to include the Pause/Resume Script [1 second] step. Also, you need to add an Else between your second and third If steps. Then everything works nicely.
E Gish Posted July 6, 2004 Author Posted July 6, 2004 I had both of those in a one time, but ended up taking them out while trouble shooting... does it matter where in the script the pause is at? I am puzzled why it does not execute the called out scripts right away. see my revised file with the added pause for 1 second and else statements. I actually prefer the else if.... but doubt it matters EventDrivenMenus.zip
-Queue- Posted July 6, 2004 Posted July 6, 2004 Oh yes, it matters immensely, to quote Henry Higgins... The Pause must be directly after the Go to Field or else the script won't wait for a selection before resuming. I hadn't noticed the Else If steps; they're not available in 5.5. Thanks for the notice.
Jeep Watson Posted July 17, 2004 Posted July 17, 2004 I think I've got your answer. Attached find a zipped file (can be opened by a Mac or a PC) containing a rework of your sample file and an example plugin (one for Mac & one for PC) from Filemaker that they included with Filemaker Developer 7 as an example for developers to look at when creating their own plugins. They say it's of limited usefulness except as a teaching device BUT... it has a couple of nice features including a function (XMpl_StartScript) that will trigger an event when the referenced field is changed. What this means is exquisite simplicity - you don't even have to create a button - just pick a value from your popup menu and the script immediately triggers! Just quit Filemaker and place the example plugin in the Filemaker extensions folder. Restart Filemaker and run the new file to see the implementation. Just look at the field definition to see the validation by calculation. Then take a look at the script - it's been stripped down to nothing but your conditional branching. ENJOY! EventDriven.zip
DanBrill Posted July 19, 2004 Posted July 19, 2004 Hey Jeep, Welcome to the forum. Great first post! You beat me to it. The example plugin is of much greater utility than the FM documentation is letting on. I'm find I'm using it all the time as I rebuild my application in 7. The example you describe here is great. Another idea that I've had is field validation by script. Suppose the user is supposed to select a person's name from a value list. They select from the list and a script is triggered. The script checks to see if the name entered was on the value list. (Easy to do by setting up a relationship and using isempty() or ValueListItems().) If it was on the value list, then the value is accepted. If not, the script pops up a new window (another nice new feature) allowing the user to create a new record on the fly, or to cancel and reselect from the list. This will greatly reduce user confusion. Thanks again, Dan
Jeep Watson Posted July 24, 2004 Posted July 24, 2004 Exit Record (or, if you prefer, Goto Field with no argument) just tidies up you layout - no field is selected or entered when going into the new layout. Depending on your intent this may or may not be what you want - you might want a particular field to be highlighted/selected and ready for input. Attached is a version 2 of the my original post. It has a cleaner interface and shows some experimentation with new window appearance and control functions of FM7. EventDriven_v2.zip
Recommended Posts
This topic is 7428 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