Step 1: Delete the .CurrentRecord procedure.
Step 2: You need to add a database field to the formula. Once this is done, the text will automatically update whenever the current record changes.
Of course, you probably don’t want any database fields displayed in the Text Display objects. That’s fine, there are a couple of ways to manage this.
If you pick a text field, you can use a text funnel to strip out the text. This text funnel has negative length, so it will always result in empty text. However, since the formula now includes this field, it will automatically update whenever that field changes – including any time that the record changes. No code is needed.
arrayformula+Field[2,1]
Another way to do this is with the ignore( function:
arrayformula+ignore("",Field)
Or, you could do this:
ignore(arrayformula,Field)
If you just want the solution, you can stop reading. The rest of this post is just further background information.
What does “Array name” mean? If this is the name of a variable, this should work. But in that case, the variable isn’t going to change depending on what the current record is, so why would the display update? It’s just going to show the same variable’s contents no matter what the current record is.
If the “Array name” is a field, then it should already work without any further ado.
If the array needs to be calculated for each record, I would do that using a formula right in the Text Display object. You could use the callwithin( function if the code is complicated (but it better be FAST code with no side effects).
AAARG! DON’T DO THAT! This falls under “should not ever change the current window” - switching to graphics mode is essentially changing to a different window.
Hadn’t really thought of this before, but I suspect that showrectangle doesn’t work when display is deferred. This is only designed to be used with showvariables, showfields, etc.
However, I don’t think this is a problem. ShowRectangle is intended for use when you’ve changed the configuration of form objects, for example moving them, creating them, or deleting them. You shouldn’t be performing any of these operations in an implicitly triggered procedure.
Bottom Line - don’t use .CurrentRecord for this task, instead add a field to your formula as described above.