The API is no longer being updated here until further notice. |
Fires when double-clicking a Button.
(self, button)
Arguments[]
- self
- Button - Widget being clicked.
- button
- string - "LeftButton", "RightButton", "MiddleButton", "Button4", "Button5", ..., "ButtonN".
Details[]
- Requires the mouse button to have been pressed, released, re-pressed and re-released over the Button; there can be a pause after the initial press, but the latter three steps must be quick.
- Requires registering for the "Up" button event with Button:RegisterForClicks().
- OnDoubleClick blocks OnClick, PreClick, and PostClick when it fires.
- Continuous button-mashing alternates between OnClick and OnDoubleClick if both are set.
Example[]
A simple button that tells you how it was pressed.
local button = CreateFrame("Button", nil, UIParent, "UIPanelButtonTemplate")
button:SetSize(250, 24)
button:SetPoint("CENTER")
button:RegisterForClicks("AnyUp", "AnyDown")
button:SetScript("OnClick", function (self, button, down)
self:SetText((down and "Pressed " or "Pressed and released ") .. button .. " once")
end)
button:SetScript("OnDoubleClick", function (self, button)
self:SetText("Pressed and released ".. button .. " twice")
end)