Matrix Difficulties

A matrix to display a single vertical column of images is working very well for me in many ways. There have been a couple of stumbling blocks though that I just can’t seem to overcome.

When data is changed, the matrix won’t update unless I change the active record. ObjectAction “thumblist”,“redraw”,“all” doesn’t seem to do a thing. Neither does matrixredrawclickedcell in attempts to make clicking on the cell update the matrix.

The matrix frame updates, but the matrix itself does not.

I’ve also been unable to get the matrix to reflect the selected set of records. It alway displays all records, selected or not. Although I’ve tried every other conceivable combination of settings without success, the Data panel is set for Pass Thru with the Query set as info(“Selected”).

When data is changed, the matrix won’t update unless I change the active record. ObjectAction “thumblist”,“redraw”,“all” doesn’t seem to do a thing. Neither does matrixredrawclickedcell in attempts to make clicking on the cell update the matrix.

I’ve been having the same problem since beginning to work with PanX. ObjectAction “matrix name”,“redraw”,“all” does not work. I have taken to writing code that switches from data to graphics mode and back. It works most of the time but it is not ideal. I’ve been waiting for a solution.

There are clunky workarounds for forcing the refresh, but my inability to display just the selected records is a fairly serious issue for me. The ability may exist but I can’t come up with it and have been unable to find anything in the documentation making any reference to it.

I think you want to put info(“visible”) into your matrix selection formula to have it only show selected records

Much obliged. That worked.

I could have sworn I made that suggestion to you in a private email, and that you said it didn’t work. Which was why I hadn’t made that suggestion here – I figured I needed to research it further. Must have been someone else. So whomever you were, info(“visible”) is the correct answer!

You’re the source for info(“Selected”). You’re fallible after all. :stuck_out_tongue_winking_eye:

My troubles with the matrix continue…

I still can’t get a reliable refresh working to get the matrix to update a change made to the current record unless I move to another record and back. That is unless I have Sync Up/Down checked. Then the matrix does match changes to the record but creates a new problem in that it won’t stay off the first record. No matter how I navigate to another record, the first record always becomes the active record again. While trying to defeat that issue I found that I can reliably crash Panorama by unchecking Pass Thru, then clicking on the matrix.

Is there a bug in the matrix refresh or is there something I’m overlooking. I’ve been stalled for a month in trying to get a matrix to update what it displays for the current record when the data is changed.

The Matrix + Data Entry form in the Lists & Matrixes demo demonstrates the issue.

I have been waiting longer. I think it is an Apple bug, except that it works in graphic mode.

Yeah, the Refresh button in Graphics always works just fine.

I think this was something I mentioned back when I did the Matrix classes in 2016. This is simply not a feature that Matrix objects offer. I don’t consider this a bug, but rather a feature request.

Is there any way for a procedure to trigger the Refresh used in Graphics Mode?

The Refresh used in Graphics Mode does not refresh only the current record – it refreshes the entire Matrix object. It uses an undocumented statement, refreshmatrixes, to do this. I believe this will work in data mode, but it isn’t very selective – it refreshes every matrix object on the current form. It essentially does this by deleting the objects from the form and then immediately re-adding them.

You could do the essentially same thing for a single object by programmatically changing any object attribute that affects the data display, for example the formula.

When and how would “cell” or “all” work then? It seems that scrolling to another record or rebuilding the matrix is the only way to refresh a matrix. But if the matrix consists of records versus an array it can’t be rebuilt.

Here is the results of some experimenting with a simple matrix containing only a Image Display Object that I can change by changing the color formula from “%%000000” to something else and then figuring out how best to force the matrix to redraw.

First I want to get the current formula of the matrix which I have named myMatrix into a fileglobal named myFormula:

object "myMatrix"
myFormula=objectinfo("formula")

Next I want to use that variable to change the formula of the matrix slightly and then return it back again so that the matrix is forced to redraw:

changeobject "myMatrix","Formula",myFormula+" "
changeobject "myMatrix","Formula",myFormula

Yes, by simply adding a space to the existing formula and then removing it the matrix will update and redraw. Here is the example matrix redrawing when the Image Display Object’s color is changed:

Matrix%20Redraw

I appreciate the effort Gary, but the issue has been in trying to change the displayed data in a single cell of the matrix. In my screenshot at the outset of this thread I have photos in a vertical matrix that should show star ratings under each. As the rating is changed on the current record, I want the matrix to update to show the new rating. The matrix frame shows the new values, but the matrix doesn’t. Hiding changing formulas on the matrix frame hasn’t worked.

As I noted, the Matrix + Data Entry form in the Lists & Matrixes demo suffers the same issue. As you change the author or title of a book, the matrix remains static.

Still trying to figure out something…

I found a workaround: My file has a unique ID assigned to every record. Running a Find for the current record causes the matrix cell to refresh. There’s a short pause but it’s not bad and it is an otherwise invisible process.

Local lvID
lvID = ID
Find ID = lvID

FYI – in Panorama X, all files have unique ID’s built in to every record. This ID can be accessed with the info("serverrecordid") function. The function has “server” in the name because in Panorama 6, it only worked for files shared on the server. But in Panorama X, the unique id is maintained in all databases, both single and multi user.

So, I think you might find that this code will work:

let lvID = info("serverrecordid") 
find info("serverrecordid")  = lvID

Using the find statement triggers the same display mechanism as moving up/down a record, so it makes sense that the technique you discovered works. Sorry I didn’t think of it earlier.

For clarity sake it might not be a bad idea to now have an exact clone of info("serverrecordid") simply named info("recordid") so as not to confuse those working in single user mode. I know I pretty much ignore anything with “server” in the name because I just assume it does not pertain to my situation. I know, “never assume”. :roll_eyes: