Reply To: Displaying n words on screen

PennController for IBEX Forums Support Displaying n words on screen Reply To: Displaying n words on screen

#10573
Larissa_Cury
Participant

Hi, @Jeremy! [EDIT – UPDATE] I can display the words one below the other and the time seems to be ok (the whole trial is lasting the amount of time and not reseting time), but I’d like to avoid hard-coding this part:


 newButton("NEXT", "Next words!")
        .callback(  // use a callback to execute this in parallel to waiting for the timer
            getButton("NEXT").remove() // remove the NEXT button
            ,
            getText("words").text( row.Column2.split('_').join("<br>") ) // update the displayed list of words
        )
        .print()
        // do not wait for a click, otherwise the timer might elapse before the click
    ,

A) I’d like to be able to have *n* columns as I want displayed dynamically based on the dataframe number of cols in the wide version. Otherwise, I’ll have to hard-code this part *n* times according to the amount of cols of my dataframe.
B) Or, in the long version, I’d like to be able to print as many rows as I want, instead of hard-coding each interval manually.

Is there a way to do acheive either a or b? https://farm.pcibex.net/r/AqPhcF/

* Data:

DF: WIDE VERSION: ‘new–Items_Wide.csv”
DF: LONG VERSION: ‘new–items.csv”

* Whole code:


Template("new--Items_Wide.csv", row =>
  newTrial("listOfWords",
    newMediaRecorder("recorder").log().record()
    ,
    newTimer("recording", 3000).log().start()   // Start the timer now
    ,
    newText("words", row.Column1.split('_').join("<br>")) // separate each word with a <br> tag (new line)
        .cssContainer({
           padding: '0.5em',  // add some to not get too close to the border
          'text-align': 'center',   // trying to make the words center on fullscreen -- NOT WORKING :(
          'font-size': '50px',
          'position': 'absolute',  
          'top': '50%',
          'bottom': '50%',
          'left': '50%',
          'width': '100%'
        })
        .print()
    ,
    newButton("NEXT", "Next words!")
        .callback(  // use a callback to execute this in parallel to waiting for the timer
            getButton("NEXT").remove() // remove the NEXT button
            ,
            getText("words").text( row.Column2.split('_').join("<br>") ) // update the displayed list of words
        )
        .print()
        // do not wait for a click, otherwise the timer might elapse before the click
    ,
    getTimer("recording").wait() // wait for the timer to end
    ,
    getMediaRecorder("recorder").stop()
    ,
    getButton("NEXT").remove() // make sure to remove the button, in case the participant didn't get to the second list
    ,
    getText("words").remove()
    ,
    newText('a', "Time is up!").print()
    ,
    newButton('btn--finish--game', 'Finish Game').print().wait()
  )
);
  • This reply was modified 11 months, 2 weeks ago by Larissa_Cury.
  • This reply was modified 11 months, 2 weeks ago by Larissa_Cury.