Thread Tools Display Modes
10-12-22, 05:23 PM   #1
muleyo
A Deviate Faerie Dragon
Join Date: Apr 2021
Posts: 12
Convert pairs to frame

Hello,

I'm currently trying to convert pairs to frames.

I've created the following pairs:

Code:
local MicroMenu = {
      CharacterMicroButton,
      SpellbookMicroButton,
      TalentMicroButton,
      AchievementMicroButton,
      QuestLogMicroButton,
      SocialsMicroButton,
      PVPMicroButton,
      LFGMicroButton,
      MainMenuMicroButton,
      HelpMicroButton
    }

local BagButtons = {
      MainMenuBarBackpackButton,
      CharacterBag0Slot,
      CharacterBag1Slot,
      CharacterBag2Slot,
      CharacterBag3Slot,
      MainMenuBarBackpackButton.Back,
      CharacterBag0Slot.Back,
      CharacterBag1Slot.Back,
      CharacterBag2Slot.Back,
      CharacterBag3Slot.Back,
      KeyRingButton,
      KeyRingButton.Back,
    }
I want them to be able to move as "one unit" instead of moving the "CharacterMicroButton" or "MainMenuBarBackpackButton", which I think is achieveable by converting them to a frame (I hope I'm correct with this).
  Reply With Quote
10-12-22, 06:35 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
What you are doing is putting the frame references into a table that looks like:

Lua Code:
  1. local MicroMenu = {
  2.       [1] = CharacterMicroButton,
  3.       [2] = SpellbookMicroButton,
  4.       [3] = TalentMicroButton,
  5.       [4] = AchievementMicroButton,
  6.       [5] = QuestLogMicroButton,
  7.       [6] = SocialsMicroButton,
  8.       [7] = PVPMicroButton,
  9.       [8] = LFGMicroButton,
  10.       [9] = MainMenuMicroButton,
  11.       [10] = HelpMicroButton
  12. }
You will still need to move each frame individually

Lua Code:
  1. for k, v in ipairs(MicroMenu) do
  2.     v:ClearAllPoints() -- first loop wil move CharacterMicroButton, second, SpellbookMicroButton etc.
  3.     if k = 1 then
  4.           v:SetPoint("TOPRIGHT", UIParent, -5, 0) -- Set CharacterMicroButton to topright of screen
  5.     else
  6.           v:SetPoint("TOP", MicroMenu[k-1], "BOTTOM") -- arrange the rest in a column below CharacterMicroButton
  7.     end
  8. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Convert pairs to frame


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