Thread Tools Display Modes
05-26-21, 08:20 PM   #1
fullmoon_sulfuras
A Fallenroot Satyr
Join Date: Dec 2019
Posts: 21
Resize frames with texture

Hi there! I'm trying to understand why the following code won't create frames of different sizes:

Lua Code:
  1. local x
  2.  
  3. x = CreateFrame("Button", "LSSettings" .. "StanceIcon0x", UIParent, "ActionButtonTemplate")
  4. x:SetPoint("Topleft", 350, -200);
  5. x:EnableMouse(false);
  6. x:SetWidth(50);
  7. x:SetHeight(50);
  8. x:SetNormalTexture("Interface\\AddOns\\LunarSphere\\art\\mouse1")
  9.  
  10. x = CreateFrame("Button", "LSSettings" .. "StanceIcon0y", UIParent, "ActionButtonTemplate")
  11. x:SetPoint("Topleft", 350, -300);
  12. x:SetWidth(24);
  13. x:SetHeight(24);
  14. x:EnableMouse(false);
  15. x:SetNormalTexture("Interface\\AddOns\\LunarSphere\\art\\mouse1")
  16.  
  17. x = CreateFrame("Button", "LSSettings" .. "StanceIcon0z", UIParent, "ActionButtonTemplate")
  18. x:SetPoint("Topleft", 350, -400);
  19. x:SetWidth(10);
  20. x:SetHeight(10);
  21. x:EnableMouse(false);
  22. x:SetNormalTexture("Interface\\AddOns\\LunarSphere\\art\\mouse1")

Thanks!!!

Last edited by fullmoon_sulfuras : 05-26-21 at 08:32 PM.
  Reply With Quote
05-26-21, 08:43 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
It does. Are they being re-sized again somewhere else in your code?

Edit: You mean on Classic..
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-26-21 at 08:49 PM.
  Reply With Quote
05-26-21, 08:55 PM   #3
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
The ActionButtonTemplate is setting an absolute size for the NormalTexture rather than using SetPoint() relative to the frame.
Classic, #NoChanges
Lua Code:
  1. local x, t
  2.  
  3. x = CreateFrame("Button", "LSSettings" .. "StanceIcon0x", UIParent, "ActionButtonTemplate")
  4. x:SetPoint("Topleft", 350, -200);
  5. x:EnableMouse(false);
  6. x:SetWidth(50);
  7. x:SetHeight(50);
  8. x:SetNormalTexture("Interface\\AddOns\\LunarSphere\\art\\mouse1")
  9. t = x:GetNormalTexture()
  10. t:SetSize(x:GetSize())
  11.  
  12. x = CreateFrame("Button", "LSSettings" .. "StanceIcon0y", UIParent, "ActionButtonTemplate")
  13. x:SetPoint("Topleft", 350, -300);
  14. x:SetWidth(24);
  15. x:SetHeight(24);
  16. x:EnableMouse(false);
  17. x:SetNormalTexture("Interface\\AddOns\\LunarSphere\\art\\mouse1")
  18. t = x:GetNormalTexture()
  19. t:SetSize(x:GetSize())
  20.  
  21. x = CreateFrame("Button", "LSSettings" .. "StanceIcon0z", UIParent, "ActionButtonTemplate")
  22. x:SetPoint("Topleft", 350, -400);
  23. x:SetWidth(10);
  24. x:SetHeight(10);
  25. x:EnableMouse(false);
  26. x:SetNormalTexture("Interface\\AddOns\\LunarSphere\\art\\mouse1")
  27. t = x:GetNormalTexture()
  28. t:SetSize(x:GetSize())
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-27-21 at 12:03 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Resize frames with texture

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