User Tools

Site Tools


Sidebar

en:objects:app:runtime:enable_quit

enable_quit

enable_quit($enable_exit); - allow or prohibit script execution by the command $app->quit().

The function accepts parameters as input:

  • $enable_exit – flag prohibiting the execution of the $app->quit command. if true - exit is allowed, and if false - it is locked.

    After testing, the function returns the result of its work to the script :
  • true – successfully worked
  • false – operation failed

    PHP example:

    <?php $xhe_host = "127.0.0.1:7010";
     
    //connect the object to control the emulator, if not already connected
    if(!isset($path))
       $path = "../../../Templates/xweb_human_emulator.php";
    require($path);
     
    //Start
    echo "<hr> <font color = blue> app->".basename(__FILE__)."</font> <hr>";
     
    //1
    echo "1.Prohibit exiting by app->quit:";
    echo $app->enable_quit(false)."<br>";
     
    //2
    echo "2.Let's try to exit:";
    if(!$app->quit())
    echo "no exit <br>";
     
    //3
    echo "3.Allow exit by app->quit:";
    echo $app->enable_quit(true);
     
    //end
    echo "<hr> <br>";
     
    //Quit
    $app->quit();
    ?>

    Python example:

    # Additional paths
    import sys
    sys.path.insert(0, '../../../Templates PY/')
     
    xhe_host = "127.0.0.1:7011"
    from xweb_human_emulator import *
     
    # Start
    echo("<hr> <font color = blue> app.xxxxxxxxx </font> <hr>")
     
    # 1
    echo("1.Disable exiting by app.quit:")
    echo(app.enable_quit(false), "<br>")
     
    # 2
    echo("2.Let's try to exit:")
    if not app.quit():
    echo("exit denied <br>")
     
    # 3
    echo("3.Allow exiting with app.quit:")
    echo(app.enable_quit(true))
     
    # end
    echo("<hr> <br>")
     
    # Quit
    app.quit()

    C# example:

    #region using
     
    using System;
    using System.Diagnostics;
    using System.Collections.Generic;
    using System.Linq;
    using System.IO;
    using System.Text;
    using System.Threading;
     
    using XHE;
    using XHE.XHE_DOM;
    using XHE.XHE_System;
    using XHE.XHE_Window;
    using XHE.XHE_Web;
     
    #endregion
     
      class Program: XHEScript
      {
    static void Main(string [] args)
    {
    //init XHE
    server = "127.0.0.1:7010";
    InitXHE();
     
    //Start
    echo("<hr> <font color = blue> app.enable_quit </font> <hr>");
     
    //1 step
    echo("1.Disable exiting by app.quit:" + app.enable_quit(false) + " n");
     
    //step 2
    echo("2.Let's try to exit:");
    if(!app.quit())
    echo("no exit  n");
     
    //step 3
    echo("3.Disable exiting by app.quit:" + app.enable_quit(true) + " n");
     
    //end
    echo("<hr> <br>");
     
    app.quit();
    }
    }

    Java Script example:

    //connect the object to control the emulator, if not already connected
    xhe_host = "127.0.0.1:7010";
    echo = require("../../../Templates JS/xweb_human_emulator.js");
     
    //Start
    echo("<hr> <font color = blue> app.enable_quit </font> <hr>");
     
    //1 step
    echo("1.Disable exiting by app.quit:");
    echo(app.enable_quit(false) + "<br>");
     
    //step 2
    echo("2.Let's try to exit:");
    if(!app.quit())
    echo("no exit <br>");
     
    //step 3
    echo("3.Allow app.quit to exit:");
    echo(app.enable_quit(true));
     
    //end
    echo("<hr> <br>");
     
    //Quit
    app.quit();
  • en/objects/app/runtime/enable_quit.txt · Last modified: 2026/08/05 22:31 (external edit)