WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Moving the MainMenuBar (https://www.wowinterface.com/forums/showthread.php?t=56519)

cokedrivers 08-10-18 06:51 AM

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

Aftermathhqt 08-11-18 03:57 AM

Try

Lua Code:
  1. MainMenuBar.ignoreFramePositionManager = true

Vrul 08-11-18 06:16 AM

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.

cokedrivers 08-11-18 07:38 AM

Quote:

Originally Posted by Vrul (Post 329455)
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.

Xrystal 08-11-18 09:54 AM

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 :) )

Vrul 08-11-18 04:06 PM

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


Xrystal 08-11-18 04:28 PM

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.

cokedrivers 08-12-18 08:01 AM



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.

cokedrivers 08-12-18 09:49 AM

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

thomasjohnshannon 08-12-18 03:52 PM

Quote:

Originally Posted by cokedrivers (Post 329488)
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

cokedrivers 08-13-18 06:58 AM

Quote:

Originally Posted by thomasjohnshannon (Post 329514)
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

siweia 08-14-18 10:19 PM

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.

Taudier 08-15-18 08:28 AM

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

Quote:

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

Drudatz 08-21-18 04:07 PM

Quote:

Originally Posted by cokedrivers (Post 329487)
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.

I have the EXCACT same problem everytime after I do a Tortollan Quests like Beach Head or Make Loa Go.
Code:

MainMenuBar:SetMovable(true)
MainMenuBar:SetUserPlaced(true)
MainMenuBar:ClearAllPoints()
MainMenuBar:SetPoint("CENTER", UIParent, "BOTTOM", 0, 40)
MainMenuBar:SetScale(0.75)

the strange thing is my MultiBarRight works fine

Code:

MultiBarRight:SetMovable(true)
MultiBarRight:SetUserPlaced(true)
MultiBarRight:ClearAllPoints()
MultiBarRight:SetPoint("BOTTOM", WorldFrame, "RIGHT", -20, -620)

any help would be REALLY apreciated!

Drudatz 08-23-18 03:11 PM

Okay with Taudiers tip it works now
(even though I HAVE MultiBarRight enabled and visible).
I just react on PLAYER_CONTROL_GAINED and it works again.

Code:

                if event:match("PLAYER_CONTROL_GAINED") then
                        CreateFrame("frame", nil, nil, "SecureHandlerBaseTemplate" ):WrapScript(ActionButton1, "OnShow", [[
                                print("ACTION!")
                                local MainMenuBarArtFrame = self:GetParent()
                                local MainMenuBar = MainMenuBarArtFrame:GetParent()
                                local UIParent = MainMenuBar:GetParent()
                                MainMenuBar:SetPoint("CENTER", UIParent, "BOTTOM", 0, 40)
                        ]])
                end


Taudier 08-26-18 02:30 AM

Quote:

Originally Posted by Drudatz (Post 329793)
Okay with Taudiers tip it works now
(even though I HAVE MultiBarRight enabled and visible).
I just react on PLAYER_CONTROL_GAINED and it works again.

Code:

                if event:match("PLAYER_CONTROL_GAINED") then
                        CreateFrame("frame", nil, nil, "SecureHandlerBaseTemplate" ):WrapScript(ActionButton1, "OnShow", [[
                                print("ACTION!")
                                local MainMenuBarArtFrame = self:GetParent()
                                local MainMenuBar = MainMenuBarArtFrame:GetParent()
                                local UIParent = MainMenuBar:GetParent()
                                MainMenuBar:SetPoint("CENTER", UIParent, "BOTTOM", 0, 40)
                        ]])
                end


it doesn't work only with the Bottom MultiBarRight. For the other bars it works fine. Your code is wrong, primarily because you can't create a SecureFrame ("SecureHandlerBaseTemplate") in combat. Why do you need to react on "PLAYER_CONTROL_GAINED" ? When you exit a vehicule it triggers MainMenuBar "OnShow". Any scenario where it didn't work ?

Drudatz 08-26-18 12:41 PM

Quote:

Originally Posted by Taudier (Post 329853)
it doesn't work only with the Bottom MultiBarRight. For the other bars it works fine. Your code is wrong, primarily because you can't create a SecureFrame ("SecureHandlerBaseTemplate") in combat. Why do you need to react on "PLAYER_CONTROL_GAINED" ? When you exit a vehicule it triggers MainMenuBar "OnShow". Any scenario where it didn't work ?

doesnt matter if OnShow or Control Gained it only works for me at max level (120) anyway.
When I level and for example do the quests Forcing Fate's Hand (where you control the undead hand at the dead turtle loa) afterwards the bottom bar is completely unusable.

Taudier 08-27-18 01:05 AM

well, if every wrong codes didn't work at all i guess they all would work

zork 08-27-18 01:53 AM

Hmmm...I have no problems with the main menu bar in rActionBar.
That is of course because I am disabling the default main menu bar and the override action bar. I am using all the buttons though by reparenting them.
Couldn't you just put a background texture somewhere and put sth like rActionBar (or any other bar mod) on top if it is giving you so much trouble?

Drudatz 08-27-18 03:18 PM

Quote:

Originally Posted by zork (Post 329868)
Hmmm...I have no problems with the main menu bar in rActionBar.
That is of course because I am disabling the default main menu bar and the override action bar. I am using all the buttons though by reparenting them.
Couldn't you just put a background texture somewhere and put sth like rActionBar (or any other bar mod) on top if it is giving you so much trouble?

Well the problem started with BFA when I had to use
Code:

MainMenuBar:SetMovable(true)
MainMenuBar:SetUserPlaced(true)
MainMenuBar:ClearAllPoints()
MainMenuBar:SetPoint("CENTER", UIParent, "BOTTOM", 0, 40)

just so that MainMenuBar:SetScale(0.75) would work again.

What is strange is that it ONLY affects MainMenuBar but NOT MultiBarRight and that
Taudiers fixes it IF the toon is max level.

@Taudier: what is wrong about YOUR code?


All times are GMT -6. The time now is 08:33 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI