09-08-06, 11:54 AM | #1 |
Add a tab to MailFrame
I'm trying to write a mod (my first) that will put a new tab on the mail frame. Feels like I'm getting close, but I could use a few clues to push me forward.
Reading the tabbed windows howto gave me some ideas, but it's awfully sketchy. I've created a frame, I am able to make MailFrame the parent of my frame, I can get my frame to display (in a really ugly cheesy way) when I run MailFrame:Show(). But my tab button doesn't show. Here's the XML: 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/ C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd"> <Script file="foo_client.lua"/> <Frame name="foo_frame_template" hidden="false" virtual="true" parent="MailFrame"> <Size> <AbsDimension x="250" y="250"/> </Size> <Anchors> <Anchor point="CENTER"/> </Anchors> <Backdrop name="$parentBackdrop" bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> <EdgeSize> <AbsValue val="16"/> </EdgeSize> <TileSize> <AbsValue val="32"/> </TileSize> <BackgroundInsets> <AbsInset left="5" right="5" top="5" bottom="5"/> </BackgroundInsets> </Backdrop> <Layers> <Layer level="BACKGROUND"> <Texture name="$parent_Background" setAllPoints="true"> <!-- Texture has blue color with 50% alpha --> <Color r="0" g="0" b="1" a="0.5" /> </Texture> </Layer> </Layers> </Frame> <Frame name="foo_client_frame" inherits="foo_frame_template"> <Layers> <Layer level="ARTWORK"> <FontString name="$parent_Text" inherits="GameFontNormal" justifyH="LEFT" text="Just some text" nonspacewrap="false" maxLines="3"> <Anchors> <Anchor point="LEFT" relativePoint="TOPLEFT" relativeTo="$parent_Text"> <Offset> <AbsDimension x="0" y="-34"/> </Offset> </Anchor> </Anchors> <Color r="1" g="1" b="1" a="1" /> <!-- White Color --> </FontString> </Layer> </Layers> <Frames> <Button name="$parent_Button" hidden="false" inherits="MailFrameTabButtonTemplate" text="Hello" id="3"> <Anchors> <Anchor point="BOTTOMRIGHT" relativeTo="$parent" /> </Anchors> <Scripts> <OnClick> Button_OnClick( arg1 ); </OnClick> </Scripts> </Button> </Frames> <Scripts> <OnLoad> this:RegisterEvent("VARIABLES_LOADED"); </OnLoad> <OnEvent> if ( event == "VARIABLES_LOADED" ) then foo_client_init(); end </OnEvent> </Scripts> </Frame> </Ui> Code:
MY_VERSION = "0.2" MY_FONT_COLOR = { r = 0, g = 255, b = 0 }; -- -- foo_client_init() -- function foo_client_init() -- Create slash commands SlashCmdList["FOO"] = foo_client_command; SLASH_FOO1 = "/foobar" SLASH_FOO2 = "/foo" -- Register for drag-and-drop. this:RegisterForDrag("LeftButton"); -- Announce success. DEFAULT_CHAT_FRAME:AddMessage( "Addon-with-no-name version "..MY_VERSION.." loaded", MY_FONT_COLOR.r, MY_FONT_COLOR.g, MY_FONT_COLOR.b ); end -- -- foo_client_command -- function foo_client_command( msg ) local frame = getglobal( "foo_client_frame" ) if (frame) then if ( frame:IsVisible() ) then frame:Hide(); else frame:Show(); end end end |
|
WoWInterface » Developer Discussions » General Authoring Discussion » Add a tab to MailFrame |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|