OnClick||doc136701

September 20, 2022

Format

local event = Window:GetEvent("OnClick")

Describe

Triggers an event when the target control is clicked.

Callback function parameters

Type name introduce
Window window current window
Vector2 pos Screen based touch coordinates

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)
    print("click window!", window.name, pos)
end)