WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Helps with Kgpanels! (https://www.wowinterface.com/forums/showthread.php?t=46786)

Akatosh 07-07-13 12:04 PM

Helps with Kgpanels!
 
Hi all!.

I am trying to remove databroker addons and use kgpanels with scrpts for my interface.

I want put a part of the text in class colored, and the other in white.

At this point I have that cripts.

On load:

Quote:

local font, size, flags = self.text:GetFont()
self.text:SetFont(font, size, "OUTLINE," .. flags)
local _, Class = UnitClass("player")
local Color = RAID_CLASS_COLORS[Class]
self.text:SetTextColor(Color.r,Color.g,Color.b)

self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")
FPS_UPDATE = 0
FPS_RATE = 1
OnUpdate:
Quote:

FPS_UPDATE = FPS_UPDATE + elapsed
if FPS_UPDATE > FPS_RATE then
local fps = GetFramerate()
self.text:SetText(string.format("%0.i fps",fps))
FPS_UPDATE = 0.1
end
Result:




¿Can be posible text color like the example?:




Thx to all!!

Fizzlemizz 07-07-13 02:09 PM

In OnUpdate:
local fps = "|c00FFFFFF".. string.format("%0.i", GetFramerate()) .. " |rfps"
self.text:SetText(fps)

Edit: A description of escape sequences: http://www.wowpedia.org/UI_escape_sequences

Akatosh 07-07-13 02:49 PM

Quote:

Originally Posted by Fizzlemizz (Post 280916)
In OnUpdate:
local fps = "|c00FFFFFF".. string.format("%0.i", GetFramerate()) .. " |rfps"
self.text:SetText(fps)

Edit: A description of escape sequences: http://www.wowpedia.org/UI_escape_sequences

Work ok, very thanks!!!, now I aply to all elements!!.

Phanx 07-07-13 07:20 PM

Instead of:

Code:

local fps = "|c00FFFFFF".. string.format("%0.i", GetFramerate()) .. " |rfps"
self.text:SetText(fps)

Use:

Code:

self.text:SetFormattedText("|cffffffff%0.i|r fps", GetFramerate())
This passes the string.format operation to the C code backend instead of doing it in Lua, so it's faster, and creates less string garbage.

Also, string.format can handle plain text, so you should just put all your text in the format string, instead of performing multiple concatenation operations and creating more strings.

Finally, in your original code, FPS_UPDATE and FPS_RATE are defined global variables. You should avoid putting anything into the global namespace unless it's absolutely necessary, and when you do, make sure the names are unique (so, not FPS_RATE which is very generic and likely to collide with other addons leaking globals) and clearly identify them as belonging to your addon. In this case, it's not necessary, so you should not make them globals:

Code:

local font, size, flags = self.text:GetFont()
self.text:SetFont(font, size, "OUTLINE")

local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.text:SetTextColor(color.r, color.g, color.b)

self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

self.update = 0
self.rate = 1

Code:

self.update = self.update + elapsed
if self.update >= self.rate then
  self.text:SetFormattedText("|cffffffff%0.i|r fps", GetFramerate())
  self.update = 0
end

Oh, and in color codes, you should always begin with "|cff", not "|c00". That first hex pair represents the opacity of the contained text. 00 represents 0% opacity, which is invisible. You want ff, which represents 100% opacity. In practice it isn't important because the opacity is ignored in most (if not all) contexts in WoW, but that's not an excuse for passing the wrong value. You want visible text, so you shouldn't specify that you want invisible text and rely on the value being ignored -- just specify the value you actually want.

Akatosh 07-08-13 12:15 PM

Thx!, its very frustrating... I want do a lot of modificatons in my interface.... but I dont have no Idea of lua... I have a lot of questions... If maybe Someone can help me via skype voice client program or chat or something... I would be very grateful

Thanks for the help.

Fizzlemizz 07-08-13 01:02 PM

Posting questions here should get you all the help you need and it will be available to help others as well as Phanxs correction of my interpretaion of your problem has helped me find a more efficient way of doing things.

Akatosh 07-08-13 01:29 PM

Okok, I understand.

can someone help me with that question?¿

http://www.wowinterface.com/forums/s...92&postcount=4

I have a lot of questions more:

1. How can I do for One click (on kgpanels) open the bags, and one click more close the bags.?

2. how can I do for 1 click (on kgpanels) open the calendar, and one click close the calendar.?

3. how can I do for a panel that show me the gold in that format?: 111g 111s 111c?

4. how can i do for panel of cords with xx, yy format?

I have a lot of more questions but for now is enought, I think that be usefull for me and a lot of people too.

Thanks!!

Fizzlemizz 07-08-13 02:42 PM

I can show you what I do with Discord Art which might be addaptable to KgPanels.

For displaying money, in on OnUpdate script
Code:

local m = GetMoney()
local gold = floor(m/10000)
local silver = floor((m - (10000*gold))/100)
self.text:SetText(gold .. "g " .. silver .. "s " .. m - (10000*gold) - (100*silver) .. "c")

For coords:
Code:

In an OnLoad Script:
self:RegisterEvent("MINIMAP_ZONE_CHANGED")

In an OnEvent script:
Code:

if event == "MINIMAP_ZONE_CHANGED" then
    self.needZoneUpdate = true
end

In an OnUpdated script:
Code:

if self.needZoneUpdate and not WorldMapFrame:IsVisible() then
    self.needZoneUpdate = false
    SetMapToCurrentZone()
end
local x,y = GetPlayerMapPosition("player")
x = format("%.1f", x*100)
y = format("%.1f", y*100)
self.text:SetText(25, x .. " " .. y)

Opening bags, in an OnClick script:
Code:

OpenAllBags()
To show/Hide the calendar: in an OnClick script:
Code:

if CalendarFrame:IsVisible() then
    CalendarFrame:Hide()
else
    CalendarFrame:Show()
end

See also reply in other thread. I think that covers them all :)

Phanx 07-08-13 02:45 PM

Quote:

Originally Posted by Akatosh (Post 280948)
1. How can I do for One click (on kgpanels) open the bags, and one click more close the bags.?

Code:

if pressed then ToggleAllBags() end
Quote:

Originally Posted by Akatosh (Post 280948)
2. how can I do for 1 click (on kgpanels) open the calendar, and one click close the calendar.?

Code:

if pressed then Calendar_Toggle() end
Quote:

Originally Posted by Akatosh (Post 280948)
3. how can I do for a panel that show me the gold in that format?: 111g 111s 111c?

4. how can i do for panel of cords with xx, yy format?

kgPanels is not really meant for that sort of thing. I'd suggest using a DataBroker display with existing gold and coordinate plugins instead. StatBlocksCore can give you standalone blocks for each plugin if that's the kind of thing you're into, and you can attach a kgPanels background texture if you want. If you want a traditional "info bar" I'd recommend Bazooka.

Akatosh 07-08-13 03:34 PM

Ok, Thanks for all the help!!.

I try to aply the changes I said something when I do it.

Fizzlemizz 07-08-13 03:39 PM

For the calendar it would be better to use Calendar_Toggle() than what I posted. I didn't know the function existed as it's not documented at wowprogramming.com or wowpedia.org.

The reason I use DART and not an info bar is because I haven't found one that offers all the colouring options I want. Fussy of me I know but that's the nature of the Fizzle.

Phanx 07-08-13 04:46 PM

Quote:

Originally Posted by Fizzlemizz (Post 280954)
The reason I use DART and not an info bar is because I haven't found one that offers all the colouring options I want. Fussy of me I know but that's the nature of the Fizzle.

Well, I'd have to say that writing a simple Broker plugin that colors the text the way you want would still be a better solution than shoehorning data display into an art panel addon. Plus, there are already Broker plugins to toggle your bags, calendar, and anything else you can imagine, no code-writing required.

Fizzlemizz 07-08-13 05:08 PM

Quote:

Originally Posted by Phanx (Post 280960)
Well, I'd have to say that writing a simple Broker plugin that colors the text the way you want would still be a better solution than shoehorning data display into an art panel addon. Plus, there are already Broker plugins to toggle your bags, calendar, and anything else you can imagine, no code-writing required.

It's not really shoehorning as DART is already set up for displaying text as well as art, has the built in scripting points, setup window for easy positioning yada yada yada and as I'm already using it for my background so I'd be duplicating a lot of the plumbing creating yet another addon just to scrape an extra poofteenth of efficiency out of it.

Lua not being my most proficient language, as you have pointed out on several occaisions (thank you), I doubt I would do a better job anyway.

Akatosh 07-26-13 06:34 PM

Hello all again!!

I was away from the computer for unavoidable causes.
Now I have time .... and questions ...

Sorry if I am very picky ...

1º Make a clock with no military time (aka 12 hours), example: 12:34 am.
2º Can be possible a panel with Zone and Subzone text, with color variation depending of the type of zone (PvP, Sanctuary, City etc.), for example:

Zone, Subzone (hostile)
Zone, Subzone (in sanctuary)
Zone, Subzone (non hostile)

Etc...

3º maybe that be imposible... or very hard:

¿Can be posible a panel that show me the memory usage of the addons?, and when I mouse over it show me a tooltip with a list of the Addons with that format? for example:

________
| 10 MB | <---- Mouseover (tootip)
---------

Kgpanels config 2.8 MB
Kgpanels 711KB.

etc etc


I want to centralize everything I can in the kgpanels.

Thanks!!!

Phanx 07-26-13 09:44 PM

Again, I just don't get why you are spending all this time and energy bending kgPanels to this purpose, instead of just using a Broker display addon that already exists, with any of the many Broker plugins that already exist to show you time, memory usage, and zone info.

Akatosh 07-27-13 10:03 AM

Quote:

Originally Posted by Phanx (Post 281614)
Again, I just don't get why you are spending all this time and energy bending kgPanels to this purpose, instead of just using a Broker display addon that already exists, with any of the many Broker plugins that already exist to show you time, memory usage, and zone info.

Sorry if I'm asking is not very logical...

Each addon need 200KB ~, with functions that I dont use, I think that 5 or 6 lines of code, be better in general, for less CPU / Memory usage.

I dont have a lot of idea of lua code...I wish I was able to do it myself ... looking for internet forums, I do not bring any solution, I'm asking here as a last resort trying to disturb as little as possible ... Sorry.

Seerah 07-27-13 12:40 PM

Is your computer running short on memory? ;) Wanting to learn how to code is perfectly fine - though if that were the case we would still encourage you to create standalone addons instead of using kgPanels. But if all you're worried about is saving 1MB in memory? :) (Which, actually, I'm not even certain the plugins each take 200kb+)

Fizzlemizz 07-27-13 01:43 PM

Personally I've found it quite handy to use Discord Art to do this sort of thing but I'm already using it for other things as well.

Anyway Akatosh if you decide to proceed with KgPanels here's the code for a clock.

Code:

local minutes, hour, minute
local t = date("*t", time())
hour = t.hour
minute = t.min
minutes = (hour*60) + minute
if (minutes > 1440) then
    minutes = minutes - 1440
end
minutes = abs(minutes)
hour = floor(minutes/60)
minute = format("%02d", mod(minutes, 60))
local text
if minutes > 719 then
    if minutes > 779 then
        hour = floor(minutes/60) - 12
    end
    text = hour .. ":" .. minute .. " pm"
else
    if (hour == 0) then
        hour = 12
    end
    text = hour .. ":" .. minute .. " am"
end
-- do whatever KgPanels uses to update the display with text.

About the only thing that would be difficult would be the memory usage.

Akatosh 07-27-13 02:33 PM

Quote:

Originally Posted by Fizzlemizz (Post 281646)
Personally I've found it quite handy to use Discord Art to do this sort of thing but I'm already using it for other things as well.

Anyway Akatosh if you decide to proceed with KgPanels here's the code for a clock.

Code:

local minutes, hour, minute
local t = date("*t", time())
hour = t.hour
minute = t.min
minutes = (hour*60) + minute
if (minutes > 1440) then
    minutes = minutes - 1440
end
minutes = abs(minutes)
hour = floor(minutes/60)
minute = format("%02d", mod(minutes, 60))
local text
if minutes > 719 then
    if minutes > 779 then
        hour = floor(minutes/60) - 12
    end
    text = hour .. ":" .. minute .. " pm"
else
    if (hour == 0) then
        hour = 12
    end
    text = hour .. ":" .. minute .. " am"
end
-- do whatever KgPanels uses to update the display with text.

About the only thing that would be difficult would be the memory usage.

Thanks for trusting me! but... I put the code onUpdate section and nothing appear.

Fizzlemizz 07-27-13 02:44 PM

Essentially what I've given you is the variable called "text" that contains the information you want.
The following line needs to be replaced using whatever KgPanels does to update the display with the information from this "text" variable.

-- do whatever KgPanels uses to update the display with "text"

if
self.text:SetText(gold .. "g " .. silver .. "s " .. m - (10000*gold) - (100*silver) .. "c")
worked with your gold display then try:

self.text:SetText(text)

Akatosh 07-27-13 02:56 PM

Quote:

Originally Posted by Fizzlemizz (Post 281654)
Essentially what I've given you is the variable called "text" that contains the information you want.
The following line needs to be replaced using whatever KgPanels does to update the display with the information from this "text" variable.

-- do whatever KgPanels uses to update the display with "text"

if
self.text:SetText(gold .. "g " .. silver .. "s " .. m - (10000*gold) - (100*silver) .. "c")
worked with your gold display then try:

self.text:SetText(text)

Thanks!!

For the text of gold I use that, and works fine, (atleast for me).

Quote:

Onload

local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.text:SetTextColor(color.r, color.g, color.b)
Quote:

Onupdate

local m = GetMoney()
local gold = floor(m/10000)
local silver = floor((m - (10000*gold))/100)
local cooper = m - (10000*gold) - (100*silver)


self.text:SetText(string.format("Gold: |cffffffff%d|cffffcc00g |cffffffff%d|cffc0c0c0s |cffffffff%d|cff996600c",gold,silver,cooper))
For the --text Etc..I do not understand English very well so I do not understand what you mean by this ... leave me a little time to assimilate it.

Edit:

ok ok now understood!

Quote:

local minutes, hour, minute
local t = date("*t", time())
hour = t.hour
minute = t.min
minutes = (hour*60) + minute
if (minutes > 1440) then
minutes = minutes - 1440
end
minutes = abs(minutes)
hour = floor(minutes/60)
minute = format("%02d", mod(minutes, 60))
local text
if minutes > 719 then
if minutes > 779 then
hour = floor(minutes/60) - 12
end
self.text:SetText(hour .. ":" .. minute .. " pm")
else
if (hour == 0) then
hour = 12
end
self.text:SetText(hour .. ":" .. minute .. " am")
end
With that, works fine, now I try to class color the text With White (hour) / classcolored (am/pm),wait a sencond and I put the code, I did it with some items I think I can do this too

Thanks!!

Edit2:

Quote:

OnLoad

local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.text:SetTextColor(color.r, color.g, color.b)
Quote:

OnUpdate

.. self.text:SetText(string.format("|cffffffff%d:%d|r pm", hour,minute))
else
if (hour == 0) then
hour = 12
end
self.text:SetText(string.format("|cffffffff%d:%d|r am", hour,minute))
end..
itis curious but I have no zeros on left, example: 11:9pm Can you help me to fix that?

Thanks!!

Fizzlemizz 07-27-13 03:13 PM

If you are going to do it this way you can delete the line:

"local text"

as you are not using the variable named text in your script ;).

Akatosh 07-27-13 03:27 PM

Quote:

Originally Posted by Fizzlemizz (Post 281658)
If you are going to do it this way you can delete the line:

"local text"

as you are not using the variable named text in your script ;).

Ok I remove that line, Now I have a little problem... I have no zeros on left side of the tex, I edit my last post to explain it, you can help me to fix that?

Akatosh 07-27-13 04:09 PM

Quote:

Originally Posted by Akatosh (Post 281660)
Ok I remove that line, Now I have a little problem... I have no zeros on left side of the tex, I edit my last post to explain it, you can help me to fix that?

I see the light man!!! I have no idea how can appear in my mind but works good now, I see the code of coords... And I say to me... Umm that be very similar, I put ".i" and nothing changed, ummm maybe if y put 2 appear 1 number more, and bammm.

The part of "OnLoad" be the some.

Now in OnUpdate:

Quote:

local minutes, hour, minute
local t = date("*t", time())
hour = t.hour
minute = t.min
minutes = (hour*60) + minute
if (minutes > 1440) then
minutes = minutes - 1440
end
minutes = abs(minutes)
hour = floor(minutes/60)
minute = format("%02d", mod(minutes, 60))
if minutes > 719 then
if minutes > 779 then
hour = floor(minutes/60) - 12
end
self.text:SetText(string.format("|cffffffff%2i:%2i|r pm", hour,minute))
else
if (hour == 0) then
hour = 12
end
self.text:SetText(string.format("|cffffffff%2i:%.2i|r am", hour,minute))
end
Thanks for all, now I can zocus on the part of zone and subzone (with colors).

Akatosh 07-30-13 05:00 AM

News!

I modify the codes that Phanx and Fizzlemizz provided to me (thanks), I explain, with one of the codes, the calendar works, but only when previously I loaded it manually the blizzard calendar with "/calendar", with the other code, when I click the panel, the frame of calendar only shows the time that I "mouse down" when I "mouse up", the frame disappear.

I try to modify the codes viewing codes of brokers and other lua relationated codes of calendar.

Finaly I got this:

Quote:

if pressed and (not IsAddOnLoaded("Blizzard_Calendar")) then
UIParentLoadAddOn("Blizzard_Calendar")
Calendar_Show()
else
if pressed and (IsAddOnLoaded("Blizzard_Calendar")) then
Calendar_Toggle()
end
end
With that works now exactly how I want.

Thanks for all slowly, I am learning a lot and... I like!

Akatosh 07-30-13 12:23 PM

Hi!.

I have new questions!.

I want make a zonetext panels colored by pvp status.

I find information for other lua codes and for now I have this (Dont work of course Xddddd).

OnLoad

Quote:

local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PLAYER_FLAGS_CHANGED")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
self:RegisterEvent("PLAYER_LOGIN")
OnEvent
Quote:

zone = GetRealZoneText()
subzone = GetSubZoneText()
self.text:SetText(string.format("%s, %s",zone,subzone))
Who I need:

1º:a class colored text based on pvp status, I extract that lua code, maybe can be usefull:

Quote:

local pvpType, isFFA, faction = GetZonePVPInfo()
if(pvpType == "friendly") then
col = "00ff00"
elseif(pvpType == "hostile") then
col = "ff0000"
elseif(pvpType == "arena") then
col = "ffff00"
elseif(pvpType == "hostile" or pvpType == "combat" or pvpType=="contested") then
if(faction == select(2,UnitFactionGroup('player'))) then
col = "886600"
else
col = "ff0000"
end
elseif(pvpType == "sanctuary") then
col = "9999ff"
else
return txt
end
return addon['colorize'](txt, col)
But I dont have idea how can I apply to text.

2º: When I enter in a zone with no subzone appear only the Main zone, for example, I enter on Dalaran, appear "Dalaran, Dalaran", When the correct be that only appear 1 dalaran: "Dalaran".

Any help will be greatly appreciated Thanks!!!

Fizzlemizz 07-30-13 01:17 PM

If you weant sub-zone information you will also need to register "ZONE_CHANGED".

The "ZONE_CHANGED_NEW_AREA" event fires whe you cross zone borders and "ZONE_CHANGED" when you cross unto a new sub-zone. You might also want to register "ZONE_CHANGED_INDOORS" which is trggered when you go from inside to out or outside to in.

You can find the list of zone related functions at WowProgramming.

Akatosh 07-30-13 01:49 PM

Quote:

Originally Posted by Fizzlemizz (Post 281968)
If you weant sub-zone information you will also need to register "ZONE_CHANGED".

The "ZONE_CHANGED_NEW_AREA" event fires whe you cross zone borders and "ZONE_CHANGED" when you cross unto a new sub-zone. You might also want to register "ZONE_CHANGED_INDOORS" which is trggered when you go from inside to out or outside to in.

You can find the list of zone related functions at WowProgramming.

Thanks for the tip!!.

I added to "Onload" section.

If you can help me with colored text....

¿how can I do for do a text colored zonetext based on pvp status?.

I have this base code maybe can help:

Quote:

local pvpType, isFFA, faction = GetZonePVPInfo()
if(pvpType == "friendly") then
col = "00ff00"
elseif(pvpType == "hostile") then
col = "ff0000"
elseif(pvpType == "arena") then
col = "ffff00"
elseif(pvpType == "hostile" or pvpType == "combat" or pvpType=="contested") then
if(faction == select(2,UnitFactionGroup('player'))) then
col = "886600"
else
col = "ff0000"
end
elseif(pvpType == "sanctuary") then
col = "9999ff"
I need help on the second point to:

2º: When I enter in a zone with no subzone appear only the Main zone, for example, I enter on Dalaran, appear "Dalaran, Dalaran", When the correct be that only appear 1 dalaran: "Dalaran".

A lot of Thanks Fizzlemizz.

Fizzlemizz 07-30-13 02:41 PM

The code appears to be only part of a function for getting the appropriate colour. It also seems to asume the the alpha chanel will be set elsewhere but I'll change to set it here
Code:

local col
local pvpType, isFFA, faction = GetZonePVPInfo()
if(pvpType == "friendly") then
        col = "ff00ff00" -- friendly colour
elseif(pvpType == "hostile") then
        col = "ffff0000" -- hostile colour
elseif(pvpType == "arena") then
        col = "ffffff00"  -- arena colour
elseif(pvpType == "hostile" or pvpType == "combat" or pvpType=="contested") then
        if(faction == select(2,UnitFactionGroup('player'))) then
                col = "ff886600" -- faction colour for player
        else
                col = "ffff0000" -- other faction colour colour for player
        end
elseif(pvpType == "sanctuary") then
        col = "ff9999ff"  -- sanctuary colour
end

As for changing zones something like:
Code:

local zone, subzone
if event == "ZONE_CHANGED_NEW_AREA" then
        zone = GetRealZoneText()
        self:text:SetText(zone)
elseif event == "ZONE_CHANGED" then
        zone = GetRealZoneText()
        subzone = GetSubZoneText()
        if subzone == "" then
                self:text:SetText(zone)
        else
                self:text:SetText(subzone)
        end
end


jeruku 07-30-13 02:41 PM

Is the following what you are looking for?

For the multi-zone feature you should note that ALL GetZone functions return the Zone if there is no Sub-Zone. The colors are a tad tricky but if those are the accepted values then that works.
If you're more comfortable with one single object then replace the 'return string.format' with 'self.text:SetFormattedText'.
Code:

local pvpType, _, faction = GetZonePVPInfo()
local col
if(pvpType == "friendly") then
    col = "00ff00"
elseif(pvpType == "hostile") then
    col = "ff0000"
elseif(pvpType == "arena") then
    col = "ffff00"
elseif(pvpType == "combat" or pvpType=="contested") then
    if(faction == select(2,UnitFactionGroup('player'))) then
          col = "886600"
    else
          col = "ff0000"
    end
elseif(pvpType == "sanctuary") then
    col = "9999ff"
else
    col = "00ff00"
end
local zone, sub = GetZoneText(), GetSubZoneText()
if sub == zone then
    return string.format("|cff%s%s|r", col, zone)
else
    return string.format("|cff%s%s, %s|r", col, zone, sub)
end


Fizzlemizz 07-30-13 03:01 PM

I was just about to post something similar. I changed the returns because Akatosh is using this in a KgPanels script not as a standalone function. Also changed a bit because sub can be blank.

Code:

if sub == "" then
    self.text:SetText(string.format("|cff%s%s|r", col, zone))
else
    self.text:SetText(string.format("|cff%s%s|r", col, sub))
end


Akatosh 07-30-13 03:16 PM

Quote:

Originally Posted by jeruku (Post 281972)
Is the following what you are looking for?

For the multi-zone feature you should note that ALL GetZone functions return the Zone if there is no Sub-Zone. The colors are a tad tricky but if those are the accepted values then that works.
If you're more comfortable with one single object then replace the 'return string.format' with 'self.text:SetFormattedText'.
Code:

local pvpType, _, faction = GetZonePVPInfo()
local col
if(pvpType == "friendly") then
    col = "00ff00"
elseif(pvpType == "hostile") then
    col = "ff0000"
elseif(pvpType == "arena") then
    col = "ffff00"
elseif(pvpType == "combat" or pvpType=="contested") then
    if(faction == select(2,UnitFactionGroup('player'))) then
          col = "886600"
    else
          col = "ff0000"
    end
elseif(pvpType == "sanctuary") then
    col = "9999ff"
else
    col = "00ff00"
end
local zone, sub = GetZoneText(), GetSubZoneText()
if sub == zone then
    return string.format("|cff%s%s|r", col, zone)
else
    return string.format("|cff%s%s, %s|r", col, zone, sub)
end


Quote:

Originally Posted by Fizzlemizz (Post 281974)
I was just about to post something similar but I think most common use would be

Code:

if sub == zone then
    self.text:SetText(string.format("|cff%s%s|r", col, zone))
else
    self.text:SetText(string.format("|cff%s%s|r", col, sub))
end

I also changed the returns because Akatosh is using this in a KgPanels script not as a standalone function.


Hi all a lot of thanks!!!!, I am very happy.

It works... not exactly one of other... a mix of the two:

Quote:

local pvpType, _, faction = GetZonePVPInfo()
local col
if(pvpType == "friendly") then
col = "00ff00"
elseif(pvpType == "hostile") then
col = "ff0000"
elseif(pvpType == "arena") then
col = "ffff00"
elseif(pvpType == "combat" or pvpType=="contested") then
if(faction == select(2,UnitFactionGroup('player'))) then
col = "886600"
else
col = "ff0000"
end
elseif(pvpType == "sanctuary") then
col = "9999ff"
else
col = "00ff00"
end
local zone, sub = GetZoneText(), GetSubZoneText()
if sub == zone then
self.text:SetText(string.format("|cff%s%s|r", col, zone))
else
self.text:SetText(string.format("|cff%s%s, %s|r", col, zone, sub))
end
120kbs less of memory usage (1 addon) for 25 lines.

I put OnClick:
Quote:

ToggleFrame(WorldMapFrame)
Now that panel is complete!!, ever is less, to finish the interface with your help.

jeruku 07-30-13 06:24 PM

Quote:

Originally Posted by Fizzlemizz (Post 281974)
I was just about to post something similar. I changed the returns because Akatosh is using this in a KgPanels script not as a standalone function. Also changed a bit because sub can be blank.

Code:

if sub == "" then
    self.text:SetText(string.format("|cff%s%s|r", col, zone))
else
    self.text:SetText(string.format("|cff%s%s|r", col, sub))
end



That is why I mentioned SetFormattedText(). It does the SetText() as if it were string.format().

Thanks for correcting me Fizz, GetSubZoneText() does indeed return an empty string.

I also have a tip on appearance, one could move the color escape '|r' and nestle it between the two zones; this would result in only the major zone being colored. Here's an example with a correction of my code with Fizz's fix.

Stormwind, Dwarven District
Code:

if sub == "" then
    self.text:SetFormattedText("|cff%s%s|r", col, zone)
else
    self.text:SetFormattedText("|cff%s%s|r, %s", col, zone, sub)
end


Akatosh 08-05-13 10:41 AM

Hello again!, again I have questions!.

I see the broker "RaidBuffs", and explore the code.

Dont apperar a lot of dificult... I understand it a bit.

The problem be that, I dont have idea, How can I adap It, to a panel for kgpanels, I think that be posible do it.

See if you can make it work!!!

The code:

Quote:

--[[
local localizedClasses = {}
FillLocalizedClassList(localizedClasses)
local classLabels = {}
populateClassLabels("HUNTER")
populateClassLabels("WARRIOR")
populateClassLabels("PALADIN")
populateClassLabels("MAGE")
populateClassLabels("PRIEST")
populateClassLabels("WARLOCK")
populateClassLabels("SHAMAN")
populateClassLabels("DEATHKNIGHT")
populateClassLabels("DRUID")
populateClassLabels("MONK")
populateClassLabels("ROGUE")

local populateClassLabels(class)
classLabels[class] = {localizedClasses[class], RAID_CLASS_COLORS[class]}
print(classLabels[class][1], classLabels[class][2], classLabels[class][3], classLabels[class][4])
end
--]]

-- displayName, active, {buff = {class [, note]}, ...}
local buffsList = {
{"5% stats", false, {
[20217] = {"PALADIN"}, -- Blessing of Kings
[117666] = {"MONK"}, -- Legacy of the Emporer
[1126] = {"DRUID"}, -- Mark of the Wild
[90363] = {"HUNTER", "Exotic Pet"}, -- Embrace of the Shale Spider
[133539] = {"Krasang Wilds Druid"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Attack Power", false, {
[19506] = {"HUNTER"}, -- Trueshot Aura
[6673] = {"WARRIOR"}, -- Battle Shout
[57330] = {"DEATHKNIGHT"}, -- Horn of Winter
[133540] = {"Krasang Wilds Warrior"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Attack Speed", false, {
[113742] = {"ROGUE"}, -- Swiftblade's Cunning
[55610] = {"DEATHKNIGHT", "Frost & Unholy"}, -- Unholy Aura
[30809] = {"SHAMAN", "Enhancement"}, -- Unleashed Rage
[128432] = {"HUNTER", "Pet"}, -- Cackling Howl
[128433] = {"HUNTER", "Pet"}, -- Serpent's Swiftness
[133541] = {"Krasang Wilds Rogue"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Spell Power", false, {
[1459] = {"MAGE"}, -- Arcane Brilliance
[61316] = {"MAGE"}, -- Dalaran Brilliance
[77747] = {"SHAMAN"}, -- Burning Wrath
[109773] = {"WARLOCK"}, -- Dark Intent
[126309] = {"HUNTER", "Exotic Pet"}, -- Still Water
[133533] = {"Krasang Wilds Mage"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Spell Haste", false, {
[24907] = {"DRUID", "Balance"}, -- Moonkin Aura
[24858] = {nil}, -- Druid's Moonkin Aura Self Buff
[49868] = {"PRIEST", "Shadow"}, -- Mind Quickening
[15473] = {nil}, -- Priest's Mind Quickening Self Buff
[51470] = {"SHAMAN", "Elemental"}, -- Elemental Oath
[135678] = {"HUNTER", "Pet"}, -- Energizing Spores
[133545] = {"Krasang Wilds Shaman"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Mastery", false, {
[19740] = {"PALADIN"}, -- Blessing of Might
[116956] = {"SHAMAN"}, -- Grace of Air
[93435] = {"HUNTER", "Pet"}, -- Roar of Courage
[128997] = {"HUNTER", "Exotic Pet"}, -- Spirit Beast Blessing
[133535] = {"Krasang Wilds Paladin"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Crit Chance", false, {
[1459] = {"MAGE"}, -- Arcane Brilliance
[61316] = {"MAGE"}, -- Dalaran Brilliance
[17007] = {"DRUID", "Feral & Guardian"}, -- Leader of the Pack
[116781] = {"MONK", "Windwalker"}, -- Legacy of the White
[126373] = {"HUNTER", "Exotic Pet"}, -- Fearless Courage
[24604] = {"HUNTER", "Pet"}, -- Furious Howl
[126309] = {"HUNTER", "Exotic Pet"}, -- Still Water
[90309] = {"HUNTER", "Exotic Pet"}, -- Terrifying Roar
[133533] = {"Krasang Wilds Mage"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Stamina", false, {
[21562] = {"PRIEST"}, -- Power Word: Fortitude
[469] = {"WARRIOR"}, -- Commanding Shout
[109773] = {"WARLOCK"}, -- Dark Intent
[90364] = {"HUNTER", "Exotic Pet"}, -- Qiraji Fortitude
[133538] = {"Krasang Wilds Priest"}, -- Dominion Point/Lion's Landing NPCs
}},
}

local BrokerRaidBuffs = ldb:NewDataObject("Broker_RaidBuffs", {
type = "data source",
text = "Please wait",
value = 1,
icon = "interface\\addons\\Broker_RaidBuffs\\BuffConsolidation",
label = "RaidBuffs",
OnTooltipShow = function(tooltip)
tooltip:AddLine("Raidbuffs")
for _,v in pairs(buffsList) do
local r, g, b
if v[2] then
r, g, b = 0, 1, 0
else
r, g, b = 1, 0, 0
end
tooltip:AddLine(v[1], r, g, b)
end
end
})

local function updateBuffs(self, event, unitID)
if (unitID == "player" or event == "PLAYER_ENTERING_WORLD") then
-- unflag the active buffs
for i=1, #buffsList do
buffsList[i][2] = false
end

-- populate our buffs lookup table
local activeBuffs, i = {}, 1
local currentBuff = select(11, UnitBuff("player", i))
while currentBuff do
activeBuffs[currentBuff] = true
i = i + 1
currentBuff = select(11, UnitBuff("player", i))
end

local activeRaidBuffs = 0
-- start the lookup
for i = 1, #buffsList do
local raidBuff = buffsList[i][3]
for key, _ in pairs(raidBuff) do
if activeBuffs[key] then
buffsList[i][2] = true
activeRaidBuffs = activeRaidBuffs + 1
break
end
end
end

BrokerRaidBuffs.text = activeRaidBuffs .. " / 8"
end
end

local EventFrame = CreateFrame("Frame")
EventFrame:RegisterEvent("UNIT_AURA")
EventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
EventFrame:SetScript("OnEvent", updateBuffs)
What I understand.

The first part appear something like a register of class and their buff, the second part appear a count of the buffs, the third be the tooltip, And finally the number of current buffs and total buffs.

He looks like that with the broker

¿¿You can make it work for kgpanels??

A lot of thanks!!

PD: whats the diference betwen "{ or }" and "( or )"

Phanx 08-05-13 05:25 PM

Please use [code] tags around code blocks, not [quote] tags -- the latter does not preserve indentation, and makes the code annoyingly difficult to read.

Quote:

Originally Posted by Akatosh (Post 282456)
PD: whats the diference betwen "{ or }" and "( or )"

{ curly brackets } create a table object:

Code:

-- Indexed table, array, or list:
local animals = { "cat", "dog", "pig" }

-- Dictionary table, or hash table:
local animals = {
  ["cat"] = "meow",
  ["dog"] = "woof",
  ["pig"] = "oink",
}

( parenthesis ) enclose conditions or function arguments:

Code:

-- This:
if thisVar == 5 or (thatVar == 2 and otherVar == "x") then
  -- do something
end

-- ... is a more compact way of writing this:
if thisVar == 5 then
  -- do something
elseif thatVar == 2 and otherVar == "x" then
  -- do the same thing
end

Code:

function DoSomething(thisVar, thatVar, otherVar)
  -- do something
end

DoSomething(5, 2, "x")

However, I really feel like a broken record here, but copying all these Broker plugins and shoehorning them into kgPanels is really pointless. The Broker plugin you posted won't take up any more memory than a kgPanels panel running the same code (in fact, it will probably take up less memory) and a Broker display addon is not any more heavyweight than kgPanels -- but on any machine capable of running WoW at all, worring about a few dozen or even a few hundred KB is just laughably irrelevant. You might as well worry that one of your T-shirts has 15 more molecules than another, and that those few extra molecules are going to somehow be the difference between you being able to walk around normally, and you being collapsed into a black hole. That memory really does not matter one bit.

Akatosh 08-05-13 06:13 PM

I see the broker "RaidBuffs", and explore the code.

Dont apperar a lot of dificult... I understand it a bit.

The problem be that, I dont have idea, How can I adap It, to a panel for kgpanels, I think that be posible do it.

See if you can make it work!!!

The code:

Code:

local ldb = LibStub("LibDataBroker-1.1")

--[[
local localizedClasses = {}
FillLocalizedClassList(localizedClasses)
local classLabels = {}
    populateClassLabels("HUNTER")
    populateClassLabels("WARRIOR")
    populateClassLabels("PALADIN")
    populateClassLabels("MAGE")
    populateClassLabels("PRIEST")
    populateClassLabels("WARLOCK")
    populateClassLabels("SHAMAN")
    populateClassLabels("DEATHKNIGHT")
    populateClassLabels("DRUID")
    populateClassLabels("MONK")
    populateClassLabels("ROGUE")
       
local populateClassLabels(class)
        classLabels[class] = {localizedClasses[class], RAID_CLASS_COLORS[class]}
        print(classLabels[class][1], classLabels[class][2], classLabels[class][3], classLabels[class][4])
end
--]]
       
-- displayName, active, {buff = {class [, note]}, ...}
local buffsList = {
        {"5% stats", false, {
                [20217] = {"PALADIN"}, -- Blessing of Kings
                [117666] = {"MONK"}, -- Legacy of the Emporer
                [1126] = {"DRUID"}, -- Mark of the Wild
                [90363] = {"HUNTER", "Exotic Pet"}, -- Embrace of the Shale Spider
                [133539] = {"Krasang Wilds Druid"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Attack Power", false, {
                [19506] = {"HUNTER"}, -- Trueshot Aura
                [6673] = {"WARRIOR"}, -- Battle Shout
                [57330] = {"DEATHKNIGHT"}, -- Horn of Winter
                [133540] = {"Krasang Wilds Warrior"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Attack Speed", false, {
                [113742] = {"ROGUE"}, -- Swiftblade's Cunning
                [55610] = {"DEATHKNIGHT", "Frost & Unholy"}, -- Unholy Aura
                [30809] = {"SHAMAN", "Enhancement"}, -- Unleashed Rage
                [128432] = {"HUNTER", "Pet"}, -- Cackling Howl
                [128433] = {"HUNTER", "Pet"}, -- Serpent's Swiftness
                [133541] = {"Krasang Wilds Rogue"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Spell Power", false, {
                [1459] = {"MAGE"}, -- Arcane Brilliance
                [61316] = {"MAGE"}, -- Dalaran Brilliance
                [77747] = {"SHAMAN"}, -- Burning Wrath
                [109773] = {"WARLOCK"}, -- Dark Intent
                [126309] = {"HUNTER", "Exotic Pet"}, -- Still Water
                [133533] = {"Krasang Wilds Mage"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Spell Haste", false, {
                [24907] = {"DRUID", "Balance"}, -- Moonkin Aura
                [24858] = {nil}, -- Druid's Moonkin Aura Self Buff
                [49868] = {"PRIEST", "Shadow"}, -- Mind Quickening
                [15473] = {nil}, -- Priest's Mind Quickening Self Buff
                [51470] = {"SHAMAN", "Elemental"}, -- Elemental Oath
                [135678] = {"HUNTER", "Pet"}, -- Energizing Spores
                [133545] = {"Krasang Wilds Shaman"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Mastery", false, {
                [19740] = {"PALADIN"}, -- Blessing of Might
                [116956] = {"SHAMAN"}, -- Grace of Air
                [93435] = {"HUNTER", "Pet"}, -- Roar of Courage
                [128997] = {"HUNTER", "Exotic Pet"}, -- Spirit Beast Blessing
                [133535] = {"Krasang Wilds Paladin"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Crit Chance", false, {
                [1459] = {"MAGE"}, -- Arcane Brilliance
                [61316] = {"MAGE"}, -- Dalaran Brilliance
                [17007] = {"DRUID", "Feral & Guardian"}, -- Leader of the Pack
                [116781] = {"MONK", "Windwalker"}, -- Legacy of the White
                [126373] = {"HUNTER", "Exotic Pet"}, -- Fearless Courage
                [24604] = {"HUNTER", "Pet"}, -- Furious Howl
                [126309] = {"HUNTER", "Exotic Pet"}, -- Still Water
                [90309] = {"HUNTER", "Exotic Pet"}, -- Terrifying Roar
                [133533] = {"Krasang Wilds Mage"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Stamina", false, {
                [21562] = {"PRIEST"}, -- Power Word: Fortitude
                [469] = {"WARRIOR"}, -- Commanding Shout
                [109773] = {"WARLOCK"}, -- Dark Intent
                [90364] = {"HUNTER", "Exotic Pet"}, -- Qiraji Fortitude
                [133538] = {"Krasang Wilds Priest"}, -- Dominion Point/Lion's Landing NPCs
        }},
}

local BrokerRaidBuffs = ldb:NewDataObject("Broker_RaidBuffs", {
        type = "data source",
        text = "Please wait",
        value = 1,
        icon = "interface\\addons\\Broker_RaidBuffs\\BuffConsolidation",
        label = "RaidBuffs",
        OnTooltipShow = function(tooltip)
                tooltip:AddLine("Raidbuffs")
                for _,v in pairs(buffsList) do
                        local r, g, b
                        if v[2] then
                                r, g, b = 0, 1, 0
                        else
                                r, g, b = 1, 0, 0
                        end
                        tooltip:AddLine(v[1], r, g, b)
                end
        end
})

local function updateBuffs(self, event, unitID)
        if (unitID == "player" or event == "PLAYER_ENTERING_WORLD") then
                -- unflag the active buffs
                for i=1, #buffsList do
                        buffsList[i][2] = false
                end
               
                -- populate our buffs lookup table
                local activeBuffs, i = {}, 1
                local currentBuff = select(11, UnitBuff("player", i))
                while currentBuff do
                        activeBuffs[currentBuff] = true
                        i = i + 1
                        currentBuff = select(11, UnitBuff("player", i))
                end
               
                local activeRaidBuffs = 0
                -- start the lookup
                for i = 1, #buffsList do
                        local raidBuff = buffsList[i][3]
                        for key, _ in pairs(raidBuff) do
                                if activeBuffs[key] then
                                        buffsList[i][2] = true
                                        activeRaidBuffs = activeRaidBuffs + 1
                                        break
                                end
                        end
                end
               
                BrokerRaidBuffs.text = activeRaidBuffs .. " / 8"
        end
end

local EventFrame = CreateFrame("Frame")
EventFrame:RegisterEvent("UNIT_AURA")
EventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
EventFrame:SetScript("OnEvent", updateBuffs)



Better?.

Thanks for the tips, Phanx, I dont want sound rude or border, I'm very grateful to the help that you have rendered me, I respect your point of view, but please be reciprocal with the mine, can be do it by two ways, Kgpanels or broker (or more, I think), is a matter of choice in my opinion.

I wish I could do it myself, but I can not learn faster than my personal life allows me to learn, sorry if I'm asking too much, but I have no alternative, because I do not understand how to do this.

Phanx 08-05-13 06:26 PM

Quote:

Originally Posted by Akatosh (Post 282469)
The problem be that, I dont have idea, How can I adap It, to a panel for kgpanels, I think that be posible do it.

See if you can make it work!!!

It's possible, yes, but while I'm willing to help out with simple scripting like "click to show something" or "change color based on class", a raid buff monitor is pretty far outside the realm of what I think kgPanels is designed to do, and there's no way I'm spending my free time rewriting other people's perfectly functional (and likely copyrighted) Broker plugins into complicated kgPanels scripts for you, sorry.

Akatosh 08-05-13 07:12 PM

Quote:

Originally Posted by Phanx (Post 282471)
It's possible, yes, but while I'm willing to help out with simple scripting like "click to show something" or "change color based on class", a raid buff monitor is pretty far outside the realm of what I think kgPanels is designed to do, and there's no way I'm spending my free time rewriting other people's perfectly functional (and likely copyrighted) Broker plugins into complicated kgPanels scripts for you, sorry.

I did not force you to help me, you are free to do it, or not, for other side I dont copy their broker, I just take their code as a reference to adapt it to kgpanels.

Even for me, I do not know almost nothing, I understand that is something completely different.

Fizzlemizz 08-05-13 08:57 PM

Hi Akatosh,

I see from the RaidBuffStatus page here at WowInterface that it is out of date and from the comments not working. I also see from the DL at Curse that the code, as Phanx pounted out, is most likely copyrighted and now uses 13 libraries and the core.lua file is nearly 5,000 lines long.

I'm sorry to say that in this case while it may be technically possible to do, it would not be quick or easy (even if someone had a clue where to start) and most likely is not worth the time.

Sorry.

Akatosh 08-05-13 09:54 PM

Quote:

Originally Posted by Fizzlemizz (Post 282479)
Hi Akatosh,

I see from the RaidBuffStatus page here at WowInterface that it is out of date and from the comments not working. I also see from the DL at Curse that the code, as Phanx pounted out, is most likely copyrighted and now uses 13 libraries and the core.lua file is nearly 5,000 lines long.

I'm sorry to say that in this case while it may be technically possible to do, it would not be quick or easy (even if someone had a clue where to start) and most likely is not worth the time.

Sorry.

Thanks for the reply, I have a bit issue with that.

http://www.wowinterface.com/forums/s...52&postcount=5

Works ok but, only for 1 time (1 mouseover), If I mouseover 2 times the text come one more time to original color. ¿You kwon how can I fix that?.

Thanks!!.

For the other side I countinue trying the part of the raidbuffs, I think that with time maybe can I do it, I refuse to give up so fast, there must be some way to do it.

Fizzlemizz 08-05-13 10:18 PM

Quote:

Originally Posted by Akatosh View Post
When I click in the panel I want that this panel conserve the white color, now when I leave the clicked panel instantly be class colored, ¿how can I do for When I click the Panel That panel conserve the white text color?.
Quote:

Works ok but, only for 1 time (1 mouseover), If I mouseover 2 times the text come one more time to original color. ¿You kwon how can I fix that?.
I guess I don't have all the conditions:
Does the frame start out white or class coloured?

When you click you want it to go from the class colour to white.
Then when your mouse leaves the frame you want it to go back to the class colour until the next time it is clicked? Is that right?

BTW, you're not testing on a priest I hope ;)

Akatosh 08-06-13 12:15 AM

Quote:

Originally Posted by Fizzlemizz (Post 282482)
I guess I don't have all the conditions:
Does the frame start out white or class coloured?

When you click you want it to go from the class colour to white.
Then when your mouse leaves the frame you want it to go back to the class colour until the next time it is clicked? Is that right?

BTW, you're not testing on a priest I hope ;)

Start at red (DK).

When I mouseover turns to white.

When I mouse leave turn to class colored.

When I click turn to white.

But:

If the panel its clicked, the color turns white, and continues white when I mouseover (and mouseleave).

There are 3 panels for the chat (the picture I mouseover the tab General Aka "("PanelGene").



With that codes:

Onclick:
Code:

self.clicked = true

ChatFrame3:Show()
ChatFrame1:Hide()
ChatFrame2:Hide()

self.text:SetTextColor(1, 1, 1)

local tab1 = kgPanels:FetchFrame("PanelGene")
local tab2 = kgPanels:FetchFrame("PanelLog")

local _, Class = UnitClass("player")
local Color = RAID_CLASS_COLORS[Class]
tab1.text:SetTextColor(Color.r,Color.g,Color.b)
tab2.text:SetTextColor(Color.r,Color.g,Color.b)

OnLeave:
Code:

if not self.clicked then

local _, Class = UnitClass("player")
local Color = RAID_CLASS_COLORS[Class]
self.text:SetTextColor(Color.r,Color.g,Color.b)

else
  self.clicked = false
end

OnEnter:
Code:

self.text:SetTextColor(1, 1, 1)
OnLoad:

Code:

local font, size, flags = self.text:GetFont()
self.text:SetFont(font, size, "OUTLINE," .. flags)

local _, Class = UnitClass("player")
local Color = RAID_CLASS_COLORS[Class]
self.text:SetTextColor(Color.r,Color.g,Color.b)

But they work as I described.

I mouseover, OK put the white color.

I mouseleave, OK Red again.

I click, OK turns white.

I mouseleave (when the panel be clicked) and OK, continue white.

But, when I mouseleave one more time the panel turn Red again.

Its extrange.... but the panel do that.

I think something like:

When I push one tab the other in theory hide Aka:

ChatFrame3:Show()
ChatFrame1:Hide()
ChatFrame2:Hide()

Maybe that can be use for do that.

Something like:

If ChatFrame3:Show() or ChatFrame1:Hide() and ChatFrame2:Hide()

Put the text on white (and hold it).

Becouse If I press ChatFrame3, 1 and 2 hide for sure, and 3 show.

Thanks for the support.

PD: I need sleep a bit.... all the night with Lua ZzzzzZzzz

Fizzlemizz 08-06-13 01:31 PM

Quote:

I mouseover, OK put the white color.

I mouseleave, OK Red again.

I click, OK turns white.

I mouseleave (when the panel be clicked) and OK, continue white.

But, when I mouseleave one more time the panel turn Red again.
OnLeave
Code:

if not self.clicked then
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    self.text:SetTextColor(Color.r,Color.g,Color.b)
else
    self.clicked = false
end

Because you "self.clicked = false" on the first OnLeave the condition "if not self.clicked then" becomes active on the second OnLeave. You need to find some mechanism (maybe a second click) to reset "self.clicked", in which case,

OnClick becomes:
Code:

if not self.clicked then
        self.clicked = true
       
        ChatFrame3:Show()
        ChatFrame1:Hide()
        ChatFrame2:Hide()
       
        self.text:SetTextColor(1, 1, 1)
       
        local tab1 = kgPanels:FetchFrame("PanelGene")
        local tab2 = kgPanels:FetchFrame("PanelLog")
       
        local _, Class = UnitClass("player")
        local Color = RAID_CLASS_COLORS[Class]
        tab1.text:SetTextColor(Color.r,Color.g,Color.b)
        tab2.text:SetTextColor(Color.r,Color.g,Color.b)
else
        self.clicked = false
ens

And OnLeave becomes:
Code:

if not self.clicked then
        local _, Class = UnitClass("player")
        local Color = RAID_CLASS_COLORS[Class]
        self.text:SetTextColor(Color.r,Color.g,Color.b)
end


Akatosh 08-06-13 09:17 PM

Hi again, Thanks for the help but now the panels do completely different,

I explain.

OnEnter 1st time, first time OK they turn to white.

Click, dont work as intended, the panels dont hold the text white color.

Onleave, the panels turn the text to class colored again, they dont hold the white color.

I put all the codes of the 3 panels for give you all info as I can, I hope that help you.

I do not understand where I'm failing.

Thanks!!

---------

Panel "PanelGene" (1)

OnLoad

Code:

local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.text:SetTextColor(color.r, color.g, color.b)

OnEnter

Code:

self.text:SetTextColor(1, 1, 1)
OnLeave

Code:

if not self.clicked then
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    self.text:SetTextColor(Color.r,Color.g,Color.b)
end

OnClick

Code:

if not self.clicked then
    self.clicked = true
   
    ChatFrame1:Show()
    ChatFrame2:Hide()
    ChatFrame3:Hide()
   
    self.text:SetTextColor(1, 1, 1)
   
    local tab2 = kgPanels:FetchFrame("PanelLog")
    local tab3 = kgPanels:FetchFrame("PanelTrash")
   
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    tab2.text:SetTextColor(Color.r,Color.g,Color.b)
    tab3.text:SetTextColor(Color.r,Color.g,Color.b)
else
    self.clicked = false
end

-----------

Panel PanelLog (2)


OnLoad

Code:

local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.text:SetTextColor(color.r, color.g, color.b)

OnEnter

Code:

self.text:SetTextColor(1, 1, 1)
OnLeave

Code:

if not self.clicked then
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    self.text:SetTextColor(Color.r,Color.g,Color.b)
end

OnClick

Code:

if not self.clicked then
    self.clicked = true
   
    ChatFrame2:Show()
    ChatFrame3:Hide()
    ChatFrame1:Hide()
   
    self.text:SetTextColor(1, 1, 1)
   
    local tab1 = kgPanels:FetchFrame("PanelGene")
    local tab3 = kgPanels:FetchFrame("PanelTrash")
   
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    tab1.text:SetTextColor(Color.r,Color.g,Color.b)
    tab3.text:SetTextColor(Color.r,Color.g,Color.b)
else
    self.clicked = false
end

-----------

Panel "PanelTrash" (3)

OnLoad

Code:

local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.text:SetTextColor(color.r, color.g, color.b)

OnEnter

Code:

self.text:SetTextColor(1, 1, 1)
OnLeave

Code:

if not self.clicked then
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    self.text:SetTextColor(Color.r,Color.g,Color.b)
end

Onclick

Code:

if not self.clicked then
    self.clicked = true
   
    ChatFrame3:Show()
    ChatFrame1:Hide()
    ChatFrame2:Hide()
   
    self.text:SetTextColor(1, 1, 1)
   
    local tab1 = kgPanels:FetchFrame("PanelGene")
    local tab2 = kgPanels:FetchFrame("PanelLog")
   
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    tab1.text:SetTextColor(Color.r,Color.g,Color.b)
    tab2.text:SetTextColor(Color.r,Color.g,Color.b)
else
    self.clicked = false
end

Thanks.

Fizzlemizz 08-06-13 10:07 PM

OnClick
Code:

if not self.clicked then
    self.clicked = true
   
    ChatFrame1:Show()
    ChatFrame2:Hide()
    ChatFrame3:Hide()
   
    self.text:SetTextColor(1, 1, 1)
   
    local tab2 = kgPanels:FetchFrame("PanelLog")
    local tab3 = kgPanels:FetchFrame("PanelTrash")
   
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    tab2.text:SetTextColor(Color.r,Color.g,Color.b)
    tab3.text:SetTextColor(Color.r,Color.g,Color.b)
else
    self.clicked = false
end

When you are clicking you are re-setting the colours for the other two panels but you also need to re-set their "clicked" status.

So I think OnClick
Code:

if not self.clicked then
    self.clicked = true
   
    ChatFrame1:Show()
    ChatFrame2:Hide()
    ChatFrame3:Hide()
   
    self.text:SetTextColor(1, 1, 1)
   
    local tab2 = kgPanels:FetchFrame("PanelLog")
    local tab3 = kgPanels:FetchFrame("PanelTrash")
   
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    tab2.text:SetTextColor(Color.r,Color.g,Color.b)
    tab2.clicked = false
    tab3.text:SetTextColor(Color.r,Color.g,Color.b)
    tab3.clicked = false
else
    self.clicked = false
end

While it shouldn't be needed you could also:
OnLeave
Code:

if not self.clicked then
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    self.text:SetTextColor(Color.r,Color.g,Color.b)
else
    self.text:SetTextColor(1,1,1)
end

You might want to define things differently as here, once "unclicked" the button doesn't change from white to class colour until OnLeave.

The code here allows all buttons to be "unclicked" at the same time. If you want one button to always be "hot" you can remove the

else
self.clicked = false

Phanx 08-06-13 10:10 PM

You need to add this to the very beginning of all your OnClick scripts:

Code:

if pressed then
    return
end

What kgPanels labels "OnClick" actually gets run for both OnMouseDown and OnMouseUp, with a special variable passed to tell your script which event it's running for. If you want it to work like a real OnClick script, you need to ignore the OnMouseDown event, and only respond to the OnMouseUp event, by checking the "pressed" variable. Otherwise, your "OnClick" script gets run twice every time you click -- once when you press the mouse button, and again when you release it.

Fizzlemizz 08-06-13 10:35 PM

Wow, that would mess things up. Good insight Phanx.

Akatosh 08-06-13 11:25 PM

I hate maintenances :mad::mad:

Thanks for the assistance.

As I undertand finaly for example the code may be (for example):

OnLoad:

Code:

local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.text:SetTextColor(color.r, color.g, color.b)


OnClick:

Code:


if pressed then
    return
end

if not self.clicked then
    self.clicked = true
   
    ChatFrame1:Show()
    ChatFrame2:Hide()
    ChatFrame3:Hide()
   
    self.text:SetTextColor(1, 1, 1)
   
    local tab2 = kgPanels:FetchFrame("PanelLog")
    local tab3 = kgPanels:FetchFrame("PanelTrash")
   
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    tab2.text:SetTextColor(Color.r,Color.g,Color.b)
    tab2.clicked = false
    tab3.text:SetTextColor(Color.r,Color.g,Color.b)
    tab3.clicked = false
else
    self.clicked = false
end

OnEnter

Code:

self.text:SetTextColor(1, 1, 1)
OnLeave

Code:

if not self.clicked then
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    self.text:SetTextColor(Color.r,Color.g,Color.b)
else
    self.text:SetTextColor(1,1,1)
end

Is that right?

Thanks!!

Fizzlemizz 08-06-13 11:34 PM

So that the colour changes to default immediately when a button is "unclicked" (self.clicked = false) you might want to make OnClick
Code:

if pressed then
    return
end

local _, Class = UnitClass("player")
local Color = RAID_CLASS_COLORS[Class]
if not self.clicked then
    self.clicked = true
   
    ChatFrame1:Show()
    ChatFrame2:Hide()
    ChatFrame3:Hide()
   
    self.text:SetTextColor(1, 1, 1)
   
    local tab2 = kgPanels:FetchFrame("PanelLog")
    local tab3 = kgPanels:FetchFrame("PanelTrash")
   
    tab2.text:SetTextColor(Color.r,Color.g,Color.b)
    tab2.clicked = false
    tab3.text:SetTextColor(Color.r,Color.g,Color.b)
    tab3.clicked = false
end

Also I'm unsure what you want to do about ChatFrame Hide/Show when buttons are "unclicked".

With the code presented here it is possiible to have one button "clicked" and two buttons "unclicked" or none of the buttons "clicked":

General Log Trash
or
General Log Trash
or
General Log Trash
or
General Log Trash

Phanx 08-07-13 12:09 AM

I know I've written scripts for someone before to manage a collection of related panels like this (eg. when clicking on one, turn it white, turn all the others gray) but I don't remember when or where, or even whether it was on these forums or on Wowace. Maybe you can find it with some creative use of the advanced search.

Akatosh 08-07-13 12:33 AM

Quote:

Originally Posted by Fizzlemizz (Post 282620)
So that the colour changes to default immediately when a button is "unclicked" (self.clicked = false) you might want to make OnClick
Code:

if pressed then
    return
end

local _, Class = UnitClass("player")
local Color = RAID_CLASS_COLORS[Class]
if not self.clicked then
    self.clicked = true
   
    ChatFrame1:Show()
    ChatFrame2:Hide()
    ChatFrame3:Hide()
   
    self.text:SetTextColor(1, 1, 1)
   
    local tab2 = kgPanels:FetchFrame("PanelLog")
    local tab3 = kgPanels:FetchFrame("PanelTrash")
   
    tab2.text:SetTextColor(Color.r,Color.g,Color.b)
    tab2.clicked = false
    tab3.text:SetTextColor(Color.r,Color.g,Color.b)
    tab3.clicked = false
else
    self.clicked = false
    self:SetTextColor(Color.r,Color.g,Color.b)
end

Also I'm unsure what you want to do about ChatFrame Hide/Show when buttons are "unclicked".

With the code presented here it is possiible to have one button "clicked" and two buttons "unclicked" or none of the buttons "clicked":

General Log Trash
or
General Log Trash
or
General Log Trash
or
General Log Trash

I Explain.

At inicial the text is class colored.

General Log Trash


1 -When I OnEnter, the text comes white. (for expample I put the cursor over the panel general)

1 -General Log Trash

2 -When I OnLeave, the text comes class colored. (for example I leave the panel general and I put the cursor in another place of the screen out of the panels of tabs).

2 -General Log Trash

3 -But If I click the panel, the text hold the white color, and dont change at mouseleave. (for example I clicked the general panel, and I leave the cursor in another place of the screen out of the panel of tabs).

3 -General Log Trash

If I OnEnter on "Log" or "Trash" panel, (when "general" is clicked), but dont click they, OnEnter and Onleave work as the 2 first points), for example general is clicked and at this moment I mouseover the panel "Log".

3 -General LogTrash

3 -General Log Trash (And now I mouseleave).

4 -When I click another panel the Last clicked panel take class colored color again.

4 -General Log Trash (Inicial state).

4 -General Log Trash (Inicial state) (Mouseover over "Log").

4 -General Log Trash (log at this moment its clicked).


I want exactly the some efects like the standart tabs of the basic chat of wow.

I dont know how can I explain It better, in general term I want a panels of 3 buttons with identical efects of basic wow chat.

Thanks!!.

PD: I hate sleep (is a loss of time, how many things I can do In 5 or 6 ours...), but I need it again... and one more time a long lua text night, can be a perfect tittle for a film to sleep.

I try to find that post Phanx, thanks, but in a little while, now I have to rest.

Fizzlemizz 08-07-13 01:02 AM

OnLoad -- Everything class coloured
Code:

local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.text:SetTextColor(color.r, color.g, color.b)end

OnClick -- Set self to white, set other tabs class coloured, show/hide chat frames:
Code:

if pressed then
    return
end

local _, Class = UnitClass("player")
local Color = RAID_CLASS_COLORS[Class]
if not self.clicked then
    self.clicked = true
    self.text:SetTextColor(1, 1, 1)
   
--Change per tab/button
    ChatFrame1:Show()
    ChatFrame2:Hide()
    ChatFrame3:Hide()
    local tab2 = kgPanels:FetchFrame("PanelLog")
    local tab3 = kgPanels:FetchFrame("PanelTrash")
    tab2.text:SetTextColor(Color.r,Color.g,Color.b)
    tab2.clicked = false
    tab3.text:SetTextColor(Color.r,Color.g,Color.b)
    tab3.clicked = false
end

OnEnter -- set white no matter what
Code:

self.text:SetTextColor(1, 1, 1)
OnLeave -- if clicked set to white else class coloured (changed for clarity)
Code:

if self.clicked then
    self.text:SetTextColor(1,1,1)
else -- condition set in OnClick of other tabs
    local _, Class = UnitClass("player")
    local Color = RAID_CLASS_COLORS[Class]
    self.text:SetTextColor(Color.r,Color.g,Color.b)
end


suicidalkatt 08-07-13 04:05 AM

Why do all this work when you can just check to see if a ChatFrame is showing?

Use the OnUpdate field and do a

Lua Code:
  1. if ChatFrame1:IsShown() then
  2. -- color method here
  3. else
  4. -- not shown method here
  5. end

Not too difficult to add additional checks to see if its being entered by the mouse to disable the updating color.

Edit: Here's my version and a rather simplified attempt to make things more straightforward and more 'universal' on all the buttons minus a simple string change.

OnLoad:
Lua Code:
  1. local font,size = self.text:GetFont()
  2. self.text:SetFont(font,size,"OUTLINE")
  3. self.text:SetJustifyH("CENTER")
  4. self.text:SetJustifyV("CENTER")
  5.  
  6. self.color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[select(2,UnitClass("player"))]
  7. self.frame = "ChatFrame1"

OnEnter:
Lua Code:
  1. self.entered = true

OnLeave:
Lua Code:
  1. self.entered = false

OnClick:
Lua Code:
  1. FCF_Tab_OnClick(_G[self.frame.."Tab"],button) -- This uses a method provided by blizzard to toggle the chat frames, this may also reshow the default chat tabs, although it's a nice shortcut for the button onclick.

OnUpdate:
Lua Code:
  1. if _G[self.frame]:IsShown() or self.entered then
  2.     self.text:SetTextColor(1,1,1)
  3. else
  4.     self.text:SetTextColor(self.color.r,self.color.g,self.color.b)
  5. end

Another nifty side effect to this is that it should also update the class color should you change it with CUSTOM_CLASS_COLORS.

Layout Export:
Code:

^1^T^SGeneral^T^Sborder_advanced^T^Senable^b^Sshow^T^SBOT^B^STOPRIGHTCORNER^B^SLEFT^B^STOPLEFTCORNER^B^SRIGHT^B^SBOTLEFTCORNER^B^STOP^B^SBOTRIGHTCORNER^B^t^t^Sparent^SUIParent^Ssub_level^N0^SanchorFrom^SCENTER^Shflip^b^Svflip^b^StileSize^N0^Sbg_texture^SSolid^Sanchor^SUIParent^Slevel^N0^Suse_absolute_bg^b^Sbg_blend^SBLEND^Stext^T^Sy^N0^Sfont^SBlizzard^SjustifyH^SCENTER^Sx^N0^Scolor^T^Sa^N1^Sr^N1^Sg^N1^Sb^N1^t^Stext^SGeneral^SjustifyV^SMIDDLE^Ssize^N12^t^Sy^S0^Sx^S-100^Sbg_alpha^N1^Sborder_edgeSize^N16^Sheight^S25^Stiling^b^Sstrata^SBACKGROUND^SanchorTo^SCENTER^Sabsolute_bg^T^SLLy^N1^SLLx^N0^SLRy^N1^SLRx^N1^SURx^N1^SURy^N0^SULy^N0^SULx^N0^t^Sbg_insets^T^Sb^N4^St^N-4^Sl^N4^Sr^N-4^t^Sscripts^T^SENTER^Sself.entered~`=~`true^SLOAD^Slocal~`font,size~`=~`self.text:GetFont()~Jself.text:SetFont(font,size,"OUTLINE")~Jself.text:SetJustifyH("CENTER")~Jself.text:SetJustifyV("CENTER")~J~`~Jself.color~`=~`(CUSTOM_CLASS_COLORS~`or~`RAID_CLASS_COLORS)[select(2,UnitClass("player"))]~Jself.frame~`=~`"ChatFrame1"^SCLICK^SFCF_Tab_OnClick(_G[self.frame.."Tab"],button)^SUPDATE^Sif~`_G[self.frame]:IsShown()~`or~`self.entered~`then~Jself.text:SetTextColor(1,1,1)~Jelse~Jself.text:SetTextColor(self.color.r,self.color.g,self.color.b)~Jend^SLEAVE^Sself.entered~`=~`false^t^Sbg_style^SSOLID^Sgradient_color^T^Sa^N1^Sr^N1^Sg^N1^Sb^N1^t^Sborder_color^T^Sa^N1^Sr^N1^Sg^N1^Sb^N1^t^Sborder_texture^SBlizzard~`Tooltip^Swidth^S100^Sbg_orientation^SHORIZONTAL^Srotation^N0^Smouse^B^Sbg_color^T^Sa^N0.6^Sr^N0.3^Sg^N0.3^Sb^N0.3^t^Scrop^b^t^SCombat^T^Sborder_advanced^T^Senable^b^Sshow^T^SBOTRIGHTCORNER^B^STOPRIGHTCORNER^B^STOPLEFTCORNER^B^SBOTLEFTCORNER^B^SRIGHT^B^SLEFT^B^STOP^B^SBOT^B^t^t^Sparent^SUIParent^Ssub_level^N0^SanchorFrom^SCENTER^Shflip^b^Svflip^b^StileSize^N0^Sbg_texture^SSolid^Sanchor^SUIParent^Slevel^N0^Suse_absolute_bg^b^Sbg_blend^SBLEND^Stext^T^Sy^N0^Sx^N0^SjustifyH^SCENTER^Sfont^SBlizzard^Scolor^T^Sa^N1^Sb^N1^Sg^N1^Sr^N1^t^Stext^SCombat^SjustifyV^SMIDDLE^Ssize^N12^t^Sy^S0^Sx^S0^Sbg_alpha^N1^Sborder_edgeSize^N16^Sheight^S25^Stiling^b^Sstrata^SBACKGROUND^SanchorTo^SCENTER^Sabsolute_bg^T^SLRy^N1^SLRx^N1^SULx^N0^SULy^N0^SURy^N0^SURx^N1^SLLx^N0^SLLy^N1^t^Scrop^b^Sscripts^T^SENTER^Sself.entered~`=~`true^SLOAD^Slocal~`font,size~`=~`self.text:GetFont()~Jself.text:SetFont(font,size,"OUTLINE")~Jself.text:SetJustifyH("CENTER")~Jself.text:SetJustifyV("CENTER")~J~`~Jself.color~`=~`(CUSTOM_CLASS_COLORS~`or~`RAID_CLASS_COLORS)[select(2,UnitClass("player"))]~Jself.frame~`=~`"ChatFrame2"^SCLICK^SFCF_Tab_OnClick(_G[self.frame.."Tab"],button)^SUPDATE^Sif~`_G[self.frame]:IsShown()~`or~`self.entered~`then~Jself.text:SetTextColor(1,1,1)~Jelse~Jself.text:SetTextColor(self.color.r,self.color.g,self.color.b)~Jend^SLEAVE^Sself.entered~`=~`false^t^Sbg_style^SSOLID^Sgradient_color^T^Sa^N1^Sb^N1^Sg^N1^Sr^N1^t^Sborder_color^T^Sa^N1^Sb^N1^Sg^N1^Sr^N1^t^Sborder_texture^SBlizzard~`Tooltip^Swidth^S100^Sbg_insets^T^Sr^N-4^St^N-4^Sl^N4^Sb^N4^t^Sbg_color^T^Sa^N0.6^Sb^N0.3^Sg^N0.3^Sr^N0.3^t^Smouse^B^Srotation^N0^Sbg_orientation^SHORIZONTAL^t^SLoot^T^Sborder_advanced^T^Senable^b^Sshow^T^SBOT^B^STOPRIGHTCORNER^B^SLEFT^B^SBOTLEFTCORNER^B^SRIGHT^B^STOPLEFTCORNER^B^STOP^B^SBOTRIGHTCORNER^B^t^t^Sparent^SUIParent^Sbg_orientation^SHORIZONTAL^SanchorFrom^SCENTER^Shflip^b^Svflip^b^StileSize^N0^Sbg_texture^SSolid^Sanchor^SUIParent^Slevel^N0^Suse_absolute_bg^b^Sbg_blend^SBLEND^Stext^T^Sy^N0^Sx^N0^SjustifyH^SCENTER^Sfont^SBlizzard^Scolor^T^Sa^N1^Sr^N1^Sg^N1^Sb^N1^t^Stext^SLoot^SjustifyV^SMIDDLE^Ssize^N12^t^Sy^S0^Sx^S100^Sbg_alpha^N1^Sborder_edgeSize^N16^Sheight^S25^Stiling^b^Sstrata^SBACKGROUND^SanchorTo^SCENTER^Sabsolute_bg^T^SULx^N0^SULy^N0^SLLy^N1^SLLx^N0^SURx^N1^SURy^N0^SLRx^N1^SLRy^N1^t^Sbg_insets^T^Sb^N4^St^N-4^Sl^N4^Sr^N-4^t^Sscripts^T^SENTER^Sself.entered~`=~`true^SLOAD^Slocal~`font,size~`=~`self.text:GetFont()~Jself.text:SetFont(font,size,"OUTLINE")~Jself.text:SetJustifyH("CENTER")~Jself.text:SetJustifyV("CENTER")~J~`~Jself.color~`=~`(CUSTOM_CLASS_COLORS~`or~`RAID_CLASS_COLORS)[select(2,UnitClass("player"))]~Jself.frame~`=~`"ChatFrame4"^SCLICK^SFCF_Tab_OnClick(_G[self.frame.."Tab"],button)^SUPDATE^Sif~`_G[self.frame]:IsShown()~`or~`self.entered~`then~Jself.text:SetTextColor(1,1,1)~Jelse~Jself.text:SetTextColor(self.color.r,self.color.g,self.color.b)~Jend^SLEAVE^Sself.entered~`=~`false^t^Sbg_style^SSOLID^Sgradient_color^T^Sa^N1^Sr^N1^Sg^N1^Sb^N1^t^Sborder_color^T^Sa^N1^Sr^N1^Sg^N1^Sb^N1^t^Sborder_texture^SBlizzard~`Tooltip^Swidth^S100^Ssub_level^N0^Srotation^N0^Smouse^b^Sbg_color^T^Sa^N0.6^Sr^N0.3^Sg^N0.3^Sb^N0.3^t^Scrop^b^t^t^^ayer"))])~Jself.frame~`=~`"ChatFrame1"^SCLICK^SFCF_Tab_OnClick(_G[self.frame.."Tab"],button)^SUPDATE^Sif~`_G[self.frame]:IsShown()~`or~`self.entered~`then~Jself.text:SetTextColor(1,1,1)~Jelse~Jself.text:SetTextColor(self.color.r,self.color.g,self.color.b)~Jend^SLEAVE^Sself.entered~`=~`false^t^Sbg_style^SSOLID^Sgradient_color^T^Sa^N1^Sb^N1^Sg^N1^Sr^N1^t^Sborder_color^T^Sa^N1^Sb^N1^Sg^N1^Sr^N1^t^Sborder_texture^SBlizzard~`Tooltip^Swidth^S100^Sbg_insets^T^Sr^N-4^St^N-4^Sl^N4^Sb^N4^t^Sbg_color^T^Sa^N0.6^Sb^N0.3^Sg^N0.3^Sr^N0.3^t^Smouse^B^Srotation^N0^Sbg_orientation^SHORIZONTAL^t^t^^

Akatosh 08-07-13 10:01 AM

Hi all.

1st: Fizzlemizz, Phanx thanks for all the support that give me, the code that leave me Fizz the part of "Onleave dont work as intended, when I Onleave (and the panel is clicked, the loss the white color and be class colored again.)

2nd: suicidalkatt, Works perfetly, exactly as I need, I cant imagine how, with that few lines, all work as I need, really I'm in shock.

suicidalkatt 08-07-13 10:17 AM

Quote:

Originally Posted by Akatosh (Post 282641)
Hi all.

suicidalkatt, Works perfetly, exactly as I need, I cant imagine how, with that few lines, all work as I need, really I'm in shock.

FCF_Tab_OnClick is exactly the same function that's run when you click on the default chat frame tabs, so it make sense to simple reuse that function for the OnClick.

Glad it's working how you'd like :)

ravagernl 08-07-13 12:01 PM

Also, there is no need to have OnEnter/OnLeave handlers for the frame, you can use self:IsMousOver()

Akatosh 08-07-13 12:19 PM

Quote:

Originally Posted by ravagernl (Post 282648)
Also, there is no need to have OnEnter/OnLeave handlers for the frame, you can use self:IsMousOver()

At this point the panels work perfectly with the code of suicidalkatt, thanks for the tip ravagernl.

One more question.

¿Can be posible OnClick, remove the top border of the panel?.

For example



I click the panel General, and the top border remove, taking the apareance of "mix", can be posible do that?¿

.........

I find a posible way using the alpha color of the borders, I explain.

I put 2 panels Just one over the other.

The principal panel have the 4 borders.

And the panel of back have 3 borders (all, without top).

When I click the principal panel, alpha border of the principal panel get alfa 0, and they show the back panel with the 3 borders.

I try that this night leave me a time and I post the results.

......

At this moment it works on a test panels that I just created for test that way to do it, now I try to apply to the panels of chat tabs.

Thanks.

Phanx 08-07-13 03:07 PM

Quote:

Originally Posted by Akatosh (Post 282649)
¿Can be posible OnClick, remove the top border of the panel?.

If the border is actually a border, then no. You would need to remove the actual border from your panel, and create additional textures attached to each edge to look like a border -- then you could hide just one side of it.

suicidalkatt 08-07-13 03:08 PM

Quote:

Originally Posted by Akatosh (Post 282649)


The principal panel have the 4 borders.

And the panel of back have 3 borders (all, without top).

When I click the principal panel, alpha border of the principal panel get alfa 0, and they show the back panel with the 3 borders.

I try that this night leave me a time and I post the results.

Thanks.

That's not doable due to the way that the border is created here. The border here is a being placed with the :SetBackdrop property.

You'd have to set all the texture for the button and it'd take a bit more effort.

Akatosh 08-07-13 05:39 PM

Results:

Pictures:

General



Log



Trash




All Codes:

General:

OnLoad

Code:

local font,size = self.text:GetFont()
    self.text:SetFont(font,size,"OUTLINE")
    self.text:SetJustifyH("CENTER")
    self.text:SetJustifyV("CENTER")
   
    self.color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[select(2,UnitClass("player"))]
    self.frame = "ChatFrame1"

self:SetBackdropBorderColor(0, 0 , 0, 0)
self.bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 1,0.18, 0.18, 0.18, 1)

OnUpdate:

Code:

if _G[self.frame]:IsShown() or self.entered then
        self.text:SetTextColor(1,1,1)
    else
        self.text:SetTextColor(self.color.r,self.color.g,self.color.b)
    end

OnEnter

Code:

self.entered = true
OnLeave

Code:

self.entered = false
OnClick

Code:

FCF_Tab_OnClick(_G[self.frame.."Tab"],button)

local tab2 = kgPanels:FetchFrame("Log") 
local tab3 = kgPanels:FetchFrame("Trash")

self:SetBackdropBorderColor(0, 0 , 0, 0)
tab2:SetBackdropBorderColor(0, 0 , 0, 1)
tab3:SetBackdropBorderColor(0, 0 , 0, 1)

-------------

Log:

OnLoad

Code:

local font,size = self.text:GetFont()
    self.text:SetFont(font,size,"OUTLINE")
    self.text:SetJustifyH("CENTER")
    self.text:SetJustifyV("CENTER")
   
    self.color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[select(2,UnitClass("player"))]
    self.frame = "ChatFrame2"

OnUpdate

Code:

    if _G[self.frame]:IsShown() or self.entered then
        self.text:SetTextColor(1,1,1)
    else
        self.text:SetTextColor(self.color.r,self.color.g,self.color.b)
    end

OnEnter

Code:

self.entered = true
OnLeave

Code:

self.entered = false
OnClick

Code:

FCF_Tab_OnClick(_G[self.frame.."Tab"],button)

local tab1 = kgPanels:FetchFrame("General") 
local tab3 = kgPanels:FetchFrame("Trash")

self:SetBackdropBorderColor(0, 0 , 0, 0)
tab1:SetBackdropBorderColor(0, 0 , 0, 1)
tab3:SetBackdropBorderColor(0, 0 , 0, 1)
self.bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 1,0.18, 0.18, 0.18, 1)
tab1.bg:SetVertexColor(0.18, 0.18, 0.18)
tab3.bg:SetVertexColor(0.18, 0.18, 0.18)

---------------

Trash:

OnLoad

Code:

    local font,size = self.text:GetFont()
    self.text:SetFont(font,size,"OUTLINE")
    self.text:SetJustifyH("CENTER")
    self.text:SetJustifyV("CENTER")
   
    self.color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[select(2,UnitClass("player"))]
    self.frame = "ChatFrame3"

OnUpdate

Code:

    if _G[self.frame]:IsShown() or self.entered then
        self.text:SetTextColor(1,1,1)
    else
        self.text:SetTextColor(self.color.r,self.color.g,self.color.b)
    end

OnEnter

Code:

self.entered = true
OnLeave

Code:

self.entered = false
OnClick

Code:

FCF_Tab_OnClick(_G[self.frame.."Tab"],button)

local tab1 = kgPanels:FetchFrame("General") 
local tab2 = kgPanels:FetchFrame("Log")

self:SetBackdropBorderColor(0, 0 , 0, 0)
tab1:SetBackdropBorderColor(0, 0 , 0, 1)
tab2:SetBackdropBorderColor(0, 0 , 0, 1)
self.bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 1,0.18, 0.18, 0.18, 1)
tab1.bg:SetVertexColor(0.18, 0.18, 0.18)
tab2.bg:SetVertexColor(0.18, 0.18, 0.18)


Code for kgpanels:

Code:

^1^T^SLog^T^Sborder_advanced^T^Senable^B^Sshow^T^SBOT^B^STOPRIGHTCORNER^B^SLEFT^B^SBOTLEFTCORNER^B^SRIGHT^B^STOPLEFTCORNER^B^STOP^B^SBOTRIGHTCORNER^B^t^t^Sparent^SUIParent^Sbg_orientation^SHORIZONTAL^SanchorFrom^SCENTER^Shflip^b^Svflip^b^StileSize^N0^Sbg_texture^SBlizzard~`Tooltip^Sanchor^SUIParent^Slevel^N0^Svert_tile^b^Suse_absolute_bg^b^Sbg_blend^SBLEND^Stext^T^Sy^N0^Sx^S1^SjustifyH^SCENTER^Sfont^SContinuum_Medium^Scolor^T^Sa^N1^Sr^F6887858253625464^f-53^Sg^F8759942804610848^f-56^Sb^F8336074604387744^f-55^t^Stext^SLog^SjustifyV^SMIDDLE^Ssize^N12^t^Sy^S-130^Sx^S-267^Sbg_alpha^N1^Sborder_edgeSize^N4^Sheight^S22^Stiling^b^Sstrata^SBACKGROUND^Shorz_tile^b^SanchorTo^SCENTER^Sabsolute_bg^T^SULx^N0^SULy^N0^SLLy^N1^SLLx^N0^SURx^N1^SURy^N0^SLRx^N1^SLRy^N1^t^Sbg_insets^T^Sb^S0^St^S0^Sl^S0^Sr^S0^t^Sscripts^T^SENTER^Sself.entered~`=~`true^SLOAD^S~`~`~`~`local~`font,size~`=~`self.text:GetFont()~J~`~`~`~`self.text:SetFont(font,size,"OUTLINE")~J~`~`~`~`self.text:SetJustifyH("CENTER")~J~`~`~`~`self.text:SetJustifyV("CENTER")~J~`~`~`~`~`~J~`~`~`~`self.color~`=~`(CUSTOM_CLASS_COLORS~`or~`RAID_CLASS_COLORS)[select(2,UnitClass("player"))]~J~`~`~`~`self.frame~`=~`"ChatFrame2"^SCLICK^SFCF_Tab_OnClick(_G[self.frame.."Tab"],button)~J~Jlocal~`tab1~`=~`kgPanels:FetchFrame("General")~`~`~Jlocal~`tab3~`=~`kgPanels:FetchFrame("Trash")~`~J~Jself:SetBackdropBorderColor(0,~`0~`,~`0,~`0)~Jtab1:SetBackdropBorderColor(0,~`0~`,~`0,~`1)~Jtab3:SetBackdropBorderColor(0,~`0~`,~`0,~`1)~Jself.bg:SetGradientAlpha("VERTICAL",~`0,~`0,~`0,~`1,0.18,~`0.18,~`0.18,~`1)~Jtab1.bg:SetVertexColor(0.18,~`0.18,~`0.18)~Jtab3.bg:SetVertexColor(0.18,~`0.18,~`0.18)^SUPDATE^S~`~`~`~`if~`_G[self.frame]:IsShown()~`or~`self.entered~`then~J~`~`~`~`~`~`~`~`self.text:SetTextColor(1,1,1)~J~`~`~`~`else~J~`~`~`~`~`~`~`~`self.text:SetTextColor(self.color.r,self.color.g,self.color.b)~J~`~`~`~`end^SLEAVE^Sself.entered~`=~`false^t^Sbg_style^SSOLID^Sgradient_color^T^Sa^N1^Sr^N1^Sg^N1^Sb^N1^t^Sborder_color^T^Sa^N1^Sr^N0^Sg^N0^Sb^N0^t^Sborder_texture^SCaith^Swidth^S46^Srotation^N0^Sbg_color^T^Sa^N1^Sr^F6499312403420951^f-55^Sg^F6499312403420951^f-55^Sb^F6499312403420951^f-55^t^Smouse^B^Scrop^b^Ssub_level^N0^t^SGeneral^T^Sborder_advanced^T^Senable^B^Sshow^T^SBOTRIGHTCORNER^B^STOPRIGHTCORNER^B^SBOTLEFTCORNER^B^STOPLEFTCORNER^B^SRIGHT^B^SLEFT^B^STOP^B^SBOT^B^t^t^Sparent^SUIParent^Sbg_orientation^SHORIZONTAL^SanchorFrom^SCENTER^Shflip^b^Svflip^b^StileSize^N0^Sbg_texture^SBlizzard~`Tooltip^Sanchor^SUIParent^Slevel^N0^Svert_tile^b^Suse_absolute_bg^b^Sbg_blend^SBLEND^Stext^T^Sy^N0^Sfont^SContinuum_Medium^SjustifyH^SCENTER^Sx^S2^Scolor^T^Sa^N1^Sb^F8336074604387744^f-55^Sg^F8759942804610848^f-56^Sr^F6887858253625464^f-53^t^Stext^SGeneral^SjustifyV^SMIDDLE^Ssize^N12^t^Sy^S-130^Sx^S-323^Sbg_alpha^N1^Sborder_edgeSize^N4^Sheight^S22^Stiling^b^Sstrata^SBACKGROUND^Shorz_tile^b^SanchorTo^SCENTER^Sabsolute_bg^T^SLLy^N1^SLLx^N0^SLRy^N1^SLRx^N1^SURy^N0^SURx^N1^SULy^N0^SULx^N0^t^Sbg_insets^T^Sr^S0^St^S0^Sl^S0^Sb^S0^t^Sscripts^T^SENTER^Sself.entered~`=~`true^SLOAD^S~`~`~`~`local~`font,size~`=~`self.text:GetFont()~J~`~`~`~`self.text:SetFont(font,size,"OUTLINE")~J~`~`~`~`self.text:SetJustifyH("CENTER")~J~`~`~`~`self.text:SetJustifyV("CENTER")~J~`~`~`~`~`~J~`~`~`~`self.color~`=~`(CUSTOM_CLASS_COLORS~`or~`RAID_CLASS_COLORS)[select(2,UnitClass("player"))]~J~`~`~`~`self.frame~`=~`"ChatFrame1"~J~Jself:SetBackdropBorderColor(0,~`0~`,~`0,~`0)~Jself.bg:SetGradientAlpha("VERTICAL",~`0,~`0,~`0,~`1,0.18,~`0.18,~`0.18,~`1)^SCLICK^SFCF_Tab_OnClick(_G[self.frame.."Tab"],button)~J~Jlocal~`tab2~`=~`kgPanels:FetchFrame("Log")~`~`~Jlocal~`tab3~`=~`kgPanels:FetchFrame("Trash")~`~J~Jself:SetBackdropBorderColor(0,~`0~`,~`0,~`0)~Jtab2:SetBackdropBorderColor(0,~`0~`,~`0,~`1)~Jtab3:SetBackdropBorderColor(0,~`0~`,~`0,~`1)~Jself.bg:SetGradientAlpha("VERTICAL",~`0,~`0,~`0,~`1,0.18,~`0.18,~`0.18,~`1)~Jtab2.bg:SetVertexColor(0.18,~`0.18,~`0.18)~Jtab3.bg:SetVertexColor(0.18,~`0.18,~`0.18)^SUPDATE^S~`~`~`~`if~`_G[self.frame]:IsShown()~`or~`self.entered~`then~J~`~`~`~`~`~`~`~`self.text:SetTextColor(1,1,1)~J~`~`~`~`else~J~`~`~`~`~`~`~`~`self.text:SetTextColor(self.color.r,self.color.g,self.color.b)~J~`~`~`~`end^SLEAVE^Sself.entered~`=~`false^t^Sbg_style^SSOLID^Sgradient_color^T^Sa^N0^Sb^N1^Sg^N1^Sr^N1^t^Sborder_color^T^Sa^N1^Sb^N0^Sg^N0^Sr^N0^t^Sborder_texture^SCaith^Swidth^S68^Ssub_level^N0^Scrop^b^Smouse^B^Sbg_color^T^Sa^N1^Sb^F4945129002602899^f-54^Sg^F4945129002602899^f-54^Sr^F4945129002602899^f-54^t^Srotation^N0^t^SChatB^T^Sborder_advanced^T^Senable^B^Sshow^T^SBOTRIGHTCORNER^b^STOPRIGHTCORNER^b^SBOTLEFTCORNER^b^STOPLEFTCORNER^b^SRIGHT^B^SLEFT^B^STOP^b^SBOT^b^t^t^Sparent^SUIParent^Ssub_level^N0^SanchorFrom^SCENTER^Shflip^b^Svflip^b^StileSize^N0^Sbg_texture^SNone^Sanchor^SUIParent^Slevel^N0^Suse_absolute_bg^b^Sbg_blend^SBLEND^Stext^T^Sy^N0^Sfont^SBlizzard^SjustifyH^SCENTER^Sx^N0^Scolor^T^Sa^N1^Sb^N1^Sg^N1^Sr^N1^t^Stext^S^SjustifyV^SMIDDLE^Ssize^N12^t^Srotation^N0^Sx^S-375^Sbg_alpha^N1^Sborder_edgeSize^N4^Sheight^S182^Stiling^b^Sstrata^SBACKGROUND^SanchorTo^SCENTER^Sabsolute_bg^T^SULx^N0^SULy^N0^SLLy^N1^SLLx^N0^SURy^N0^SURx^N1^SLRx^N1^SLRy^N1^t^Sbg_insets^T^Sr^S^St^S^Sl^S^Sb^S^t^Sscripts^T^t^Sbg_style^SNONE^Sgradient_color^T^Sa^N1^Sb^N1^Sg^N1^Sr^N1^t^Sborder_color^T^Sa^N1^Sb^N0^Sg^N0^Sr^N0^t^Sborder_texture^SCaith^Swidth^S368^Sy^S-50^Sbg_color^T^Sa^N1^Sb^F6499312403420951^f-55^Sg^F6499312403420951^f-55^Sr^F6499312403420951^f-55^t^Smouse^b^Scrop^b^Sbg_orientation^SHORIZONTAL^t^SLogB^T^Sborder_advanced^T^Senable^B^Sshow^T^SBOTRIGHTCORNER^B^STOPRIGHTCORNER^b^STOPLEFTCORNER^b^SBOTLEFTCORNER^B^SRIGHT^B^SLEFT^B^STOP^b^SBOT^B^t^t^Sparent^SUIParent^Sbg_orientation^SHORIZONTAL^SanchorFrom^SCENTER^Shflip^b^Svflip^b^StileSize^N0^Sbg_texture^SNone^Sanchor^SUIParent^Slevel^N0^Svert_tile^b^Suse_absolute_bg^b^Sbg_blend^SBLEND^Stext^T^Sy^N0^Sfont^SContinuum_Medium^SjustifyH^SCENTER^Sx^S1^Scolor^T^Sa^N1^Sb^F8336074604387744^f-55^Sg^F8759942804610848^f-56^Sr^F6887858253625464^f-53^t^Stext^S^SjustifyV^SMIDDLE^Ssize^N12^t^Sy^S-130^Sx^S-267^Sbg_alpha^N1^Sborder_edgeSize^N4^Sheight^S22^Stiling^b^Sstrata^SBACKGROUND^Shorz_tile^b^SanchorTo^SCENTER^Sabsolute_bg^T^SLRy^N1^SLRx^N1^SULx^N0^SULy^N0^SURy^N0^SURx^N1^SLLx^N0^SLLy^N1^t^Sbg_insets^T^Sr^S0^St^S0^Sl^S0^Sb^S0^t^Sscripts^T^SENTER^S^SLOAD^S"^SCLICK^S^SUPDATE^S^SLEAVE^S^t^Sbg_style^SNONE^Sgradient_color^T^Sa^N0^Sb^N1^Sg^N1^Sr^N1^t^Sborder_color^T^Sa^N1^Sb^N0^Sg^N0^Sr^N0^t^Sborder_texture^SCaith^Swidth^S46^Ssub_level^N0^Scrop^b^Smouse^b^Sbg_color^T^Sa^N1^Sb^F6499312403420951^f-55^Sg^F6499312403420951^f-55^Sr^F6499312403420951^f-55^t^Srotation^N0^t^SGeneralB^T^Sborder_advanced^T^Senable^B^Sshow^T^SBOTRIGHTCORNER^B^STOPRIGHTCORNER^b^SBOTLEFTCORNER^B^STOPLEFTCORNER^b^SRIGHT^B^SLEFT^B^STOP^b^SBOT^B^t^t^Sparent^SUIParent^Sbg_orientation^SHORIZONTAL^SanchorFrom^SCENTER^Shflip^b^Svflip^b^StileSize^N0^Sbg_texture^SNone^Sanchor^SUIParent^Slevel^N0^Svert_tile^b^Suse_absolute_bg^b^Sbg_blend^SBLEND^Stext^T^Sy^N0^Sfont^SContinuum_Medium^SjustifyH^SCENTER^Sx^S2^Scolor^T^Sa^N1^Sb^F8336074604387744^f-55^Sg^F8759942804610848^f-56^Sr^F6887858253625464^f-53^t^Stext^S^SjustifyV^SMIDDLE^Ssize^N12^t^Sy^S-130^Sx^S-323^Sbg_alpha^N1^Sborder_edgeSize^N4^Sheight^S22^Stiling^b^Sstrata^SBACKGROUND^Shorz_tile^b^SanchorTo^SCENTER^Sabsolute_bg^T^SLLy^N1^SLLx^N0^SLRy^N1^SLRx^N1^SURy^N0^SURx^N1^SULy^N0^SULx^N0^t^Sbg_insets^T^Sr^S0^St^S0^Sl^S0^Sb^S0^t^Sscripts^T^SENTER^S^SLOAD^S^SCLICK^S^SUPDATE^S^SLEAVE^S^t^Sbg_style^SNONE^Sgradient_color^T^Sa^N0^Sb^N1^Sg^N1^Sr^N1^t^Sborder_color^T^Sa^N1^Sb^N0^Sg^N0^Sr^N0^t^Sborder_texture^SCaith^Swidth^S68^Ssub_level^N0^Scrop^b^Smouse^b^Sbg_color^T^Sa^N1^Sb^F6499312403420951^f-55^Sg^F6499312403420951^f-55^Sr^F6499312403420951^f-55^t^Srotation^N0^t^STrash^T^Sborder_advanced^T^Senable^b^Sshow^T^SBOT^B^STOPRIGHTCORNER^B^SLEFT^B^SBOTLEFTCORNER^B^SRIGHT^B^STOPLEFTCORNER^B^STOP^B^SBOTRIGHTCORNER^B^t^t^Sparent^SUIParent^Ssub_level^N0^SanchorFrom^SCENTER^Shflip^b^Svflip^b^StileSize^N0^Sbg_texture^SBlizzard~`Tooltip^Sanchor^SUIParent^Slevel^N0^Suse_absolute_bg^b^Sbg_blend^SBLEND^Stext^T^Sy^S0^Sfont^SContinuum_Medium^SjustifyH^SCENTER^Sx^S0^Scolor^T^Sa^N1^Sr^N1^Sg^N1^Sb^N1^t^Stext^STrash^SjustifyV^SMIDDLE^Ssize^N12^t^Srotation^N0^Sx^S-218^Sbg_alpha^N1^Sborder_edgeSize^N4^Sheight^S22^Stiling^b^Sstrata^SBACKGROUND^SanchorTo^SCENTER^Sabsolute_bg^T^SLRy^N1^SLRx^N1^SULx^N0^SULy^N0^SURx^N1^SURy^N0^SLLx^N0^SLLy^N1^t^Sbg_insets^T^Sb^S^St^S^Sl^S^Sr^S^t^Sscripts^T^SENTER^Sself.entered~`=~`true^SLOAD^S~`~`~`~`local~`font,size~`=~`self.text:GetFont()~J~`~`~`~`self.text:SetFont(font,size,"OUTLINE")~J~`~`~`~`self.text:SetJustifyH("CENTER")~J~`~`~`~`self.text:SetJustifyV("CENTER")~J~`~`~`~`~`~J~`~`~`~`self.color~`=~`(CUSTOM_CLASS_COLORS~`or~`RAID_CLASS_COLORS)[select(2,UnitClass("player"))]~J~`~`~`~`self.frame~`=~`"ChatFrame3"~J^SLEAVE^Sself.entered~`=~`false^SCLICK^SFCF_Tab_OnClick(_G[self.frame.."Tab"],button)~J~Jlocal~`tab1~`=~`kgPanels:FetchFrame("General")~`~`~Jlocal~`tab2~`=~`kgPanels:FetchFrame("Log")~`~J~Jself:SetBackdropBorderColor(0,~`0~`,~`0,~`0)~Jtab1:SetBackdropBorderColor(0,~`0~`,~`0,~`1)~Jtab2:SetBackdropBorderColor(0,~`0~`,~`0,~`1)~Jself.bg:SetGradientAlpha("VERTICAL",~`0,~`0,~`0,~`1,0.18,~`0.18,~`0.18,~`1)~Jtab1.bg:SetVertexColor(0.18,~`0.18,~`0.18)~Jtab2.bg:SetVertexColor(0.18,~`0.18,~`0.18)^SUPDATE^S~`~`~`~`if~`_G[self.frame]:IsShown()~`or~`self.entered~`then~J~`~`~`~`~`~`~`~`self.text:SetTextColor(1,1,1)~J~`~`~`~`else~J~`~`~`~`~`~`~`~`self.text:SetTextColor(self.color.r,self.color.g,self.color.b)~J~`~`~`~`end^SEVENT^S^t^Sbg_style^SSOLID^Sgradient_color^T^Sa^N1^Sr^N1^Sg^N1^Sb^N1^t^Sborder_color^T^Sa^N1^Sr^N0^Sg^N0^Sb^N0^t^Sborder_texture^SCaith^Swidth^S54^Sbg_orientation^SHORIZONTAL^Scrop^b^Smouse^B^Sbg_color^T^Sa^N1^Sr^F6499312403420951^f-55^Sg^F6499312403420951^f-55^Sb^F6499312403420951^f-55^t^Sy^S-130^t^SChat^T^Sborder_advanced^T^Senable^B^Sshow^T^SBOT^b^STOPRIGHTCORNER^b^SLEFT^B^STOPLEFTCORNER^b^SRIGHT^B^SBOTLEFTCORNER^b^STOP^b^SBOTRIGHTCORNER^b^t^t^Sparent^SUIParent^Sbg_orientation^SHORIZONTAL^SanchorFrom^SCENTER^Shflip^b^Svflip^b^StileSize^N0^Sbg_texture^SBlizzard~`Tooltip^Sanchor^SUIParent^Slevel^N0^Suse_absolute_bg^b^Sbg_blend^SBLEND^Stext^T^Sy^N0^Sx^N0^SjustifyH^SCENTER^Sfont^SBlizzard^Scolor^T^Sa^N1^Sr^N1^Sg^N1^Sb^N1^t^Stext^S^SjustifyV^SMIDDLE^Ssize^N12^t^Srotation^N0^Sx^S-375^Sbg_alpha^N1^Sborder_edgeSize^N4^Sheight^S158^Stiling^b^Sstrata^SBACKGROUND^SanchorTo^SCENTER^Sabsolute_bg^T^SLLy^N1^SLLx^N0^SLRy^N1^SLRx^N1^SURx^N1^SURy^N0^SULy^N0^SULx^N0^t^Sbg_insets^T^Sb^S^St^S^Sl^S^Sr^S^t^Sscripts^T^t^Sbg_style^SSOLID^Sgradient_color^T^Sa^N1^Sr^N1^Sg^N1^Sb^N1^t^Sborder_color^T^Sa^N1^Sr^N0^Sg^N0^Sb^N0^t^Sborder_texture^SCaith^Swidth^S368^Ssub_level^N0^Scrop^b^Smouse^b^Sbg_color^T^Sa^N1^Sr^F6499312403420951^f-55^Sg^F6499312403420951^f-55^Sb^F6499312403420951^f-55^t^Sy^S-40^t^STrashB^T^Sborder_advanced^T^Senable^B^Sshow^T^SBOTRIGHTCORNER^B^STOPRIGHTCORNER^b^STOPLEFTCORNER^b^SBOTLEFTCORNER^B^SRIGHT^B^SLEFT^B^STOP^b^SBOT^B^t^t^Sparent^SUIParent^Ssub_level^N0^SanchorFrom^SCENTER^Shflip^b^Svflip^b^StileSize^N0^Sbg_texture^SNone^Sanchor^SUIParent^Slevel^N0^Suse_absolute_bg^b^Sbg_blend^SBLEND^Stext^T^Sy^S0^Sx^S0^SjustifyH^SCENTER^Sfont^SContinuum_Medium^Scolor^T^Sa^N1^Sb^N1^Sg^N1^Sr^N1^t^Stext^S^SjustifyV^SMIDDLE^Ssize^N12^t^Srotation^N0^Sx^S-218^Sbg_alpha^N1^Sborder_edgeSize^N4^Sheight^S22^Stiling^b^Sstrata^SBACKGROUND^SanchorTo^SCENTER^Sabsolute_bg^T^SLLy^N1^SLLx^N0^SLRy^N1^SLRx^N1^SURy^N0^SURx^N1^SULy^N0^SULx^N0^t^Sbg_insets^T^Sr^S^St^S^Sl^S^Sb^S^t^Sscripts^T^SENTER^S^SLOAD^S^SEVENT^S^SCLICK^S^SUPDATE^S^SLEAVE^S^t^Sbg_style^SNONE^Sgradient_color^T^Sa^N1^Sb^N1^Sg^N1^Sr^N1^t^Sborder_color^T^Sa^N1^Sb^N0^Sg^N0^Sr^N0^t^Sborder_texture^SCaith^Swidth^S54^Sy^S-130^Sbg_color^T^Sa^N1^Sb^F6499312403420951^f-55^Sg^F6499312403420951^f-55^Sr^F6499312403420951^f-55^t^Smouse^b^Scrop^b^Sbg_orientation^SHORIZONTAL^t^t^^
What I do:

The part of borders:

two panels of every Tab with that:
1) A back panel of each tab with 3 borders (Right, Left, and bot), background transparent and the corners of top are hidden. Example: |_|
2) A Front panel of each tab with all the borders corner and background. Example: []

When I click the panel, Alpha of the Front panel (2), set to 0, so the borders of the panel with 4 borders dissapear, and now the back panel with 3 borders are visible, that make the efect of we remove the border of top.

Now appear a new problem, cause of corners of back panel (1), are hidden, appear 2 blank spaces, equivalent of top right and top left corners, so... I create 2 panels to fix that.

3) 1 panel with the background and only the borders of right and left. Example : | |
4) 1 panel with all borders and no background (transparent). Example: []

When I join it, the panel (3) cover that blank spaces of the corner tabs, and the panel (4) cover the background and the rest of corners.

So at this point the part of borders its OK.


Now the part of Gradients and colors:

I find a few of Lua codes of gradients I think that understand the next (can be wrong but i think that its ok), I explain:

self.bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 1,0.18, 0.18, 0.18, 1)
____________[Tipe of gradient]_|___[First color][Second color]___

In parits of 4 numbers, the first 3 numbers are the code of color, the 4 number is the alpha of the color (transparency).

I learn to, that with a division of the rgb color per 255, I can give the number what I need.

So When I click each tab, Itselfs take a gradient color (Black / Grey), and the rest of tabs get a solid color of Grey (0.18, 0.18, 0.18), the division of 46, 46, 46 per 255.

Another long day with Lua , for today its enought for me... I need sleep again :(:(

Plans for tomorrow Xdd Xdd (today) : try to fix the filter of combat log.

Cause of I hide the tabs with an option of chatter, the filter of CombatLog dissapear too, dont be intended that... I need that filter.


Thanks for all !!


All times are GMT -6. The time now is 10:35 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI