How to present two lines on one page?

PennController for IBEX Forums Support How to present two lines on one page?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4989
    JunLyu
    Participant

    Dear Jeremy,

    I want to present two sentences on one page such that the first sentence is presented as a whole chunk with the second sentence presented word by word on the second line. An example is as follows:

    “Today is a very nice day!” (presented first but hidden by “__” after presentation)
    “So, I went outside for a walk.” (presented word by word)

    Is there a way that can accomplish this? I know that in Ibex, the whole sentence would be put in [“word1”, “word2”, …]. So if there is a way to break line, it would solve the problem. I’m not sure if PC Ibex (and Ibex as well) can make this happen.

    Many thanks!!!

    Jun

    #4991
    Jeremy
    Keymaster

    Hello Jun,

    Yes, one option would be to inject the native-Ibex DashedSentence controller in a PCIbex trial, like this:

    newTrial(
      newText("context", "Today is a very nice day!")
        .css('font-family', 'monospace')
        .center()
        .print()
      ,
      newText("instructions", "

    Press Space to start reading the next sentence

    ").italic().print() , newKey(" ").wait() , getText("instructions").remove() , getText("context").text("_____ __ _ ____ ____ ____") , newController( "DashedSentence" , {s: "So, I went outside for a walk.", display: "in place"} ) .print() .wait() )

    More info on the DashedSentence controller in the original Ibex documentation

    Jeremy

    • This reply was modified 3 years, 11 months ago by Jeremy. Reason: Tried to make the example closer to what was described
    #4994
    Jeremy
    Keymaster

    Sorry, posting a new message because after re-reading your message I think I just realized that you want something slightly different. Would you be OK with having two DashedSentence back-to-back, like this?

    newTrial(
      newController( "DashedSentence" , {s: ["Today is a very nice day!"]} )
        .print()
        .wait()
        ,
      newController( "DashedSentence" , {s: "So I went outside for a walk."} )
        .print()
        .wait()
    )
    #4995
    JunLyu
    Participant

    Thanks so much Jeremy! If I understand correctly, in PCIbex, I don’t need to specify the size of the word or phrase by including them in “”. So in your code with “DashedSentence” command, each word in “Today is a very nice day!” will be presented based on space, correct? Also, by adding a new controller, the two sentences can be presented on the same page now, yes? If so, then how do I, say, present the first sentence in its entirety? So, basically, a participant sees the whole chunk “Today is a very nice day!”, followed on the second line by “So”,”I”,”went” … in a word-by-word fashion?

    Jun

    #4997
    Jeremy
    Keymaster

    The code in my second message actually already does what you describe: it presents the sentence “Today is a very nice day!” as a whole chunk, and the second sentence word-by-word

    This is actually how the DashedSentence controller works by default in Ibex: if you take a close look at the s parameter, the first time it is an array of one element (that element being the string) whereas the second time it is a string, directly (no square brackets). When the parameter is an array, every element is presented as a chunk, but when the parameter is directly a string, it is split using the space character and each word (separated by a space) is a chunk.

    Jeremy

    #5001
    JunLyu
    Participant

    I see! This really helps! Thanks so much!

    Best,
    Jun

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.