WoW:UIHANDLER OnDoubleClick: Difference between revisions

m (New page: {{widgethandler}}<br> == Description == The OnDoubleClick handler is called when a UI element is double-clicked with the mouse. == Arguments == arg1 - a string representing the button ...)
 
m (Move page script moved page UIHANDLER OnDoubleClick to UIHANDLER OnDoubleClick without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 7: Line 7:
== Arguments ==
== Arguments ==


arg1 - a string representing the button that was clicked.
self - the button frame being clicked
 
button - a string representing the button that was clicked.
Can be any of the following:
Can be any of the following:
*LeftButton
*LeftButton

Latest revision as of 04:49, 15 August 2023

Widget handlers < OnDoubleClick

Description

The OnDoubleClick handler is called when a UI element is double-clicked with the mouse.

Arguments

self - the button frame being clicked

button - a string representing the button that was clicked. Can be any of the following:

  • LeftButton
  • RightButton
  • MiddleButton
  • Button4
  • Button5

According to how the UI element is setup with API_Button_RegisterForClicks

Notes

  • Only Button type frames have an OnDoubleClick script, but you can fake it like this:
-- Known issue. Since, time() returns an integer (not a floating point number),
-- the threshold for double-clicking ranges from 0.0000000000001 to 1 second.
-- I tried using GetTime(), but I couldn't seem to get it to work.
frame.timer = 0
frame:SetScript("OnMouseUp", function(...)
    if this.timer < time() then
        this.startTimer = false
    end
    if this.timer == time() and this.startTimer then
        this.startTimer = false

        DoStuff()
    else
        this.startTimer = true
        this.timer = time()
    end
end)