On vacation, waking up to a dreary Pennsylvania morning…
I found myself staring at the OS X Address Book and wondering, “how did they do this?” I couldn’t help compare this little application to the many FileMaker-based contact management solutions I have seen, and concluding, a bit sadly, Apple’s is nicer.
Now, comparisons between OS X-native code and FileMaker Pro are not always fair to begin with. However, I felt the Address Book presented some useful ideas and perhaps a starting point for a different kind of FM-based contact management solution—one that looks and behaves more like Address Book!
So the journey began…
Got white space? Hiding the portal scroll bar…
Once I got started, I realized I would need to work on making FileMaker Pro feel different. Because I really like all the white space of Address Book, one of the first items I tackled was how to make the portal scroll bar disappear if there were no additional records to display.
Assuming the portal position is set to enlarge vertically and show additional portal rows, here’s a custom function I came up with:
cf_HidePortalScroll ( dph; dprc; dwch; id_portalRecord ) /* cf_HidePortalScroll ( dph; dprc; dwch; id_portalRecord )
Use in Conditional Formatting on transparent object
placed over portal scroll bar, so if Result is “1” make
the object Fill = White (hides portal scroll bar)
Assumes portal is set to enlarge vertically while
maintaining original row height – i.e. display
additional portal rows when it grows vertically.
Dependencies:
Portal Layout Object Size
Default # of Portal Rows Displayed
Default WindowContentHeight
Road Map:
dph = default portal height as layout object
dprc = default portal row count
dwch = default window content height
id_portalRecord = ID_Field in Related Portal Table
*/ Let ( [ hpr = dph/dprc ; // height per portal row tdr = Count ( id_portalRecord ) ; // total portal rows with data cwch = Get ( WindowContentHeight ) ; // current window content height diff = cwch - dwch ; // has window content height changed from default? tvr = If ( diff ≥ hpr ; ( diff / hpr ) + dprc ; 0 ) ; // total visible rows, has content grown > one row's height? hr = tdr - tvr // if hidden rows exist, don't hide portal ] ; If ( hr > 0 and tdr > dprc ; "" ; 1 ) ) // end let
Afterwards, I found that others had tackled this particular problem before me, but I still like my custom function best—easy to grok, very quick to implement, and doesn’t rely on object names. It doesn’t work with filtered portals, and it does rely on the physical size of portal object, and number of rows displayed in layout. It also depends on the default WindowContentHeight, so please adjust the sizing to fit your needs.
-David