OnTouchDown||doc136698

September 20, 2022

Format

local event = Window:GetEvent("OnTouchDown")

Describe

An event is triggered when a touch is pressed in the target control.

Callback function parameters

Type name introduce
Window window current window
Vector2 pos Screen based touch coordinates
int touchIndex The touch point index of touch is used to determine the number of touch points

Code example

-- Create a Image widget
local window = UI:CreateGUIWidget(Enum.WidgetType.Image)
window.Parent = UI.Root

local event = window:GetEvent("OnTouchDown")
event:Bind(function(window, pos, touchIndex)
    print("touch down window!", window.name, pos, touchIndex)
end)