Originally Posted by zork
I made myself a button for vehicle exit.
Lua Code:
local b = CreateFrame("BUTTON", nil, UIParent, "SecureHandlerClickTemplate"); b:SetSize(50,50) b:SetPoint("CENTER",0,0) b:RegisterForClicks("AnyUp") b:SetNormalTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up") b:SetPushedTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Down") b:SetHighlightTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Down") b:SetScript("OnClick", function(self) VehicleExit() end) RegisterStateDriver(b, "visibility", "[target=vehicle,exists] show;hide")
Nearly the same could be done for anything else. You may even add a new texture to the button to display any type of icon. Spell textures can be get via GetSpellInfo(). If you want no highlight/border textures just leave them out. As you can see you can even add macro-states for visibility.
Adding a texture could be done like this (Only needed if you want to add a border-texture as normaltexture. Otherwise just use normaltexture for this)
Lua Code:
--icon texture local _, _, icon_texture = GetSpellInfo(spellid) --input your spellid here local t = b:CreateTexture(nil,"BACKGROUND",nil,-6) t:SetTexture(icon_texture) t:SetTexCoord(0.1,0.9,0.1,0.9) --cut out crappy icon border t:SetAllPoints(b) --make texture same size as button
If you want hover-states with different alpha you need to add OnEnter and OnLeave events with the behaviour you want to achieve. Like
Lua Code:
--alpha b:SetAlpha(0.2) b:SetScript("OnEnter", function(self) self:SetAlpha(1) end) b:SetScript("OnLeave", function(self) self:SetAlpha(0.2) end)
Just write your own addon for this.
|
Just still helpful for me at classic : )
thanks Zork
Gruss