UI.Behavior
From GiderosMobile
Available since: Gideros 2023.1
Class: UI
Description
Adds behaviors to a widget. Available behaviors are LongClick, Linger, DragMove, DragSize.
UI.Behavior.LongClick.new(widget,params)
A Behavior can have the following parameters:
- clsIndicator: the Indicator class to use UI.ProgressBar, UI.CircularProgress, ...
- szIndicator: the Indicator size
Parameters
widget: (sprite) the widget to add behavior to
params: (table) any of Behavior parameters
Example
local gui=UI.Button.new()
gui:setDimensions(64, 48)
gui:setPosition(128, 128)
gui:setText("btn")
gui.name = "button"
stage:addChild(gui)
UI.Behavior.LongClick.new(gui,{ clsIndicator=UI.CircularProgress, szIndicator=32 })
function gui:onWidgetAction(w)
print(w.name, "clicked")
end
function gui:onWidgetLongAction(w)
print(w.name, "long clicked!")
end
-- we need a Screen widget to see the Circular Progress Indicator
local screen=UI.Screen.new()
screen:ui(gui)