Info("matrixrow") not acting the way I expected

The Help page says “The info(“matrixrow”) function returns the current row number within a matrix object.” But I don’t think that is 100% correct.

In a TextList object that has DatabaseNavigator enabled, the value of info(“matrixrow”) persists after closing the window or deselecting any rows in the text list. For my purposes, it would be better if info(“matrixrow”) returned to zero when the TextList was closed or changed so that no rows were selected, but I don’t know if there is some reason why the current behavior is better overall.

I discovered this because I want to know if any row is selected in a text list. At first, I thought that I could use info(“matrixrow”) to test for this, but that is not completely reliable. Does anyone have a way to find out if any row is selected in a text list, as opposed to no row selected?

The value info(“matrixrow”) function is only defined for the duration of the procedure that was triggered by clicking on the text list or matrix. Once that procedure is finished, the value of this function is not defined. (What it actually does currently is remain the same until you click on another text list or matrix. Though that probably will not change in future versions, it is not guaranteed, and you shouldn’t assume that.)

The correct way to find out what row is selected is to examine the variable that is linked to the object. If you need to know the row number, you can use look up this value in the array that is used to build the text list or matrix. But in your case it looks like you just want to know if any row is selected, so you could just check if the variable is empty (""). That doesn’t solve the problem if the window is closed – you would have to keep track of that separately. I guess you would use info(“windows”) to check if the window was currently open.