Changing the text color not of values can be received


Author
Message
sharondan
sharondan
New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)
Group: Forum Members
Posts: 14, Visits: 94
Hi,
When changing the text color after the text object is created it seems that not all values can be received.
The following text can receive the colors #000000 //#696969 only in the moment of creation.
<text flickerPrimaryLow>
/ items = item.shapeItems
/ fontstyle = ("Arial", values.flickerFontSize)
/ txcolor = #000000 //#696969 This is working fine if it is done here 
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
/ erase = false
</text>

However, If we write later on write
text.flickerPrimaryLow.textcolor = #696969  //this is not working
This will make the stimulus disappear, but if we write 
text.flickerPrimaryLow.textcolor = #BEBEBE // this is working fine
This works fine

Note that if you change the color through the built-in color interface it works fine even for the "problematic values" 
text.flickerPrimaryLow.textcolor = black;     //correspond to #000000 and works fine
text.flickerPrimaryLow.textcolor = dimgray //correspond to #696969 and works fine

The problem with using the built-in colors is that the numbers of colors are limited, for instance, I need to use different shared of greys that unfortunately do not exist as built-in colors.

Thanks




Dave
Dave
Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)
Group: Administrators
Posts: 10K, Visits: 60K
sharondan - 10/9/2020
Hi,
When changing the text color after the text object is created it seems that not all values can be received.
The following text can receive the colors #000000 //#696969 only in the moment of creation.
<text flickerPrimaryLow>
/ items = item.shapeItems
/ fontstyle = ("Arial", values.flickerFontSize)
/ txcolor = #000000 //#696969 This is working fine if it is done here 
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
/ erase = false
</text>

However, If we write later on write
text.flickerPrimaryLow.textcolor = #696969  //this is not working
This will make the stimulus disappear, but if we write 
text.flickerPrimaryLow.textcolor = #BEBEBE // this is working fine
This works fine

Note that if you change the color through the built-in color interface it works fine even for the "problematic values" 
text.flickerPrimaryLow.textcolor = black;     //correspond to #000000 and works fine
text.flickerPrimaryLow.textcolor = dimgray //correspond to #696969 and works fine

The problem with using the built-in colors is that the numbers of colors are limited, for instance, I need to use different shared of greys that unfortunately do not exist as built-in colors.

Thanks




> The problem with using the built-in colors is that the numbers of colors are limited, for instance, I need to use different shared of greys that unfortunately do not exist as built-in colors.

This is easily resolved by setting the three color channels (R, G, B) separately.

<text example>
/ items = ("Example")
/ erase = false
</text>

<values>
/ r = -1
/ g = -1
/ b = -1
</values>

// will circle from black
through all possible shades of grey
to white
<trial example>
/ ontrialbegin = [
    values.r += 1;
    values.g += 1;
    values.b += 1;
    text.example.textcolorred = values.r;
    text.example.textcolorgreen = values.g;
    text.example.textcolorblue = values.b;
]
/ stimulusframes = [1=clearscreen, example]
/ trialduration = 25
/ validresponse = (0)
</trial>

<block myblock>
/ trials = [1-256 = example]
</block>



Dave
Dave
Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)Supreme Being (863K reputation)
Group: Administrators
Posts: 10K, Visits: 60K
Dave - 10/9/2020
sharondan - 10/9/2020
Hi,
When changing the text color after the text object is created it seems that not all values can be received.
The following text can receive the colors #000000 //#696969 only in the moment of creation.
<text flickerPrimaryLow>
/ items = item.shapeItems
/ fontstyle = ("Arial", values.flickerFontSize)
/ txcolor = #000000 //#696969 This is working fine if it is done here 
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
/ erase = false
</text>

However, If we write later on write
text.flickerPrimaryLow.textcolor = #696969  //this is not working
This will make the stimulus disappear, but if we write 
text.flickerPrimaryLow.textcolor = #BEBEBE // this is working fine
This works fine

Note that if you change the color through the built-in color interface it works fine even for the "problematic values" 
text.flickerPrimaryLow.textcolor = black;     //correspond to #000000 and works fine
text.flickerPrimaryLow.textcolor = dimgray //correspond to #696969 and works fine

The problem with using the built-in colors is that the numbers of colors are limited, for instance, I need to use different shared of greys that unfortunately do not exist as built-in colors.

Thanks




> The problem with using the built-in colors is that the numbers of colors are limited, for instance, I need to use different shared of greys that unfortunately do not exist as built-in colors.

This is easily resolved by setting the three color channels (R, G, B) separately.

<text example>
/ items = ("Example")
/ erase = false
</text>

<values>
/ r = -1
/ g = -1
/ b = -1
</values>

// will circle from black
through all possible shades of grey
to white
<trial example>
/ ontrialbegin = [
    values.r += 1;
    values.g += 1;
    values.b += 1;
    text.example.textcolorred = values.r;
    text.example.textcolorgreen = values.g;
    text.example.textcolorblue = values.b;
]
/ stimulusframes = [1=clearscreen, example]
/ trialduration = 25
/ validresponse = (0)
</trial>

<block myblock>
/ trials = [1-256 = example]
</block>



As to your other remarks,

<text example>
/ items = ("Example")
/ erase = false
/ txcolor = red
</text>

<trial example>
/ ontrialbegin = [
    text.example.textcolor = "#696969";
]
/ stimulusframes = [1=clearscreen, example]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1=example]
</block>

would seem to work perfectly fine for me



as does

<text example>
/ items = ("Example")
/ erase = false
/ txcolor = red
</text>

<trial example>
/ ontrialbegin = [
    text.example.textcolor = "#BEBEBE";
]
/ stimulusframes = [1=clearscreen, example]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1=example]
</block>


sharondan
sharondan
New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)New Member (38 reputation)
Group: Forum Members
Posts: 14, Visits: 94
Dave - 10/9/2020
Dave - 10/9/2020
sharondan - 10/9/2020
Hi,
When changing the text color after the text object is created it seems that not all values can be received.
The following text can receive the colors #000000 //#696969 only in the moment of creation.
<text flickerPrimaryLow>
/ items = item.shapeItems
/ fontstyle = ("Arial", values.flickerFontSize)
/ txcolor = #000000 //#696969 This is working fine if it is done here 
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
/ erase = false
</text>

However, If we write later on write
text.flickerPrimaryLow.textcolor = #696969  //this is not working
This will make the stimulus disappear, but if we write 
text.flickerPrimaryLow.textcolor = #BEBEBE // this is working fine
This works fine

Note that if you change the color through the built-in color interface it works fine even for the "problematic values" 
text.flickerPrimaryLow.textcolor = black;     //correspond to #000000 and works fine
text.flickerPrimaryLow.textcolor = dimgray //correspond to #696969 and works fine

The problem with using the built-in colors is that the numbers of colors are limited, for instance, I need to use different shared of greys that unfortunately do not exist as built-in colors.

Thanks




> The problem with using the built-in colors is that the numbers of colors are limited, for instance, I need to use different shared of greys that unfortunately do not exist as built-in colors.

This is easily resolved by setting the three color channels (R, G, B) separately.

<text example>
/ items = ("Example")
/ erase = false
</text>

<values>
/ r = -1
/ g = -1
/ b = -1
</values>

// will circle from black
through all possible shades of grey
to white
<trial example>
/ ontrialbegin = [
    values.r += 1;
    values.g += 1;
    values.b += 1;
    text.example.textcolorred = values.r;
    text.example.textcolorgreen = values.g;
    text.example.textcolorblue = values.b;
]
/ stimulusframes = [1=clearscreen, example]
/ trialduration = 25
/ validresponse = (0)
</trial>

<block myblock>
/ trials = [1-256 = example]
</block>



As to your other remarks,

<text example>
/ items = ("Example")
/ erase = false
/ txcolor = red
</text>

<trial example>
/ ontrialbegin = [
    text.example.textcolor = "#696969";
]
/ stimulusframes = [1=clearscreen, example]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1=example]
</block>

would seem to work perfectly fine for me



as does

<text example>
/ items = ("Example")
/ erase = false
/ txcolor = red
</text>

<trial example>
/ ontrialbegin = [
    text.example.textcolor = "#BEBEBE";
]
/ stimulusframes = [1=clearscreen, example]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1=example]
</block>


Thanks Dave!
That is wonderful. 
From your example, I've noticed that the number needs to be passed as a string.
Many thanks for solving this.
Sharon.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search