onBack Event

53 views
Skip to first unread message

tom

unread,
Mar 31, 2025, 1:18:29 PMMar 31
to DroidScript
Hi,  does anyone know if the onBack app event works in a hybrid UI?

Alan Hendry

unread,
Mar 31, 2025, 4:23:17 PMMar 31
to DroidScript
HI,
There's a post on Discord under #hybrid
7 Feb which mentions that the next release will allow
... onConfig() and onBack()
Regards, ah

Alan Hendry

unread,
Mar 31, 2025, 4:54:28 PMMar 31
to DroidScript
HI,
Try this
Regards, ah

//Enable module support.
cfg.ESM
//import a custom utils module.
//import { utils } from "./my-module.js"
export class Main extends App {
    onStart() {
        this.layMain = ui.addLayout( "main", "linear", "fillxy,vcenter" )
        this.txt = ui.addText( this.layMain, "Press the Android Back button")
        app.EnableBackKey( false )
        this.dlg = ui.addDialog("Close?", "Exit app?", "Yes,No")
        this.dlg.setOnAction(function(text,index) {
            if (text == "Yes") app.Exit(  )
        }) // setOnAction
    }
    onConfig() {
        app.ShowPopup( "rotated!" )
    } // onConfig
    onBack() {
           this.dlg.show()
    } // onBack
} // class




//
Reply all
Reply to author
Forward
0 new messages