Reply
Thread Tools Display Modes
Unread 11-02-13, 05:30 PM   #1
Mayron
A Chromatic Dragonspawn
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 158
Trying to move CompactRaidFrameManager

Hi and sorry if recently I have posted a lot. This is the last issue I have till my UI should be finished.

I want to move the CompactRaidFrameManager window on the left as its in the way of my chat box as I have it at the top left corner instead. To move it I used the following code:

Lua Code:
  1. function eventHandlers.PLAYER_ENTERING_WORLD()
  2.     if CompactRaidFrameManager:IsVisible() then
  3.         local point, relativeTo, relativePoint, xOfs, yOfs = CompactRaidFrameManager:GetPoint()
  4.         CompactRaidFrameManager:SetPoint(point, relativeTo, relativePoint, xOfs, -300)
  5.     end
  6. end
  7.  
  8.  
  9. CompactRaidFrameManagerToggleButton:HookScript("OnClick", function()
  10.     if CompactRaidFrameManager:IsVisible() then  
  11.         local point, relativeTo, relativePoint, xOfs, yOfs = CompactRaidFrameManager:GetPoint()
  12.         CompactRaidFrameManager:SetPoint(point, relativeTo, relativePoint, xOfs, -300)
  13.     end
  14. end)

This works however if you click the "CompactRaidFrameManagerToggleButton" Button while in combat it resets its position. I have been looking for a solution and found the code below but it doesn't do anything, most likely because I'm using it wrong and not sure what to do with it.

Lua Code:
  1. if CompactRaidFrameManager.collapsed then    
  2.         CompactRaidFrameManager:SetScript("OnUpdate", nil)
  3. end

Thought I might as well ask for help in case someone has encountered this issue before and knows a fix. Greatly appreciated! Thank you for reading
Mayron is offline   Reply With Quote
Unread 11-03-13, 05:04 AM   #2
Mayron
A Chromatic Dragonspawn
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 158
I've tried using hooksecurefunction and hook script to try to get this to work but it all comes down to the issue where I'm in combat and I use the CompactRaidFrameManager button which then resets its position. I got fed up with this and used an OnUpdate handler (the code below) but even this will not work while I'm in combat which does not make any sense to me. Surely this OnUpdate function should work regardless of whether I'm in combat or not and then Blizzard Compact Raid Frame Manager code seems to mention nothing at all about being in combat so no idea whats blocking it.

Lua Code:
  1. local e = 0
  2. local CompactOnUpdate = CreateFrame("Frame")
  3. CompactOnUpdate:SetScript('OnUpdate', function(self, elapsed)
  4.     e = e + elapsed
  5.     if e >= 2 then
  6.         if CompactRaidFrameManager:IsVisible() then
  7.         local point, relativeTo, relativePoint, xOfs, yOfs = CompactRaidFrameManager:GetPoint()
  8.         CompactRaidFrameManager:SetPoint(point, relativeTo, relativePoint, xOfs, -300)
  9.         end
  10.         e = 0
  11.     end
  12. end)

Last edited by Mayron : 11-03-13 at 05:33 AM.
Mayron is offline   Reply With Quote
Unread 11-03-13, 07:04 PM   #3
Mayron
A Chromatic Dragonspawn
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 158
I've managed to get it to work while out of combat and I've just made it so that you cannot click the ToggleButton while in combat. That avoids it from moving location on its own. Very odd that I cannot alter it at all while in combat but will just have to settle for it.
Mayron is offline   Reply With Quote
Unread 11-03-13, 09:28 PM   #4
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,133
Originally Posted by Mayron View Post
Very odd that I cannot alter it at all while in combat ...
It's not odd at all. You cannot programmatically move (or show, hide, resize, etc.) secure frames while in combat.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 11-04-13, 02:35 PM   #5
Mayron
A Chromatic Dragonspawn
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 158
Originally Posted by Phanx View Post
It's not odd at all. You cannot programmatically move (or show, hide, resize, etc.) secure frames while in combat.
Ah okay, was trying to find out how the default compact raid frame manager does it in combat but couldn't but ah well :/
Mayron is offline   Reply With Quote
Unread 11-05-13, 02:07 AM   #6
AnrDaemon
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 115
Originally Posted by Mayron View Post
Ah okay, was trying to find out how the default compact raid frame manager does it in combat but couldn't but ah well :/
The default (that is, Blizzard own) code is cheating. Simple as that.
AnrDaemon is offline   Reply With Quote
Unread 11-05-13, 05:38 AM   #7
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,133
Yep. Blizzard's code is not subject to the same restrictions as addons. That's why they can call CastSpellByName, even though addons have been forbidden from calling that function since TBC.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 01-18-14, 12:17 PM   #8
Resike
A Molten Giant
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 563
I also have been playing this recently:

Lua Code:
  1. hooksecurefunc("CompactRaidFrameManager_Expand", function(self)
  2.     if MovAny:IsModified(self) then
  3.         MovAny:UnlockPoint(self)
  4.         local point, relativeTo, relativePoint, xOfs, yOfs = self:GetPoint(1)
  5.         self:ClearAllPoints()
  6.         self:SetPoint("TOPLEFT", UIParent, "TOPLEFT", xOfs + 175, yOfs)
  7.         MovAny:LockPoint(self)
  8.     end
  9. end)
  10. hooksecurefunc("CompactRaidFrameManager_Collapse", function(self)
  11.     if MovAny:IsModified(self) then
  12.         MovAny:UnlockPoint(self)
  13.         local point, relativeTo, relativePoint, xOfs, yOfs = self:GetPoint(1)
  14.         self:ClearAllPoints()
  15.         self:SetPoint("TOPLEFT", UIParent, "TOPLEFT", xOfs - 175, yOfs)
  16.         MovAny:LockPoint(self)
  17.     end
  18. end)
  19. -- Before you hide it to keep the raidframes:
  20. if fn == "CompactRaidFrameManager" then
  21.     if InCombatLockdown() or UnitAffectingCombat("player") then
  22.         return
  23.     end
  24.     f:UnregisterAllEvents()
  25.     CompactRaidFrameContainer:SetParent(UIParent)
  26. end
  27. -- Before you reshow it, reparent and repoint raidframe to it:
  28. if fn == "CompactRaidFrameManager" then
  29.     if InCombatLockdown() or UnitAffectingCombat("player") then
  30.         return
  31.     end
  32.     f:RegisterEvent("DISPLAY_SIZE_CHANGED")
  33.     f:RegisterEvent("UI_SCALE_CHANGED")
  34.     f:RegisterEvent("GROUP_ROSTER_UPDATE")
  35.     f:RegisterEvent("UNIT_FLAGS")
  36.     f:RegisterEvent("PLAYER_FLAGS_CHANGED")
  37.     f:RegisterEvent("PLAYER_ENTERING_WORLD")
  38.     f:RegisterEvent("PARTY_LEADER_CHANGED")
  39.     f:RegisterEvent("RAID_TARGET_UPDATE")
  40.     f:RegisterEvent("PLAYER_TARGET_CHANGED")
  41.     CompactRaidFrameContainer:ClearAllPoints()
  42.     CompactRaidFrameContainer:SetParent(f)
  43.     MovAny:UnlockPoint(CompactRaidFrameContainer)
  44.     CompactRaidFrameContainer:SetPoint("TOPLEFT", CompactRaidFrameManagerContainerResizeFrame, "TOPLEFT", 4, - 7)
  45. end
  46.  
  47. function MovAny:UnlockPoint(f)
  48.     f.MAPoint = nil
  49. end
  50.  
  51. function MovAny:LockPoint(f, opt)
  52.     if not f.MAPoint then
  53.         if f:GetName() and (MovAny.lForcedLock[f:GetName()] or (opt and opt.forcedLock))  then
  54.             if not f.MASetPoint then
  55.                 f.MASetPoint = f.SetPoint
  56.                 f.SetPoint = MovAny.fVoid
  57.             end
  58.         else
  59.             if not f.MALockPointHook then
  60.                 hooksecurefunc(f, "SetPoint", MovAny.hSetPoint)
  61.                 f.MALockPointHook = true
  62.             end
  63.             f.MAPoint = {f:GetPoint(1)}
  64.         end
  65.     end
  66. end
  67.  
  68. fVoid = function() end

"MovAny:IsModified(self)" determines if the frame's position is modified or it's in the default position.

The moving functions should not be a problem, just don't let it move it in combat.

The advantage of this, when you move the Manager to another position the toggle panel button will work perfectly on that spot too.

Last edited by Resike : 01-18-14 at 12:28 PM.
Resike is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Lua/XML Help » Trying to move CompactRaidFrameManager

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