|
How do you find the screenspace position of a SelectionGrid element that is clicked?
(comments are locked)
|
|
It's pretty simple. You just feed the int you get back from the function into the string array you give to the function, like this: Sorry What I meant and what I think ina meant was the actual rect position that the selected button in the grid is at. Not the position of the grid itself or the index of of the selected option. Sorry for any confusion.
Jun 20 '11 at 04:05 PM
HHameline
Well, you could divide the number of elements by the width of buttons to get the number of rows, then partition the original rect into that many rows. Then, if the partitioned rects are in the same order as the original setup, you can just feed the index into that. I will give sample code in a bit.
Jun 20 '11 at 04:08 PM
ckfinite
Ok, that's what I have happening now, I'm just going to be making a lot of the grids over the next few days and I was wondering if there was a nice built in way to do it that I hadn't found. I'll just keep my script nice and dynamic :P thanks for the help
Jun 20 '11 at 04:12 PM
HHameline
(comments are locked)
|
|
If you have a list of eg. buttons inside your grid, I would take the selection-value from the Grid and multiply it with the pixelheight of the button-style. This might be 25 pixels or something. Would that work or are your content of different heights?
(comments are locked)
|

I would like to know the answer to this question too :/ any hits yet?