April 10, 200619 yr 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?
April 10, 200619 yr 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.
April 21, 200619 yr 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
April 16, 201114 yr 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: 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
June 29, 201312 yr 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