Simple FileMaker Pro 13 Popover Close in One Script
Yes, this is a common nuisance. Although it depends on what you want to use it for.
The intended use for popovers is what is commonly seen on iOS (and more and more websites are picking it up as time goes by) – for example the iCloud tabs and bookmarks popovers in iOS Safari. Eg. for bookmarks: You tap the bookmarks icon, it pops down a popover with the list of bookmarks in it, you choose one, and it goes away. Or if you change your mind and don’t want to choose one then you tap anywhere outside of it, and that makes it go away without selecting anything. And that’s the key there. They are designed to dismiss if you click outside of them.
But we (the FileMaker Pro Dev community), as we usually do with new FileMaker Pro features, have come up with all sorts of other uses for them. I was considering a blog post on some of these unconventional uses, but it’s kinda been done to death already by others.
For starters, see here: filemakerhacks.com/2013/12/14/filemaker-13-popovers. In a couple of these examples, stopping it from dismissing via any means other than clicking a specific button, is desired.
What inspired me (other than my need for it in a current client project) was the end of that article where the author (Howard Schlossberg) noted a solution to that problem, but also noted he couldn’t figure out how to do it in one script, instead needing two. Obviously that was a challenge to be met, and so I met it.
If [ Get ( ScriptParameter ) = “Button” ]Set Variable [$$closePopoverOK ; Value: True]Close PopoverSet Variable [$$closePopoverOK ; Value: “”]Else If [ Get ( ScriptParameter ) = “Trigger” ]Exit Script [ Result: $$closePopoverOK]End If
Next steps:
- attach this script to the button within the popover that you want to have close it (with script parameter: “Button”), and…
- attach it to the popover’s OnObjectExit script trigger (with script parameter: “Trigger”)
In short my tip isn’t “this is how to stop popovers dismissing when you don’t want them to”. My tip is “this is how to do it in one script instead of two”.
Cool huh? We have a FileMaker test-run file you can download to play with!
*This article is provided for free and as-is, use and play at your own risk – but have fun! Excelisys does not not provide free support or assistance with any of the above. If you would like help or assistance, please consider retaining Excelisys’ FileMaker Pro consulting & development services.
About Excelisys, Inc.: Founded in 2001, Excelisys (www.excelisys.com) is an FBA Platinum Partner and FileMaker Certified developer organization specializing in the designing, developing, customizing, supporting, consulting, migrating, upgrading, tweaking, fixing, and integrating of FileMaker Pro solutions, FileMaker Go solutions, MySQL, PostgreSQL, QuickBooks-FileMaker Pro Integration, Excel and MS Access FileMaker Pro conversions/migrations, iPhone and iPad business solutions, and other various database technologies and frameworks that automate your organization’s data solution needs for use on the web, mobile, and desktop platforms. Contact Excelisys today for a free estimate and consultation about your business software automation needs @ 866-592-9235.
[…] *For additional information on how to avoid the common nuisance of popovers closing when clicking outside the box, David Thorp at Excelisys writes a very informative article.* […]
I have a portal, and want to avoid have the extra blank row when allow insert is selected in the relationship. However, when inserting records into the relationship, I do not want to display a new layout, but want the new row created in the port (last row)l, and want my popover modal to show allowing me to fill in the data for that record.
Thomas,
Try turning off the “Allow creation of related records” in the relationship that’s used for the portal.
Hey Thomas,
Thanks for your interest in my technique! 🙂
Christo is right – turning off “Allow creation of related records” solves the “extra blank row” issue.
To that I would then add you can create a script that saves the primary key of the parent record into a variable, then switches to a layout based on the TO of the portal’s table, creates a new record, puts the primary key you saved in the variable earlier, into this child record’s foreign key field, and then returns to the original layout. Sometimes doing all that in a separate off screen window is an option as well.
Either way, that creates the child/portal record and relates it to the parent record, all behind the scenes, and then you can do whatever you like with that record on the portal on the original layout once you’re back there.
Hope that helps, and let me know if you need any of that clarified further!
David.
Hi David,
Thank you for this brillant idea. Now my Popover works like a charm.
I hope I don’t misunderstand the problem above, but for that problem I use a much simpler approach. I allow addition of records in the relationship graph. On the portal row I have a small button with a plus sign which by default appears in the last row of the portal. This button hides when a given field in the portal record is not empty, all other fields in the portal row hide when this field is empty. The button puts a value into the given field and hence adds a new portal row and then hides for that row and all other fields become visible.
Just my two cents. There may well be better approaches but this one works nicely for me. 🙂
Johannes
Hi Johannes,
Thanks so much for your feedback, on my technique and on the other issue.
Of course, Thomas was asking how to not have that ghost row at all and there are various solutions to that but I think just scripting creating the record in the background works as good as any.
I agree your approach is a great alternative, if it’s an acceptable UI for the client/user/etc. and it often is. I’ve used something like that sometimes. Thanks for sharing it!
David.
Thanks, David. Been looking for something like this. Should be very handy. I’ll study your behind the scenes trick also.