TextBox: specified height size works locally, but isn't translated to pavlovia

Hi @chayabenyehuda, alright, cool, thanks for giving me access. While a permanent fix should be available with the upcoming release, for now you need to manually edit the main script to include the multiline attribute when instatiating the textbox component like you have very correctly done in this project.

I apologise for the inconvenience of having the program revert back that change each time you export HTML. Not sure how well it would fit your particular use case, but you have the option of telling PsychoPy to only export HTML on demand rather than on sync via the online settings tab as shown below,

Please let me know if you need more support, here to help, x

1 Like

thank you for the help! ill just change it right before I publish the project :slight_smile:

Dear @sawal, @PSYresearcher, @chayabenyehuda, OK PsychoPy latest now declares JS TextBox instances as multiline by default and no custom edits should be required to make the height setting work as expected. Please let me know if you hit any hurdles post upgrade, x

Hi

Yes the size is great but now i have a new problem described here:
I Got a strange textbox-issue in this experiment: the routine “welcome” registers a keyboard response, then continues to the textbox_2 routine, which presents an editable textbox. However, the textbox doesn’t record any text unless I click on the keys for a long time. If I remove the welcome routine, then it does.

Hi @chayabenyehuda, OK that needs fixing on our end, sorry. For now, I believe the following should work when placed in a Before Experiment custom code component tab:

core.Keyboard.prototype._addKeyListeners = function() {
  this._previousKeydownKey = undefined;
  const self = this;
  window.addEventListener("keydown", (event) => {
    if (event.repeat) {
      return;
    }
    const timestamp = util.MonotonicClock.getReferenceTime();
    if (this._status !== PsychoJS.Status.STARTED) {
      return;
    }
    self._previousKeydownKey = event.key;
    let code = event.code;
    if (typeof code === 'undefined') {
      code = core.EventManager.keycode2w3c(event.keyCode);
    }
    let pigletKey = core.EventManager.w3c2pyglet(code);
    self._bufferIndex = (self._bufferIndex + 1) % self._bufferSize;
    self._bufferLength = Math.min(self._bufferLength + 1, self._bufferSize);
    self._circularBuffer[self._bufferIndex] = {
      code,
      key: event.key,
      pigletKey,
      status: core.Keyboard.KeyStatus.KEY_DOWN,
      timestamp
    };
    self._unmatchedKeydownMap.set(event.code, self._bufferIndex);
    self._psychoJS.logger.trace('keydown: ', event.key);
    event.stopPropagation();
  });
}
1 Like

thank you! ill try it once Pavlovia will be up and running :slight_smile:

I have tried it now and it works nicely

Hi @sawal, @PSYresearcher, @chayabenyehuda, OK the newly released PsychoPy 2021.1.4 should now respect the size attribute on TextBox instances without JS patching, x