WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   help with lua grid (https://www.wowinterface.com/forums/showthread.php?t=54240)

samvx 08-18-16 08:49 PM

help with lua grid
 
Im trying to change cursor shape over each unit on grid.
I have some clue for it but need help to do work with every unit
Code:
Quote:

local cursorGrid = "ITEM_CURSOR"

local function OnEnter(self)
SetCursor(cursorGrid)
end

GridLayoutFrame:SetScript("OnEnter", OnEnter)
Tried this, but does´nt work

Code:
Quote:

local function OnEnter(self)
SetCursor("ITEM_CURSOR")
end

--GridLayoutFrame:SetScript("OnEnter", OnEnter)
--/run print(GetMouseFocus():GetName())
local GridFrame = Grid:GetModule("GridFrame")

local function WithAllGridFrames(func)
for _, frame in pairs(GridFrame.registeredFrames) do
frame:SetScript("OnEnter", OnEnter)
end
end

local GridUnitCursor = CreateFrame("Frame")
GridUnitCursor:RegisterEvent("PLAYER_ENTERING_WORLD")

GridUnitCursor:SetScript("OnEvent", function(self)
WithAllGridFrames()
WithAllGridFrames = nil
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
self:SetScript("OnEvent", nil)
end)

Phanx 08-19-16 07:54 PM

Probably:

Code:

local function onEnter(frame)
    SetCursor("ITEM_CURSOR")
end

local function hook(frame)
    frame:HookScript("OnEnter", onEnter)
end

local GridFrame = Grid:GetModule("GridFrame")
-- Catch any frames that have already been created:
GridFrame:WithAllFrames(hook)
-- and any that get created in the future:
hooksecurefunc(GridFrame, "InitializeFrame", hook)



All times are GMT -6. The time now is 06:59 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI