"No Holding Back FileMaker Blogging"


Navigation:


Support this site by clicking on a sponsor below or becoming a patron!



Document Management Videos



Become a patron of this FREE web site!


Recent Blogs:

Currency Formatting
Currency Formatting

Gathering Portals
Gathering Portals

Multiple Choice Picker
Multiple Choice Picker

Popups and Pickers
Popups and Pickers

Window Locking
Window Locking


Meta-Consulting
Meta-consulting is a service Database Pros offers to help other developers over programming hurdles via GoToMeeting. Email John Mark Osborne or call John Mark at (909) 393-4664 to find out more about this service.


Create a Complete Contact Manager


Quick Tip:

Nudge 10 Pixels/Points
One of my favorite new features in FileMaker Pro Advanced 18 is the ability to nudge objects in layout mode 10 pixels/points at a time. You've always been able to move objects one pixel/point at a time using the arrow keys on the keyboard but now you can throw in the Shift key and nudge them 10 pixels/points at a time. I use it when I want to object to move in one direction horizontally or vertically. The mouse is just not accurate enough and often ends up moving the object both horizonally and vertically.



FileMaker 20 Video Tutorials


Fun Stuff:

FileMaker Developer Worthiness
Top 10 ways you know your developer is NOT worthy:
  1. Spells "FileMaker" with a lowercase "m"
  2. Uses inches or centimeters instead of points in Inspector
  3. Recommends WebDirect deployment over FileMaker Pro
  4. Creates a solution with one file for every table
  5. Doesn't know Claris and FileMaker, Inc. are the same company
  6. Isn't certified for latest version of FileMaker
  7. Isn't an FBA member
  8. Charges less than $100.00 per hour
  9. Uses a rainbow of colors on his interface
  10. Provides a quote without a requirements document



Fireside FileMaker Podcast







RSS Feed
Window Naming
Level: Advanced
Version: FileMaker 16
Category: Scripting
Tuesday, July 11, 2017
So, what's wrong with the default window name given by FileMaker? Imagine a user of your solution has multiple windows spawned on a small screen and goes to the Window menu to select the desired window. Without good window management, all he sees is "CONTACTS", "CONTACTS - 2", "CONTACTS - 3" and so on. With good window management, you can make it easy for users to quickly find the window they want without cycling through all of them.

Window Naming

In the last couple of years, I've adopted a technique for naming windows that's fairly dynamic. Rather than hard coding the window name from each script as needed, I prefer to use a combination of a single script, script trigger and a calculation field. I still name some windows via a specific script, such as a window containing a report since it doesn't change from record to record, but standard form and list view layouts are handled automatically by a script trigger.

The Calculation Field
Start by creating a calculation field that results in the text you want in the window title. The calculation result should change based on the record currently showing. I also like to include the table name. For example, a formula for a contact manager might be as follows:

"CONTACTS: " & name_first & name_last

Name the calculation field "window_title" to correspond with the terminology in FileMaker. Each table should have their own unique "window_title" field. For example, an invoicing solution might use:

"INVOICES: " & invoice_num

I usually copy and paste the field from table to table and make the corresponding text and field changes. It only takes a minute.

The Script
The script is only one line, using the Set Window Title step.

Set Window Title [Current Window; New Title: GetField(Get(LayoutTableName) & "::window_title")]

The calculation formula is entered in the Rename Window section of the Set Window Title dialog.

Window Naming

The GetField function requires a single parameter, specifying a table and field name in order to return the contents of that field. The table name needs to be supplied since script context requires it.

The Trigger
The OnRecordLoad trigger is ideal for this solution as it renames the window every time the record changes.

Window Naming


If you want the window name to update on new records as you fill out the fields, you'll also need to attach the script to every field referenced in the calculation using OnObjectExit. Otherwise, new record window titles will remain blank till they are navigated to again.

The only issue I have encountered is a conflict between OnRecordLoad and scripted finds. OnRecordLoad fires when transitioning from find to browse mode. This occurs after the Perform Find step, triggering the window naming script. This interrupts the find script, causing any errors that result from the find to be erased by the triggered script. The workaround is to test for not records found with Get(FoundCount) instead of Get(LastError).

Window Naming

My Approach
I like to design my first layout with this trigger already attached. Then, all I have to do is add the calculation field to any new table, duplicate the layout and make the necessary changes interface for the current table. This is a simple but effective technique for making sure all windows are named uniquely and cuts down on user frustration, mostly for power users who like to have multiple windows open at the same time.

Author:
John Mark Osborne
jmo@filemakerpros.com
www.databasepros.com

This blog is completely free. Please support it by clicking on one of the advertisers at the left side of the window or becoming a patron. Thanks so much!

Add Comment:

First Name: *
Last Name:
Email: *
Web Site:
Comment: *
 Email Addresses will not be shared on the web site!