Adding new tab to the character frame
I am looking to add a new tab to the character panel, I did some googling and found a post here which mentioned how to add a new tab to the collections journal which I have amended to add the tab to the character panel instead, except unfortunately it doesn't seem to work.
The code is as follows. Is there any error in this code somewhere? the game itself doesn't report any errors. Code:
local TabName="MyNewTab"; |
Lua Code:
|
That works great thank you!
I added some comments, so I'd remember what does what in the future when I need to look at it again. I do have a question if I wanted to add stuff to the new Frame from an xml file how would I do that. The below sort of works in that it creates a new frame which is great, but it doesn't add to the tab on the character frame, instead it creates a standalone frame over the top of character pane, but slightly offset, this new frame does open when I click on my new tab. Also for my new tab is it possible to change the icon that is in the top left corner of my new tab to something else? Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ http://wowprogramming.com/FrameXML/UI.xsd"> |
Create the whole "Panel" frame in XML and use whatever name you give it in the
Code:
<Frame name="AeroMaxxDCharacterFrame" parent="CharacterFrame" frameStrata="HIGH" enableMouse="true" setallpoints="true" id="4"> Code:
tinsert(CHARACTERFRAME_SUBFRAMES, "AeroMaxxDCharacterFrame") -- or whatever name you gave it in XML Code:
<Frame name="$parentOuterContent" parentKey="OuterContent"...> and/or use the parentKey and in code you can use it as [code]AeroMaxxDCharacterFrame.OuterContent[C/ODE] |
Ok awesome I have some stuff on my new tab from the xml after lots of trial and error.
I do have something I can't figure when I the code below to the Frame that is the New tab on my character frame. A new frame shows up above the new tab frame, and it is slightly offset higher and more to the left. Code:
<Layers> Code:
<Frame name="AMD_CharacterFrame" parent="CharacterFrame" frameStrata="HIGH" enableMouse="true" setallpoints="true" id="4"> |
It's impossible to tell without all the code/xml.
If you type /fstack and place the mouse over the frame, you might get an idea of what it is (/fstack again to hide the tooltip). AMD_OuterContent has no size and is not anchored to anything so it doesn't seem to have a purpose unless it's moved/sized in code. |
I've made some small changes, the code below is the most current version, I've tried setting a size to the main frame, tried changing the anchor settings for the layer but it's never in the right place it's always offset a little.
I created a paste for you here. https://paste.ee/p/zzGka The XML code is on one tab and the LUA Code on another tab. Lua Code:
|
In your XML, you're using:
Lua Code:
Which is just a texture image of a standard game frame border with a portrait circle at the top left. You don't really need it as it's just the same as the Character Frame. Get rid of that section from the xml or if you have to use it, you will need to adjust the texture anchor to move it where you want. eg. Lua Code:
|
Probably better yet would be to get rid of the texture and if you need it, set your main panel frame to inherit the proper template, eg. the same as the CharacterFrame
Lua Code:
|
Yeah, your right, I don't need it I just liked the three buttons part at the bottom of the frame, but I have ditched it.
Would you happen to know where I can find out about what other templates I can use? |
You could add your own (or a game) texture to the bottom of your panel frame as a button background.
Quote:
|
Would you happen to know why there is a gold vertical line on this tab?
https://imgur.com/a/5FiQzbl XML is here. https://paste.ee/p/zzGka Code:
<Button name="$parent_Options" inherits="PanelTopTabButtonTemplate" text="Options"> |
Quote:
In your code you can (assuming I have the frame/tab name right): Lua Code:
But that will look worse ;) |
That didn't seem to work.
This is the button xml code. Code:
<Button name="$parent_Options" inherits="PanelTopTabButtonTemplate" text="Options"> Code:
<Frame name="AMD_TabOnCharacterFrame" parent="CharacterFrame" frameStrata="HIGH" enableMouse="true" movable="true" setallpoints="true" id="4"> Lua Code:
Edit: Actually they do seem to work, they don't get rid of the gold vertical line, they do however remove some text I had put on the frame. |
I didn't see the underscore so
Code:
AMD_TabOnCharacterFrame_Options.MiddleActive:Hide() Depending on where you put this in your code, you might need to make sure your .xml file is listed above your .lua file in the .toc (the files get loaded in order and the frame in the .xml file is created when the file is loaded). It's not going to look the way you want though as hiding the MiddleActive texture carves a notch in the top of the tab. You either need to live with the gold line or make a texture to replace the one being used for MiddleActive or create your own tab button and textures. |
Quote:
Quote:
Quote:
Addon development for a newbie/novice is a very long-winded process! |
With some more digging, instead of hiding the MiddleActive texture, you should be able to use PanelTemplates functions to control the tab:
Change: Lua Code:
To: Lua Code:
I don't know if you have more tabs buttons on the frame so the code may need to change if you have more. |
Quote:
|
Also, the tab I was using to set options for the addon itself, but I am trying to use the Interface Options within the escape menu instead.
|
All times are GMT -6. The time now is 01:03 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI