﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Millisecond Forums » Millisecond Forums » Inquisit 4  » Relative Item Positioning?</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Sat, 04 Jul 2026 11:28:12 GMT</lastBuildDate><ttl>20</ttl><item><title>Relative Item Positioning?</title><link>https://forums.millisecond.com/Topic12489.aspx</link><description>Hi,&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;I was wondering whether a method exists to position items relative to other items?&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;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?&amp;nbsp;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;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?&amp;nbsp;&lt;/div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;defaults&amp;gt;&lt;/div&gt;&lt;div&gt;/inputdevice = mouse&lt;/div&gt;&lt;div&gt;&amp;lt;/defaults&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;values&amp;gt;&lt;/div&gt;&lt;div&gt;/currentX = 100&lt;/div&gt;&lt;div&gt;/yPosString = "300px"&lt;/div&gt;&lt;div&gt;/xPosString = ""&lt;/div&gt;&lt;div&gt;&amp;lt;/values&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;list firstWord&amp;gt;&lt;/div&gt;&lt;div&gt;/items = ("Short", "Longer", "MuchLonger")&lt;/div&gt;&lt;div&gt;/ selectionmode = sequence&lt;/div&gt;&lt;div&gt;&amp;lt;/list&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;list secondWord&amp;gt;&lt;/div&gt;&lt;div&gt;/items = ("Short", "Longer", "MuchLonger")&lt;/div&gt;&lt;div&gt;/selectionmode = sequence&lt;/div&gt;&lt;div&gt;&amp;lt;/list&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;list thirdWord&amp;gt;&lt;/div&gt;&lt;div&gt;/items = ("thirdWord")&lt;/div&gt;&lt;div&gt;/selectionmode = sequence&lt;/div&gt;&lt;div&gt;&amp;lt;/list&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;text partA&amp;gt;&lt;/div&gt;&lt;div&gt;/onprepare = [&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;values.xposstring = concat(values.currentx, "px")]&lt;/div&gt;&lt;div&gt;/items = ("&amp;lt;%list.firstWord.nextvalue%&amp;gt;")&lt;/div&gt;&lt;div&gt;/position = (values.xposstring, values.yposstring)&lt;/div&gt;&lt;div&gt;&amp;lt;/text&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;text partB&amp;gt;&lt;/div&gt;&lt;div&gt;/onprepare = [&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;values.currentX += (15 * length(text.parta.currentitem)) ;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;values.xposstring = concat(values.currentX, "px")]&lt;/div&gt;&lt;div&gt;/items = ("&amp;lt;%list.secondWord.nextvalue%&amp;gt;")&lt;/div&gt;&lt;div&gt;/position = (values.xposstring, values.yposstring)&lt;/div&gt;&lt;div&gt;&amp;lt;/text&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;text partC&amp;gt;&lt;/div&gt;&lt;div&gt;/onprepare = [&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;values.currentX += (15 * length(text.partb.currentitem)) ;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;values.xposstring = concat(values.currentX, "px")]&lt;/div&gt;&lt;div&gt;/items = ("&amp;lt;%list.thirdWord.nextvalue%&amp;gt;")&lt;/div&gt;&lt;div&gt;/position = (values.xposstring, values.yposstring)&lt;/div&gt;&lt;div&gt;&amp;lt;/text&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;trial q1&amp;gt;&lt;/div&gt;&lt;div&gt;/stimulusframes = [1=partA, partB]&lt;/div&gt;&lt;div&gt;/validresponse = (partA, partB)&lt;/div&gt;&lt;div&gt;/ontrialend = [values.currentx = 100]&lt;/div&gt;&lt;div&gt;&amp;lt;/trial&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;trial q2&amp;gt;&lt;/div&gt;&lt;div&gt;/stimulusframes = [1=partA, partB, partC]&lt;/div&gt;&lt;div&gt;/validresponse = (partA, partB, partC)&lt;/div&gt;&lt;div&gt;/ontrialend = [values.currentx = 100]&lt;/div&gt;&lt;div&gt;&amp;lt;/trial&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;block test&amp;gt;&lt;/div&gt;&lt;div&gt;/ trials = [1-3=q1; 4-6=q2]&lt;/div&gt;&lt;div&gt;&amp;lt;/block&amp;gt;&amp;nbsp;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;br/&gt;&lt;/div&gt;Thanks&lt;div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;Marcel&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description><pubDate>Mon, 03 Mar 2014 01:38:39 GMT</pubDate><dc:creator>Marcel</dc:creator></item><item><title>RE: Relative Item Positioning?</title><link>https://forums.millisecond.com/Topic12491.aspx</link><description>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.&lt;div&gt;&lt;br/&gt;&lt;/div&gt;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.&lt;br/&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;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.&lt;br/&gt;</description><pubDate>Mon, 03 Mar 2014 01:38:39 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>