View Single Post
07-10-09, 05:42 PM   #6
Katae
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 208
Originally Posted by zerodark9 View Post
I guess i'm too new to messing around with the UI to know how exactly to make this work. I have read the documentation but still am very lost.

Would it be possible for you to post your complete lua file so I may see what you did where. That way I have something to go one instead of being completely in the dark.
Hi zerodark! First, you'll need to create a layout. To create one, your layout.lua file will start out looking much like this:

Code:
lpanels:CreateLayout("LayoutName", {
     -- Panel code for this layout will go right here.
}, { bottom = 150, top = 10 }) -- Optional viewport config
This is what a basic layout code looks like. Creating a layout alone will not apply it, you'll need to add that. The first string is the profile, strings after the profile are the names of your layouts you want to apply to the profile. If the profile string is nil, the layouts will be applied to ALL characters. Here's a basic profile you can use for unique characters.
Code:
lpanels:ApplyLayout("n:yourchar r:yourrealm", "LayoutName", "AnotherLayout")
ApplyLayout can be used for as many profiles you need. The profile string is very flexible and NOT case-sensitive, please see the included docs for more examples. Note that all spaces in the realm name must be removed.

Next, you'll want to start making your panels. Lets say, for example, you want to make a black bar at the bottom of your UI. You would use something like this panel code inside of your layout, between the first set of {curly braces}:

Code:
{   name = "BlackBar",    -- names your panel "BlackBar"
    anchor_to = "BOTTOM",    -- positions it at the bottom of the UI
    y_off = 20,        -- moves the whole panel 5 pixels UP
    width = "100%",        -- sets the width to 100% of the UI
    height = 30,        -- sets the height to 30 pixels
    bg_color = "0 0 0",    -- sets the background color to black (r g b) 
    bg_alpha = 0.5,        -- sets the transparency to 50% opaque
},
Great, now maybe you'd like to put a 1 pixel border on the top and bottom of that panel, perhaps you want the color to be of your class. Now your layout will begin to start looking something like this:

Code:
-- Your original black bar panel
{   name = "BlackBar", 
    anchor_to = "BOTTOM", y_off = 20,
    width = "100%", height = 30,
    bg_color = "0 0 0", bg_alpha = 0.4,
},

-- Your new 1 pixel borders, first on the top, second on the bottom of BlackBar
{   name = "BorderTop", parent = "BlackBar",
    anchor_to = "TOP", -- Anchoring to the TOP of "BlackBar"
    width = "100%", height = 1,
    bg_color = "CLASS", bg_alpha = 0.75,
},
{   name = "BorderBottom", parent = "BlackBar",
    anchor_to = "BOTTOM", -- Anchoring to the BOTTOM of "BlackBar"
    width = "100%", height = 1,
    bg_color = "CLASS", bg_alpha = 0.75,
},
Reminder, always always always, put a comma after your closing brackets and attribute values like I have done in the examples. This is probably the top syntax error of all time.

If all was done correctly, you should now have a bar with 2 borders that looks like this.



You'll use other attributes from the documentation such as gradients and textures much the same way. You should also note that every single panel attribute has a default value, which are noted in the docs.

Hope this has cleared up some things for you!

Last edited by Katae : 08-31-11 at 05:01 AM.
  Reply With Quote