Matrixbutton Error


#1

I have the following code in a TDO used in a matrix. It is not working. I get the error
"The form object targeted by the ObjectAction statement does not support this action: HITOBJECT."

I am trying to determine the rectangle of the matrix cell so I can move another object to that rectangle location.

local vCLICKBUTTON,vBUTTONRECTANGLE

vCLICKBUTTON="“
vBUTTONRECTANGLE=”"

matrixbutton vCLICKBUTTON,vBUTTONRECTANGLE

message str(vCLICKBUTTON)


#2

You can’t put this code in a Text Display object, it has to go into a matrix object. In fact, there must be something else wrong because code you put in a Text Display object in a matrix generally won’t execute at all.

In any case, the matrixbutton statement is obsolete – I wouldn’t use it in anything new. I think what you want is the info(“matrixclickedobjectid”), then you can use the objectinfo( function to get the rectangle.

so I can move another object to that rectangle location

I’m really wondering what you mean by this. It doesn’t sound like something you really want to do in most cases, because the position of a matrix cell is usually not fixed.


I’m working on the HTML documentation for Text List and Matrix objects right now. In the meantime, I know that you (@goMiddleton) have access to the videos, so I would recommend that you review the section of the Matrix class on Matrix Click Information, or at least look at the PDF of the slides. It’s about 1/3rd of the way thru Matrixes.pdf


#3

Hi Jim,

I am hoping to get the coordinates of the specific matrix cell that was clicked. Your suggestion worked great to get the location of the matrix object, how do I drill that down to the cell?


#4

My suggestion did tell you how to drill down to the cell – perhaps you didn’t get far enough into the Matrix Click Information section of the slides.


#5

I am getting closer, what coordinates does this generate with a matrix object?

rectanglesizestr(objectinfo(“rectangle”),info(“matrixcell”)))


#6

It will generate an error, because the rectanglesizestr( function only allows 1 parameter, you’ve given it two.

I think what you are looking for is:

objectinfo("rectangle",info("matrixclickedobjectid"))

which will return a rectangle in form relative co-ordinates.

I wish, though, that you would tell us what you are trying to do, because I suspect that it is not possible.


#7

I would like to try one more thing, then I will explain.