## Relative Item Positioning?

##### Relative Item Positioning?
 Author Message Marcel posted 6 Years Ago ANSWER Group: Forum Members Posts: 9, Visits: 121 Hi,I was wondering whether a method exists to position items relative to other items?Failing that, what would be best practice to position items in one and two dimensions such that items are equidistant or spaced by a fixed amount? In the example below the gap between items increases with the length of the item. Is there a way to access the greatest value of the x coordinate and then just add a fixed value for the spacing? Or a general formula for converting the length of the item into px? /inputdevice = mouse/currentX = 100/yPosString = "300px"/xPosString = ""/items = ("Short", "Longer", "MuchLonger")/ selectionmode = sequence/items = ("Short", "Longer", "MuchLonger")/selectionmode = sequence/items = ("thirdWord")/selectionmode = sequence/onprepare = [   values.xposstring = concat(values.currentx, "px")]/items = ("<%list.firstWord.nextvalue%>")/position = (values.xposstring, values.yposstring)/onprepare = [   values.currentX += (15 * length(text.parta.currentitem)) ;            values.xposstring = concat(values.currentX, "px")]/items = ("<%list.secondWord.nextvalue%>")/position = (values.xposstring, values.yposstring)/onprepare = [   values.currentX += (15 * length(text.partb.currentitem)) ;            values.xposstring = concat(values.currentX, "px")]/items = ("<%list.thirdWord.nextvalue%>")/position = (values.xposstring, values.yposstring)/stimulusframes = [1=partA, partB]/validresponse = (partA, partB)/ontrialend = [values.currentx = 100]/stimulusframes = [1=partA, partB, partC]/validresponse = (partA, partB, partC)/ontrialend = [values.currentx = 100]/ trials = [1-3=q1; 4-6=q2] ThanksMarcel Dave posted 6 Years Ago ANSWER Group: Administrators Posts: 10K, Visits: 59K Yes, you can position elements relative to other elements. First, you'll want to specify an appropriate /size for your stimulus elements. You can then use the elements' width, height, hposition and vposition properties to place other elements relative to each other via expressions in their respective /hposition and /vposition attributes.For testing purposes, I would also recommend setting /txbgcolor to get a visual impression of the bounding rectangle and be able to see what's going on on-screen. You my also want to utilize the /hjustify and /vjustify attributes to change an items placement relative to its stimulus element's bounding rectangle.Also, if you ultimately want to do position and size calculations based on a string's length(), you should use a fixed-width (i.e., monospace) font for consistent results.

#### Merge Selected

Merge into selected topic...

Merge into merge target...

Merge into a specific topic ID...

#### Login

 Login Remember Me Reset Password Resend Validation Email