Reply To: Exit button

PennController for IBEX Forums Support Exit button Reply To: Exit button

#4700
Jeremy
Keymaster

Hi Diane,

Yes, it’s possible, but clicking that button would be a point of no return for the participant. Here is one way of doing it (some of this code is hard to make sense of if you’re not already familiar with the arcane of Ibex)

PennController.ResetPrefix(null);

PennController.AddTable("myTable", `Label,Text
target,Hello
filler,hello
target,World
filler,world`)

PennController.Sequence("welcome", rshuffle("target","filler"))

PennController.Header(
    newCanvas("confirmation", '75vw', '80vh')
        .settings.css("background-color", "floralwhite")
        .settings.add( "center at 50%", "middle at 25%" , newText("Are you sure you want to send your incomplete results now?") )
        .settings.add( "center at 50%", "middle at 75%" , newScale("quit", "Yes", "No").settings.button() )
    ,
    newButton("stop", "Stop").settings.callback(
        getCanvas("confirmation")
            .print("center at 50vw", "middle at 50vh")
        ,
        getScale("quit").wait()
        ,
        getCanvas("confirmation").remove()
        ,
        getScale("quit").test.selected("Yes")
            .success(
                getButton("stop").remove()
                ,
                newFunction( () => {
                    let mainNode = $("p.PennController-PennController");
                    mainNode.empty();
                    let options = {
                        _finishedCallback: r=>console.log("sent",r) ,
                        _cssPrefix: '',
                        _utils: { setTimeout: ()=>null }
                    };
                    addSafeBindMethodPair('__SendResults__');
                    mainNode['__SendResults__'](options);
                }).call()
            )
    )
    .print("bottom at 98vh","right at 98vw")
)

PennController( "welcome" , newButton("Start").print().wait() )
.noHeader()

PennController.Template( "myTable",
    row => PennController( newButton(row.Text).print().wait() )
)

I’ll try to implement a user-friendly option in the next release

I’m also working on a new PCIbex Farm which will use a new engine, and I’m trying to see if it could try to regular send partial results after each trial

Let me know if you have any questions

Jeremy