"Popup" is like a short notification that quickly appears on the screen, providing extra options or information in a concise and unobtrusive manner.
Here are the available methods for the Popup Component.
Examples
Example - Basic
class Main extends App
{
onStart()
{
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn1 = ui.addButton(this.main, "Show Popup")
this.btn1.setOnTouch( this.onTouch )
}
onTouch()
{
ui.showPopup("Hello from popup!")
}
}
from hybrid import ui
def OnStart():
main = ui.addLayout("main", "Linear", "VCenter,FillXY")
btn1 = ui.addButton(main, "Show Popup")
btn1.setOnTouch(onTouch)
def onTouch(event):
ui.showPopup("Hello from popup!")
Example - Popup with transition
class Main extends App
{
onStart()
{
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.main.setChildMargins(0, 0, 0, 0.02)
this.btn1 = ui.addButton(this.main, "Top & Grow", "Primary")
this.btn1.setOnTouch( this.onTouch1 )
this.btn2 = ui.addButton(this.main, "Bottom and Slide", "Secondary")
this.btn2.setOnTouch( this.onTouch2 )
}
onTouch1()
{
ui.showPopup("Hello world.", "Top,Grow")
}
onTouch2()
{
ui.showPopup("Hello world.", "Bottom,Slide", 1500)
}
}
class Main extends App
onStart()
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.main.setChildMargins(0, 0, 0, 0.02)
this.btn1 = ui.addButton(this.main, "Top & Grow", "Primary")
this.btn1.setOnTouch( this.onTouch1 )
this.btn2 = ui.addButton(this.main, "Bottom and Slide", "Secondary")
this.btn2.setOnTouch( this.onTouch2 )
onTouch1()
ui.showPopup("Hello world.", "Top,Grow")
onTouch2()
ui.showPopup("Hello world.", "Bottom,Slide", 1500)
Example - With action
class Main extends App
{
onStart()
{
this.layMain = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton(this.layMain, "Show Popup")
this.btn.setOnTouch( this.showMessage )
}
showMessage()
{
this.snackbar = ui.showPopup("Please login to continue", "Bottom,Center", "", "Login")
this.snackbar.setOnAction( this.onAction )
}
onAction()
{
this.snackbar.hide()
ui.showPopup("Login is click. Show login Page.")
}
}
class Main extends App
onStart()
this.layMain = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton(this.layMain, "Show Popup")
this.btn.setOnTouch( this.showMessage )
showMessage()
this.snackbar = ui.showPopup("Please login to continue", "Bottom,Center", "", "Login")
this.snackbar.setOnAction( this.onAction )
onAction()
this.snackbar.hide()
ui.showPopup("Login is click. Show login Page.")
Properties
The following properties are available on the Popup object:
Methods
The following methods are available on the Popup object: