Shows a popup into your app.
Properties
These are the setter and getter properties for the showPopup Component.
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 - Popups with transitions
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)
}
}
from hybrid import ui
def OnStart():
main = ui.addLayout("main", "Linear", "VCenter,FillXY")
main.setChildMargins(0, 0, 0, 0.02)
btn1 = ui.addButton(main, "Top & Grow", "Primary")
btn1.setOnTouch(onTouch1)
btn2 = ui.addButton(main, "Bottom and Slide", "Secondary")
btn2.setOnTouch(onTouch2)
def onTouch1(event):
ui.showPopup("Hello world.", "Top,Grow")
def onTouch2(event):
ui.showPopup("Hello world.", "Bottom,Slide", 1500)
Example - With Transition
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.")
}
}
from hybrid import ui
def OnStart():
layMain = ui.addLayout("main", "Linear", "VCenter,FillXY")
btn = ui.addButton(layMain, "Show Popup")
btn.setOnTouch(showMessage)
def showMessage(event):
global snackbar
snackbar = ui.showPopup("Please login to continue", "Bottom,Center", "", "Login")
snackbar.setOnAction(onAction)
def onAction():
snackbar.hide()
ui.showPopup("Login is click. Show login Page.")
Methods
The following methods are available on the showPopup object: