Created
October 20, 2020 05:00
-
-
Save mooreatv/6faee2031614f507887c06a5bd060d99 to your computer and use it in GitHub Desktop.
issue with SecureFrameTemplate and MODIFIER_STATE_CHANGED (world of warcraft. wow api issue)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- local f = CreateFrame("Frame", "TestFrame1", UIParent) -- works | |
local f = CreateFrame("Frame", "TestFrame1", UIParent, "SecureFrameTemplate") -- doesn't work with key/up/down | |
f:SetSize(100,100) | |
f:SetPoint("CENTER") | |
f:SetFrameStrata("FULLSCREEN") | |
f.bg = f:CreateTexture(nil, "BACKGROUND") | |
f.bg:SetAllPoints() | |
f.bg:SetColorTexture(.7, .2, .2) | |
f:SetAlpha(0.5) | |
f:SetScript("OnEnter", function() | |
-- f:SetPropagateKeyboardInput(false) | |
f:EnableKeyboard(true) | |
f:RegisterEvent("MODIFIER_STATE_CHANGED") | |
DEFAULT_CHAT_FRAME:AddMessage("in") | |
end) | |
f:SetScript("OnLeave", function() | |
-- f:SetPropagateKeyboardInput(true) | |
f:UnregisterEvent("MODIFIER_STATE_CHANGED") | |
f:EnableKeyboard(false) | |
DEFAULT_CHAT_FRAME:AddMessage("out") | |
end) | |
f:SetScript("OnEvent", function(w, _ev, key, state) | |
DEFAULT_CHAT_FRAME:AddMessage("got ev : " .. (key or "nil") .. " : " .. tostring(state)) | |
end) | |
f:SetPropagateKeyboardInput(true) | |
--f:SetScript("OnKeyDown", function(w, k) | |
-- DEFAULT_CHAT_FRAME:AddMessage("key down: " .. k or "nil") | |
--end) | |
--f:SetScript("OnKeyUp", function(w, k) | |
-- DEFAULT_CHAT_FRAME:AddMessage("key up : " .. k or "nil") | |
--end) | |
DEFAULT_CHAT_FRAME:AddMessage("f created") |
local f = CreateFrame("Frame", "TestFrame1", UIParent) -- works
-- local f = CreateFrame("Frame", "TestFrame1", UIParent, "SecureFrameTemplate") -- doesn't work with key/up/down
f:SetSize(100,100)
f:SetPoint("CENTER")
f:SetFrameStrata("FULLSCREEN")
f.bg = f:CreateTexture(nil, "BACKGROUND")
f.bg:SetAllPoints()
f.bg:SetColorTexture(.7, .2, .2)
f:SetAlpha(0.5)
f:SetScript("OnEnter", function()
-- f:SetPropagateKeyboardInput(false)
f:EnableKeyboard(true)
f:RegisterEvent("MODIFIER_STATE_CHANGED")
DEFAULT_CHAT_FRAME:AddMessage("in")
end)
f:SetScript("OnLeave", function()
-- f:SetPropagateKeyboardInput(true)
f:UnregisterEvent("MODIFIER_STATE_CHANGED")
f:EnableKeyboard(false)
DEFAULT_CHAT_FRAME:AddMessage("out")
end)
f:SetScript("OnEvent", function(w, _ev, key, state)
DEFAULT_CHAT_FRAME:AddMessage("got ev : " .. (key or "nil") .. " : " .. tostring(state))
end)
f:SetPropagateKeyboardInput(true)
f:SetScript("OnKeyDown", function(w, k)
DEFAULT_CHAT_FRAME:AddMessage("key down: " .. k or "nil")
end)
--f:SetScript("OnKeyUp", function(w, k)
-- DEFAULT_CHAT_FRAME:AddMessage("key up : " .. k or "nil")
--end)
DEFAULT_CHAT_FRAME:AddMessage("f created")
ps: same behavior on wow classic and shadowland pre patch
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
runs (prints ev...) when there is no OnKeyUp or OnKeyDown but doesn't anymore with (works without SecureFrameTemplate and keyup/down)
halp