View Single Post
12/28/14, 11:07 PM   #1
pluginpatch
Join Date: Dec 2014
Posts: 2
OnKeyUp/OnKeyDown via Lua

I am a new user on these forums and dabbling a bit in eso addons.

I am having trouble getting the handlers OnKeyDown and OnKeyUp to work. I have mostly used this post:
http://www.esoui.com/forums/showthread.php?t=2318
as a reference.

I have the following

Code:
local wm = GetWindowManager()

local container = wm:CreateTopLevelWindow("Container")
container:SetDimensions(600,600)
container:SetAnchor(CENTER, GuiRoot, CENTER, 0, 0)
container:SetHidden(true)
container:SetKeyboardEnabled(true)

container.wheel = wm:CreateControl("$(parent)Wheel", container, CT_TEXTURE)
container.wheel:SetTexture("esoui/art/quickslots/quickslot_mapping_bg.dds")
container.wheel:SetAnchor(CENTER, container, CENTER, 0, 0)

local function EventKeyDown(self, key)
    container:SetHidden(false)
end
container:SetHandler("OnKeyDown", function(self,key,ctrl,alt,shift,command) EventKeyDown(self, key) end)
I used to have if statements to check for specific keys, but I was afraid they were messing me up.
When setting the texture SetHidden(true) I do see the texture, so it works, but I cannot make the key events work.
  Reply With Quote