GHI_SetKeyBinding

Pilus edited this page Aug 11, 2015 · 1 revision
Clone this wiki locally

Syntax:

GHI_SetKeyBinding(key,func)

Arguments:

GHI_SetKeyBinding has 2 required arguments.

key
''String''
The key you wish to bind to. Go here for more on key binding[http://wowprogramming.com/docs/api_types#binding].
func
''function''
The function you wish to fire when the key bind is pressed.

Example:

GHI_SetKeyBinding("CTRL-T", function()

GHI_SetCursor("Interface\\CURSOR\\Crosshairs","",nil,function()

cursorX, cursorY = GetCursorPosition()

local round = function(numb,digits)

local shift = 10 ^ digits

return floor( numb*shift + 0.5 ) / shift

end

print("X: "..round(cursorX,0),"Y: "..round(cursorY,0))

mybutton = CreateFrame("Button","mybutton",UIParent,"UIPanelButtonTemplate")

mybutton:SetPoint("CENTER",UIParent,"BOTTOMLEFT",round(cursorX,0),round(cursorY,0))

mybutton:SetWidth(32)

mybutton:SetHeight(32)

mybutton:SetScript("OnClick",function() mybutton:Hide() end)

GHI_ClearCursor()

end

)

end

)

This creates a targeting cursor when control T is pressed. When the screen is clicked, a button is placed there.