textbox.setHeight is not a function

URL of experiment: Sign in · GitLab

Description of the problem: I am programming a vision test where a letter (E) is presented at the center of the screen in varying orientations, and the user presses the arrow corresponding to the direction of the letter. The letter height should change according to performance. Before that I use the credit card code to determine screen size.

I am using the textbox, as I would like the letter to be anchored centrally, regardless of the orientation, and everything works fine, if I don’t change the letter size.

If I use a variable to change the letter size I get the error textbox.setHeight is not a function.

This is how I defined the textbox:

$orientation works properly, but thisSize does not.

Has anyone encountered a similar problem? Any suggestion on how I can solve it?

Thank you in advance
Sara

Hello everyone,

I was wondering if someone has encountered a similar problem. Despite many trials, I cannot seem to find a solution.
As a further update, this is the link to the experiment on Pavlovia

Also, not sure if this might be related to something else, but I noticed that, despite the project existing on Pavlovia, every time I synchronise from Psychopy I get the message that this is the first time synchronising.

Any help would be very much appreciated.
Best
Sara

Hello

Did your experiment work locally? I tried to set text-height, but the experiment never ran when I changed LetterHeight to update, neither when set to set every frame nor when set to set every repeat.

By the way, according to the help page, there is no setHeight attribute. There is only a getSize attribute. But these might not be up-to-date.

The Text-component also has a orientation-parameter. Would this component work for you? At least, you can change the letter height each frame or each repeat.

Best wishes Jens

Dear Jens,

Thank you for your suggestions. Indeed, it seems that the set every frame or set every repeat do not work, online or locally. The experiment runs fine if letter height is a constant.

I also notice there was no setHeight attribute in the help page, but since it was an option to have set every repeat in the builder, I tried and the automatic translation to JS used the setHeight attribute.

I did tried with the Text-component (that works fine), but I cannot figure out how to anchor the text position to center online (if I don’t, the letter not only changes size and orientation but also position, which is something I’d like to avoid), hence the switch to texbox.

I thought about correcting the position by half the letter size, but if I got it correctly, I would need half the height and width (not sure how to get the latter).

I guess the other option would be to use an image (i’ll have to figure out the minimum resolution somehow), potentially the only option I have, unless you have a different suggestion?

Thanks again for you help,
Best
Sara

Hello

There is a getSize parameter for TextBox2 and a setSize parameter, at least for TextBox2. TextBox is deprecated. Does setSize work instead of setHeight? You seem to need to manually edit the JavaScript file.

Did you use a monospaced font like Courier New in the text-component? If so, does it still change position?

Probably best to just use an image of a letter.

Best wishes Jens