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