Mandu Posted April 10, 2006 Posted April 10, 2006 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?
Vaughan Posted April 10, 2006 Posted April 10, 2006 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.
Jeep Watson Posted April 21, 2006 Posted April 21, 2006 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
Mandu Posted April 30, 2006 Author Posted April 30, 2006 Thanks, Jeep, that seems to work fine for my purposes.
Newbies jedihe Posted April 16, 2011 Newbies Posted April 16, 2011 Tried to use the sample file, but it didn't work on FMPA11; I tweaked it a bit and got it working nicely. Procedure: Create a global field Create a script that sets the global field with the result of "Get ( RecordID )" (using SetField) Bind the script to the OnRecordLoad trigger of the layout 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
Rich S Posted June 29, 2013 Posted June 29, 2013 Jedihe: The calc_Trigger calculation field has a missing function in your .zip file--what is it? Thanks.
Recommended Posts
This topic is 4164 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