Quantcast
WoWInterface - View Single Post - Assign atlas texture to button in lua?
View Single Post
03-26-20, 04:30 AM   #1
LudiusMaximus
A Cobalt Mageweaver
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 221
Assign atlas texture to button in lua?

I found that the equivalent to xml

Code:
<Button name="myButton">
  <NormalTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Up"/>
  <PushedTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Down"/>
  <DisabledTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Disabled"/>
  <HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
</Button>
can be achieved in lua as follows:

Code:
local myButton= CreateFrame("Button", "myButton", myParentFrame)
myButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Up")
myButton:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Down")
myButton:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Disabled")
myButton:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight", "ADD")

But how do I achieve a texture defined as "atlas" in lua?

Code:
<NormalTexture atlas="QuestCollapse-Show-Up"/>
<PushedTexture atlas="QuestCollapse-Show-Down"/>
I tried

Code:
local texture = myButton:CreateTexture()
texture:SetAtlas("QuestCollapse-Show-Up")
myButton:SetNormalTexture(texture)
but this did no show any texture.

What am I missing? Thanks!
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote