Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-26-20, 04:30 AM   #1
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
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
 

WoWInterface » Developer Discussions » Lua/XML Help » Assign atlas texture to button in lua?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off