Building a chat interface using Canvas and TextInput

PennController for IBEX Forums Support Building a chat interface using Canvas and TextInput

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #11090
    taurina
    Participant

    Hello,

    I have been trying to build an interface that looks like a chat box where participants can send texts according to the relevant instructions. With the help of ChatGPT, I managed to build a pretty good-looking and interactive one using a lot of custom Javascript code, that at the moment is totally useless since I’m not able to log the texts in any way.
    Do you know if there is a way, by using only PennController commands, to proceed?

    This is my example code:

    PennController.ResetPrefix(null);

    Sequence(“test”);

    newTrial(“test”,
    newCanvas(“chatbox”, 400, 300)
    .css(“border”, “1px solid black”)
    .print(),
    newTextInput(“message1”)
    .print(),
    newButton(“Send message”)
    .print()
    .wait(getTextInput(“message1”).test.text( /^(?:[A-Za-z]+|(?:\d|1[0-8]))$/ )
    ),
    getCanvas(“chatbox”)
    .add(0, 0, newText(“example text”, “Hello”).print())
    ,
    newButton(“Continua”)
    .print()
    .wait()
    );

    The goal at the moment would be to print on the Canvas, instead of a newText, the content of the message (namely the input of the TextInput box). I couldn’t find any straightforward way to do it.
    Also, if you know about anyone else who built a similar interface here, it would be a great help!

    Thank you in ad

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.