How to update text box colours multiple times per trial?


Author
Message
Ang
Ang
Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)
Group: Forum Members
Posts: 4, Visits: 18
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>
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
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.


Ang
Ang
Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)Associate Member (50 reputation)
Group: Forum Members
Posts: 4, Visits: 18
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!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search