PennController for IBEX › Forums › Support › Two-screen trials?
- This topic has 7 replies, 3 voices, and was last updated 4 years, 2 months ago by kmoulton.
-
AuthorPosts
-
April 8, 2020 at 12:09 pm #5019suphasireeParticipant
Hello!
I want to design my experiment as two-screen trials: one screen displaying a sentence (participants press a space bar after they’re done reading), and then the next screen would display a comprehension question on that sentence (text input response).
My current code shows the sentence and the question, but they’re shown on the same page. How can I make the question appear on a separate screen?
///// Actual experiment PennController.Template( variable => newTrial( "experiment" , newTimer(500) .start() .wait() , defaultText .print() .center() , newText(variable.sentence) , newText("<br><br><br> <p>Press the spacebar to continue.</p>") .italic() , newKey(" ") .wait() , ///// How to make these next lines appear on a separate screen? newText("<p>Press Enter to submit your answer.</p> <br><br><br>") .italic() , newText("question", variable.question) , newTextInput("inputanswer") .print() .log() .wait() , newVar("answer") .set( getTextInput("inputanswer") ) .log( "SubjID" , getVar("ID") ) ) )
I have looked on the tutorials and documentation but I can’t find the answer to this question. Thank you in advance!
April 8, 2020 at 12:17 pm #5020JeremyKeymasterHi,
Simply use the .remove command on the Text elements that you no longer want on the new screen. It’s easier if you give them a name first, like this:
Template( variable => newTrial( "experiment" , newTimer(500) .start() .wait() , defaultText .print() .center() , newText("sentence", variable.sentence) // named your Text element 'sentence' , newText("pressspace" , "Press the spacebar to continue.") // named your Text element 'pressspace' .css("margin-top", "2em") // cleaner than 3 br's .italic() , newKey(" ") .wait() , getText("sentence").remove(), // remove your Text elements getText("pressspace").remove() // here , newText("Press Enter to submit your answer.") .css("margin-bottom", "2em") // same thing as above .italic() , newText("question", variable.question) , newTextInput("inputanswer") .print() .log() .wait() , newVar("answer") .global() // I suspect you want to make this global so you can use it in another log below .set( getTextInput("inputanswer") ) ) // this parenthesis should be here .log( "SubjID" , getVar("ID") ) ) // this one remains here
Jeremy
April 8, 2020 at 12:23 pm #5021suphasireeParticipantHi Jeremy,
Thank you so much for your prompt response and for your helpful edits, I appreciate it!
I have another question please. On the question screen, ideally I want the text “Press Enter to submit your answer” to appear below the TextInput box. However, when I move that newText line to be below the newTextInput line, that text disappears. I’m guessing that’s because the program is waiting on the participant to type an input, and delays showing that text.
Is there another way to show that text below the text box, even before participants type their response?
April 8, 2020 at 12:26 pm #5023JeremyKeymasterYes, just decouple the printing of the TextInput from its wait command, like this:
newTextInput("inputanswer").print().log() , newText("Validate by pressing Enter").italic().print() , getTextInput("inputanswer").wait()
Jeremy
April 8, 2020 at 1:13 pm #5027suphasireeParticipantPerfect, thanks so much for your help!
August 7, 2020 at 7:05 pm #5896kmoultonParticipantCan you get rid of a Canvas this way? (or the border of the canvas?). I have my question formatted in a canvas with a border around it but I can only seem to get the text to disappear with .remove(): getCanvas(“stimbox”).remove() is probably gibberish.
August 7, 2020 at 9:23 pm #5902JeremyKeymasterCalling remove on any element should remove it from the screen, however it was added. Example:
newTrial( newCanvas("container", 400, 400) .css('background-color','lightblue') .add( "center at 50%" , "middle at 50%" , newText("my text") ) .print() , newButton("remove text").print().wait().remove(), getText("my text").remove() , newButton("remove canvas").print().wait().remove(), getCanvas("container").remove() , newButton().wait() )
Note that removing a Canvas will remove the elements it contains along with it
If you added a border to the Canvas through CSS, you can simply overwrite its border property using .css("border", "none") on the Canvas element
Jeremy
August 8, 2020 at 8:12 pm #5904kmoultonParticipantWoohoo! Thanks (I probably did something dumb when i tried this)
-
AuthorPosts
- You must be logged in to reply to this topic.