RSS

Четверг, 28.03.2024, 19:36
Главная » WoW API » Событий API Виджетов »

OnDragStart

[ править ]
Run when the mouse is dragged starting in the frame.
[клоны]
Run when the mouse is dragged starting in the frame. In order for a drag action to begin, the mouse button must be pressed down within the frame and moved more than several (~10) pixels in any direction without being released.


Signature:
Code
OnDragStart(self, "button")

Arguments:
  • self - Reference to the widget for which the script was run (button)
  • button - Name of the mouse button responsible for the drag action (string)
      Button4
    • Button5
    • LeftButton
    • MiddleButton
    • RightButton

Examples:
-- Illustrates script handlers involved in dragging. Dragging to or
-- from either button will display messages detailing the process.
local nextNum = 1
local last
local handlers = {
"OnMouseDown", "OnMouseUp", "OnDragStart", "OnDragStop", "OnReceiveDrag"
}
local function CreateButton()
local curNum = nextNum
local b = CreateFrame("Button", "Test"..curNum, UIParent, "UIPanelButtonTemplate2")
if curNum == 1 then
b:SetPoint("CENTER")
else
b:SetPoint("LEFT", last, "RIGHT", 5, 0)
end
b:SetText(curNum)
b:RegisterForDrag("LeftButton", "RightButton")

for _, handler in ipairs(handlers) do
b:SetScript(handler, function(self, button)
button = button and ", "..button or ""
DEFAULT_CHAT_FRAME:AddMessage(format("%s: %d%s", handler, curNum, button))
end)
end

nextNum = nextNum + 1
last = b
end
CreateButton()
CreateButton()

Доступна для: Frame, ArchaeologyDigSiteFrame, Button, ColorSelect, Cooldown, EditBox, GameTooltip, MessageFrame, Minimap, Model, MovieFrame, QuestPOIFrame, ScrollFrame, ScrollingMessageFrame, SimpleHTML, Slider, StatusBar, CheckButton, PlayerModel, DressUpModel, TabardModel

Также смотрите: Событий API Виджетов
Ссылки: http://wowprogramming.com/docs/scripts/OnDragStart