You can put almost any kind of object in a matrix frame, including buttons, checkboxes, and text editors. However, you’ll find that clicking on any of these objects doesn’t do anything. This is because these objects aren’t actually there – Panorama has created “fake” objects that are displayed within the matrix, but the real object is still down in the frame.

The matrix object itself can have a procedure associated with it. When you click on the matrix, this is the code that gets executed. It doesn’t matter where you click within the matrix, this procedure will run when you click.

Here is what happens when the matrix is clicked. It doesn’t matter where within the matrix object is clicked, the Buy button, the text, the star, wherever.

In many cases I’m sure you will wish that clicking on the “fake” objects inside the matrix would actually run the code associated with the actual corresponding object in the template. It turns out in Panorama X this is pretty easy to do – just put this one line program in the matrix procedure. The matrixclick statement figures out what “fake” object you clicked on, and whether the corresponding template object has any code. If there is any code, it runs the code.

I can add some code to the Buy button, just like I normally would.

When I click on the button, the code runs. If I click anywhere else in the matrix, nothing happens, because none of the other objects have any code.

It’s important to keep in mind that even though the code is running, the button isn’t working as it normally would. For example, it doesn’t highlight when you click on it, and the code runs immediately when you click, not when you release the mouse, the way it normally would. This is because it is a fake object, not the real thing. Panorama is just simulating the object, so normal object behavior won’t happen. Because of this, you can’t, for example, put a Text Editor object in the matrix and expect to edit text. The text will display, but you can’t edit.

If I put a pop-up menu in the matrix, it won’t work, but I can make a pop-up menu appear with a bit of code in this Text Display Object (see the popupclick statement).

When I click on the Text Display object in the matrix the pop-up menu appears.

Matrix Click Information

Your program will often need to know some information about what matrix item was clicked. Panorama X has several functions that can help you with these details.

Function Result
info(“matrixrow”) Clicked row number (1..N)
info(“matrixcolumn”) Clicked column number (1..N)
info(“matrixcell”) Clicked cell number (1..N)
info(“matrixcelldata”) Data associated with the current cell
info(“matrixclickedframe”) Section that was clicked on (Body, Header or Corner)
info(“matrixclickedobjectid”) Object ID of object inside frame that was clicked on (or zero if none).
info(“matrixclickedobject”) Object name of object inside frame that was clicked on (or “” if none).

info(“matrixrow”)

The info(“matrixrow”) function tells you what row was clicked on.

info(“matrixcolumn”)

The info(“matrixcolumn”) function is useful when you’ve created a multi-column matrix, like this.

You might think that you could use the info(“matrixcolumn”) function like this to tell which object you clicked on. But that won’t work. (I’ll show you what will work for this in a moment.)

It doesn’t work because as far as Panorama is concerned, this is all just one column.

info(“matrixcell”)

The info(“matrixcell”) function identifies cells without regard to rows and columns, simply numbering them from 1 up to the total number of cells. This is usually the most useful function. Normally the ordering of cells is horizontal, as shown here.

The cells can be switched to a vertical order, as shown here. However, vertical order does not work with a scroll bar.

info(“matrixcelldata”)

The info(“matrixcelldata”) function returns the data associated with the cell.

Panorama gets this data by calculating the formula associated with the matrix object, then splitting the result by the separator character.

If the matrix has the Pass Thru option set and has no formula (see Matrix Database Integration, the info(“matrixcelldata”) function won’t return anything. In that case, you can simply use the field values directly.

info(“matrixclickedobjectid”)

If you use the matrixclick statement described earlier on this page, you probably don’t care about exactly what the ID is of the object that was clicked on, matrixclick takes care of executing the code in the clicked object for you. But if you do need to know, the info(“matrixclickedobjectid”) function will tell you.

In combination with the objectinfo( function, the info(“matrixclickedobjectid”) function allows you to retrieve all the attributes of the clicked object.

Using this code you can click on different objects inside the matrix and the program will display all of the attributes of the object that was clicked on. Of course instead of dumpdictionary( which simply lists all attributes, you would normally use the getdictionaryvalue( function to retrieve specific values you are interested in.


See Also


History

VersionStatusNotes
10.0NewNew in this version.