Millisecond Forums

How to update text box colours multiple times per trial?

https://forums.millisecond.com/Topic34208.aspx

By Ang - 4/18/2022

Hi everyone,

I am programming a sequence learning task where participants are presented with 4 grey boxes (arranged horizontally) and responds when a box turns red.
For the stimuli, I am using empty text boxes and changing the background colour to red, based on my sequence.
I know how to edit colour at the start of the trial but I would like to change the colour back to grey after 100 ms, but I don't know how and my current workaround is to present another grey box on top.
Is there a way to edit the colour of my text box at specific times during the trial? I've put example code below of what my trial looks like

Any help would be much appreciated!

Cheers,

An

<text box1>
    / items = ("")
    / fontstyle = ("Arial", parameters.box_size, false, false, false, false, 5, 1)
    / hposition = parameters.box1_x
    / vposition = parameters.box_y
    / size = (parameters.box_size, parameters.box_size)
    / txbgcolor = gray
    / erase = false
</text>

<text grey_box1>
    / items = ("")
    / fontstyle = ("Arial", parameters.box_size, false, false, false, false, 5, 1)
    / hposition = parameters.box1_x
    / vposition = parameters.box_y
    / size = (parameters.box_size, parameters.box_size)
    / txbgcolor = gray
    / erase = false
</text>

<trial experimental_trial>
/ ontrialbegin = [
    values.item_position = list.my_sequence.nextvalue;
    if (values.item_position == 1) {text.box1.textbgcolor = red}
    else if (values.item_position == 2) {text.box2.textbgcolor = red}
    else if (values.item_position == 3) {text.box3.textbgcolor = red}
    else if (values.item_position == 4) {text.box4.textbgcolor = red}
    ]
/ stimulustimes = [0 = box1, box2, box3, box4; 100 = grey_box1, grey_box2, grey_box3, grey_box4]
</trial>
By Dave - 4/19/2022

Ang - 4/19/2022
Hi everyone,

I am programming a sequence learning task where participants are presented with 4 grey boxes (arranged horizontally) and responds when a box turns red.
For the stimuli, I am using empty text boxes and changing the background colour to red, based on my sequence.
I know how to edit colour at the start of the trial but I would like to change the colour back to grey after 100 ms, but I don't know how and my current workaround is to present another grey box on top.
Is there a way to edit the colour of my text box at specific times during the trial? I've put example code below of what my trial looks like

Any help would be much appreciated!

Cheers,

An

<text box1>
    / items = ("")
    / fontstyle = ("Arial", parameters.box_size, false, false, false, false, 5, 1)
    / hposition = parameters.box1_x
    / vposition = parameters.box_y
    / size = (parameters.box_size, parameters.box_size)
    / txbgcolor = gray
    / erase = false
</text>

<text grey_box1>
    / items = ("")
    / fontstyle = ("Arial", parameters.box_size, false, false, false, false, 5, 1)
    / hposition = parameters.box1_x
    / vposition = parameters.box_y
    / size = (parameters.box_size, parameters.box_size)
    / txbgcolor = gray
    / erase = false
</text>

<trial experimental_trial>
/ ontrialbegin = [
    values.item_position = list.my_sequence.nextvalue;
    if (values.item_position == 1) {text.box1.textbgcolor = red}
    else if (values.item_position == 2) {text.box2.textbgcolor = red}
    else if (values.item_position == 3) {text.box3.textbgcolor = red}
    else if (values.item_position == 4) {text.box4.textbgcolor = red}
    ]
/ stimulustimes = [0 = box1, box2, box3, box4; 100 = grey_box1, grey_box2, grey_box3, grey_box4]
</trial>

> Is there a way to edit the colour of my text box at specific times during the trial?

No, so your workaround ("present[ing] another grey box on top") is the correct approach.

By Ang - 4/19/2022

Dave - 4/19/2022
Ang - 4/19/2022
Hi everyone,

I am programming a sequence learning task where participants are presented with 4 grey boxes (arranged horizontally) and responds when a box turns red.
For the stimuli, I am using empty text boxes and changing the background colour to red, based on my sequence.
I know how to edit colour at the start of the trial but I would like to change the colour back to grey after 100 ms, but I don't know how and my current workaround is to present another grey box on top.
Is there a way to edit the colour of my text box at specific times during the trial? I've put example code below of what my trial looks like

Any help would be much appreciated!

Cheers,

An

<text box1>
    / items = ("")
    / fontstyle = ("Arial", parameters.box_size, false, false, false, false, 5, 1)
    / hposition = parameters.box1_x
    / vposition = parameters.box_y
    / size = (parameters.box_size, parameters.box_size)
    / txbgcolor = gray
    / erase = false
</text>

<text grey_box1>
    / items = ("")
    / fontstyle = ("Arial", parameters.box_size, false, false, false, false, 5, 1)
    / hposition = parameters.box1_x
    / vposition = parameters.box_y
    / size = (parameters.box_size, parameters.box_size)
    / txbgcolor = gray
    / erase = false
</text>

<trial experimental_trial>
/ ontrialbegin = [
    values.item_position = list.my_sequence.nextvalue;
    if (values.item_position == 1) {text.box1.textbgcolor = red}
    else if (values.item_position == 2) {text.box2.textbgcolor = red}
    else if (values.item_position == 3) {text.box3.textbgcolor = red}
    else if (values.item_position == 4) {text.box4.textbgcolor = red}
    ]
/ stimulustimes = [0 = box1, box2, box3, box4; 100 = grey_box1, grey_box2, grey_box3, grey_box4]
</trial>

> Is there a way to edit the colour of my text box at specific times during the trial?

No, so your workaround ("present[ing] another grey box on top") is the correct approach.


Good to know, thanks Dave!