Quantcast Moving the MainMenuBar - WoWInterface
Thread Tools Display Modes
08-10-18, 06:51 AM   #1
cokedrivers
A Frostmaul Preserver
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 277
Moving the MainMenuBar

Im trying to put the MainmenuBar on top of my Datapanel but I keep having issues.

This is the code ive been trying to use:
Lua Code:
  1. local AdjustBar = function() end
  2.    
  3.     -- Move the MainMenuBar
  4.     MainMenuBar:SetMovable(true)
  5.     MainMenuBar:SetUserPlaced(true)
  6.     MainMenuBar:ClearAllPoints()
  7.     MainMenuBar:SetPoint("BOTTOM",cDataMainPanel,"TOP",0,-4)
  8.     MainMenuBar.ClearAllPoints = AdjustBar
  9.     MainMenuBar.SetMovable = AdjustBar
  10.     MainMenuBar.SetPoint = AdjustBar
  11.     MainMenuBar.SetUserPlaced = AdjustBar
  12.  
  13.     -- Move the MainMenuBar.
  14.     --MainMenuBar:SetMovable(true)
  15.     --MainMenuBar:SetUserPlaced(true)  
  16.     --MainMenuBar:ClearAllPoints()
  17.     --MainMenuBar:SetPoint("BOTTOM",cDataMainPanel,"TOP",0,-4)
  18.    
  19.     -- Move the OverrideActionBar.
  20.     --OverrideActionBar:ClearAllPoints()
  21.     --OverrideActionBar:SetPoint("BOTTOM",cDataMainPanel,"TOP",0,4)
  22.     --OverrideActionBar.ClearAllPoints = AdjustBar
  23.     --OverrideActionBar.SetPoint = AdjustBar
  24.    
  25.     -- Move the ExtraActionButton.
  26.     ExtraActionButton1:ClearAllPoints()
  27.     ExtraActionButton1:SetPoint("CENTER", MainMenuBar, "TOP", 0, 100)
  28.     ExtraActionButton1.ClearAllPoints = AdjustBar
  29.     ExtraActionButton1.SetPoint = AdjustBar
any help would be great.

If you need to se more here is the whole addon cData

Thanks Coke
  Reply With Quote
08-11-18, 03:57 AM   #2
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 779
Try

Lua Code:
  1. MainMenuBar.ignoreFramePositionManager = true
  Reply With Quote
08-11-18, 06:16 AM   #3
Vrul
A Frostmaul Preserver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 266
This is what I use in my personal UI:
Code:
local function SetPosition(frame, ...)
    if type(frame) == 'string' then
        UIPARENT_MANAGED_FRAME_POSITIONS[frame] = nil
        frame = _G[frame]
    end
    if type(frame) == 'table' and type(frame.IsObjectType) == 'function' and frame:IsObjectType('Frame') then
        local name = frame:GetName()
        if name then
            UIPARENT_MANAGED_FRAME_POSITIONS[name] = nil
        end
        frame:SetMovable(true)
        frame:SetUserPlaced(true)
        frame:SetDontSavePosition(true)
        frame.ignoreFramePositionManager = true
        if ... then
            frame:ClearAllPoints()
            frame:SetPoint(...)
        end
        frame:SetMovable(false)
    end
end
Then you just need to do:
Code:
SetPosition(MainMenuBar, "BOTTOM", cDataMainPanel, "TOP", 0, 10)

SetPosition(ExtraActionBarFrame, "CENTER", MainMenuBar, "TOP", 0, 100)
But you didn't say what issues you were having so I don't know if taint was your problem or if the frames were moving on you.
  Reply With Quote
08-11-18, 07:38 AM   #4
cokedrivers
A Frostmaul Preserver
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 277
Originally Posted by Vrul View Post
This is what I use in my personal UI:
Code:
local function SetPosition(frame, ...)
    if type(frame) == 'string' then
        UIPARENT_MANAGED_FRAME_POSITIONS[frame] = nil
        frame = _G[frame]
    end
    if type(frame) == 'table' and type(frame.IsObjectType) == 'function' and frame:IsObjectType('Frame') then
        local name = frame:GetName()
        if name then
            UIPARENT_MANAGED_FRAME_POSITIONS[name] = nil
        end
        frame:SetMovable(true)
        frame:SetUserPlaced(true)
        frame:SetDontSavePosition(true)
        frame.ignoreFramePositionManager = true
        if ... then
            frame:ClearAllPoints()
            frame:SetPoint(...)
        end
        frame:SetMovable(false)
    end
end
Then you just need to do:
Code:
SetPosition(MainMenuBar, "BOTTOM", cDataMainPanel, "TOP", 0, 10)

SetPosition(ExtraActionBarFrame, "CENTER", MainMenuBar, "TOP", 0, 100)
But you didn't say what issues you were having so I don't know if taint was your problem or if the frames were moving on you.
This seesm to work.

The issues I was having is that when ever i would get in or out of a NPC vehicle the bars you just keep scrolling between the OverrideActionBar and the MainMenubar untill i disabled the addon. Maybe ity was because it was during the BFA pre launch or not but your suggestion seems to be working. Thanks again.
  Reply With Quote
08-11-18, 09:54 AM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,179
Vrul, does that mean that

UIPARENT_MANAGED_FRAME_POSITIONS[frame] = nil

In essence tells UIParent to stop handling the frame ?

If so its a might bit easier than changing the different functions to do nothing

If you don't mind I might utilise that block of code ( with full credit of course )
__________________
  Reply With Quote
08-11-18, 04:06 PM   #6
Vrul
A Frostmaul Preserver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 266
No, that table only has entries for certain things. I just nil it out in case that particular one is there (or gets added in the future).

For this case in particular, the code that positions MainMenuBar checks if either it or MicroButtonAnBagsBar IsUserPlaced then that code is skipped. However, ExtraActionBarFrame is in UIPARENT_MANAGED_FRAME_POSITIONS and is handled by a loop that iterates over it's entries. The code called in that loop also checks if ignoreFramePositionManager is set and exits out early.

There is one other case: CastingBarFrame:GetAttribute("ignoreFramePositionManager") so to also handle that you would need:
Code:
local function SetPosition(frame, ...)
    if type(frame) == 'string' then
        frame = _G[frame]
    end
    if type(frame) == 'table' and type(frame.IsObjectType) == 'function' and frame:IsObjectType('Frame') then
        local name = frame:GetName()
        if name then
            UIPARENT_MANAGED_FRAME_POSITIONS[name] = nil
        end
        frame:SetMovable(true)
        frame:SetUserPlaced(true)
        frame:SetDontSavePosition(true)
        frame:SetAttribute('ignoreFramePositionManager', true)
        frame.ignoreFramePositionManager = true
        if ... then
            frame:ClearAllPoints()
            frame:SetPoint(...)
        end
        frame:SetMovable(false)
    end
end
  Reply With Quote
08-11-18, 04:28 PM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,179
Ah, so pretty much what I do at present .. look at what will stop it working and try to implement the same think but that extra stuff I didn't realise we could play with.
__________________
  Reply With Quote
08-12-18, 08:01 AM   #8
cokedrivers
A Frostmaul Preserver
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 277


Ok so not everything is perfect.
As you can see in the image above when i got out of a NPC vehicle (last part to highmountain quest line bombing run) my number for the mainmenu bar disapeared and now the bar is none clickable. Only way to fix is to do a /reload and reload the UI.

Any thoughts?

Coke

Edit:

As you can see after a reload the bar number is visable and the buttons are clickable once again.

Last edited by cokedrivers : 08-12-18 at 08:03 AM.
  Reply With Quote
08-12-18, 09:49 AM   #9
cokedrivers
A Frostmaul Preserver
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 277
I just relized WoW moved the Xp bar below the MainmenuBar so now if the player is not Max Level the bar shows and my alignment is off.

So Ive been hunting for a solution but cant seem to find one.
Will the following work.
Code:
if UnitLevel("player") == MAX_LEVEL then
   SetPosition(MainMenuBar, "BOTTOM", cDataMainPanel, "TOP", 0, -4)
else
   SetPosition(MainMenuBar, "BOTTOM", cDataMainPanel, "TOP", 0, 9)
end
thanks for any help with this.
Coke
  Reply With Quote
08-12-18, 03:52 PM   #10
thomasjohnshannon
A Theradrim Guardian
 
thomasjohnshannon's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 60
Originally Posted by cokedrivers View Post
I just relized WoW moved the Xp bar below the MainmenuBar so now if the player is not Max Level the bar shows and my alignment is off.

So Ive been hunting for a solution but cant seem to find one.
Will the following work.
Code:
if UnitLevel("player") == MAX_LEVEL then
   SetPosition(MainMenuBar, "BOTTOM", cDataMainPanel, "TOP", 0, -4)
else
   SetPosition(MainMenuBar, "BOTTOM", cDataMainPanel, "TOP", 0, 9)
end
thanks for any help with this.
Coke
A little off topic but you can replace the max level bit with IsPlayerAtEffectiveMaxLevel(). They just added it to the api recently. They added that one and a few others.

Lua Code:
  1. -- takes into account the current expansion
  2.  -- NOTE: it's not safe to cache this value as it could change in the middle of the session
  3. function GetEffectivePlayerMaxLevel()
  4.   return MAX_PLAYER_LEVEL_TABLE[GetExpansionLevel()];
  5. end
  6.  
  7. function IsLevelAtEffectiveMaxLevel(level)
  8.   return level >= GetEffectivePlayerMaxLevel();
  9. end
  10.  
  11. function IsPlayerAtEffectiveMaxLevel()
  12.   return IsLevelAtEffectiveMaxLevel(UnitLevel("player"));
  13. end
__________________
Thomas aka Urnn
  Reply With Quote
08-13-18, 06:58 AM   #11
cokedrivers
A Frostmaul Preserver
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 277
Originally Posted by thomasjohnshannon View Post
A little off topic but you can replace the max level bit with IsPlayerAtEffectiveMaxLevel(). They just added it to the api recently. They added that one and a few others.

Lua Code:
  1. -- takes into account the current expansion
  2.  -- NOTE: it's not safe to cache this value as it could change in the middle of the session
  3. function GetEffectivePlayerMaxLevel()
  4.   return MAX_PLAYER_LEVEL_TABLE[GetExpansionLevel()];
  5. end
  6.  
  7. function IsLevelAtEffectiveMaxLevel(level)
  8.   return level >= GetEffectivePlayerMaxLevel();
  9. end
  10.  
  11. function IsPlayerAtEffectiveMaxLevel()
  12.   return IsLevelAtEffectiveMaxLevel(UnitLevel("player"));
  13. end
thank you for this
  Reply With Quote
08-14-18, 10:19 PM   #12
siweia
A Warpwood Thunder Caller
 
siweia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 97
Code:
8/15 11:57:08.685  An action was blocked in combat because of taint - MainMenuBar:SetPoint()
8/15 11:57:08.685      Interface\FrameXML\UIParent.lua:2943 <unnamed>:UIParentManageFramePositions()
8/15 11:57:08.685      Interface\FrameXML\UIParent.lua:2326
8/15 11:57:08.685      <unnamed>:SetAttribute()
8/15 11:57:08.685      Interface\FrameXML\UIParent.lua:3115
8/15 11:57:08.685      UIParent_ManageFramePositions()
8/15 11:57:08.685      Interface\FrameXML\PetActionBarFrame.lua:36
8/15 11:57:08.685      NDui_PetActionBar:Show()
8/15 11:57:08.685      Interface\FrameXML\SecureStateDriver.lua:100 resolveDriver()
8/15 11:57:08.685      Interface\FrameXML\SecureStateDriver.lua:127
Is there any way to hide the MainMenuBar without taint?
I just reparent it to a hidden frame, but causing taint.
  Reply With Quote
08-15-18, 08:28 AM   #13
Taudier
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 12
MainMenuBar:SetMovable(true)
MainMenuBar:SetUserPlaced(true)
MainMenuBar:SetPoint("BOTTOM", 100, 20)

-- this part to restore the MainMenuBar after vehicule exit
CreateFrame("frame", nil, nil, "SecureHandlerBaseTemplate" ):WrapScript(ActionButton1, "OnShow", [[
local MainMenuBarArtFrame = self:GetParent()
local MainMenuBar = MainMenuBarArtFrame:GetParent()
local UIParent = MainMenuBar:GetParent()
MainMenuBar:SetPoint("BOTTOM", UIParent, "BOTTOM", 100, 20)
]])

*it doesn't work if you display the right bottom multibar

Is there any way to hide the MainMenuBar without taint?
MainMenuBar:EnableMouse(false)
MainMenuBarArtFrame:Hide()

but you will have to make adjustment to other frames

Last edited by Taudier : 08-15-18 at 12:22 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Moving the MainMenuBar

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