Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Highlight current record in List View

Featured Replies

I found a freebie at NightWind which demonstrates the technique (highlighting the current record in List View), but some of it escapes me.

Here's what I did glean from Nightwind's demo:

In my case I want the background of the current record to be a color, so I'll use that example. I place a Calculation field on the layout that's the width and height of the row, and plop the data fields on top of that. The Calc field is defined thusly, using pseudocode:

If ( Get(RecordID) = the i.d. of the current record )

then {return a Container with the image for the highlight}

else {return nothing}

For "i.d. of the current record" they use a global variable ($$ActiveRecordID) that is set during the calculation of the Record x of y field. This is magic to me, and it's not explained: isn't this solution highly dependent on the order in which objects are rendered for display? $$ActiveRecordID had better be set correctly *before* the individual rows in the list are rendered, or we'll highlight the wrong row. That means Record x of y must be rendered before the rows are rendered. How is that controlled? Position on page? Tab order? Is there a solution that doesn't depend upon a companion calculation field to work correctly?

I don't know if my question is sufficiently clear or not. Anybody?

Record lighlighting systems only work when the user runs a script which sets the record id into a global field (or in this case for FMP 8 and later, a global variable) from where a calculation can display the graphic. This script is attached to a button covering the record row that has to be clicked on.

If the current record can be changed without clicking on the row button -- like using keyboard shortcuts or the notebook in the status area -- then the highlight won't change to follow the current record.

  • 2 weeks later...

This was a problem that took me a long time and a lot of research to solve. Here's a sample of what I came up with. It uses the free FM Example plugin that comes with FM 7 Developer and FM 8 Pro Advanced. It has the added advantage that it works with any method of record selection (not just clicking but also moving up or down with keyboard commands).

hilite_test.zip

  • 2 weeks later...
  • Author

Thanks, Jeep, that seems to work fine for my purposes.

  • 4 years later...
  • Newbies

Tried to use the sample file, but it didn't work on FMPA11; I tweaked it a bit and got it working nicely.

Procedure:

  1. Create a global field
  2. Create a script that sets the global field with the result of "Get ( RecordID )" (using SetField)
  3. Bind the script to the OnRecordLoad trigger of the layout
  4. Apply conditional formatting on a text element (or field) using the formula "Get ( RecordID ) = layout::globalField"

I've attached the modified version below, should anyone need it :).

hilite test.zip

  • 2 years later...

Jedihe:

 

The calc_Trigger calculation field has a missing function in your .zip file--what is it? Thanks.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.