Sorry for the confusion but the chatBox2 is actually the KgPanel. I'm not trying to access the chat box but to access the panel which I use for the background of the chat frame.
EDIT: This is the full code:
I have one button (chatBox2ButtonExpand) to show the chatBox2 frame:
OnLoad:
Code:
if kgPanels:FetchFrame("chatBox2"):IsVisible() then
self:Hide()
else
self:Show()
end
OnUpdate:
Code:
if InCombatLockdown() then return end
if kgPanels:FetchFrame("chatBox2ButtonRetract"):IsVisible() then
self:Hide()
elseif IsAltKeyDown() and not IsControlKeyDown() and not IsShiftKeyDown() then
self:Show()
else
self:Hide()
end
OnClick:
Code:
local scripts = kgPanelsDB.global.layouts["MayronUI"]["chatBox2"].scripts
if pressed then
if InCombatLockdown() then return end
kgPanels:FetchFrame("chatBox2"):Show()
if scripts.LOAD:sub(-11,-7) == "self:" then
if scripts.LOAD:sub(-6) == "Hide()" then
scripts.LOAD = scripts.LOAD:sub(1,-12).."self:Show()"
end
else
scripts.LOAD = scripts.LOAD.."\nself:Show()"
end
kgPanels:FetchFrame("chatBox2ButtonRetract"):Show()
self:Hide()
end
the ChatBox2:
OnLoad:
and the ChatBox2ButtonRetract (button to hide the chatBox2 frame):
OnLoad:
Code:
if kgPanels:FetchFrame("chatBox2"):IsVisible() then
self:Show()
else
self:Hide()
end
OnUpdate:
Code:
if InCombatLockdown() then return end
if kgPanels:FetchFrame("chatBox2"):IsVisible() then
if IsAltKeyDown() and not IsControlKeyDown() and not IsShiftKeyDown() then
self:Show()
else
self:Hide()
end
else
self:Hide()
end
OnClick:
Code:
local scripts = kgPanelsDB.global.layouts["MayronUI"]["chatBox2"].scripts
if pressed then
if InCombatLockdown() then return end
kgPanels:FetchFrame("chatBox2"):Hide()
if scripts.LOAD:sub(-11,-7) == "self:" then
if scripts.LOAD:sub(-6) == "Show()" then
scripts.LOAD = scripts.LOAD:sub(1,-12).."self:Hide()"
end
else
scripts.LOAD = scripts.LOAD.."\nself:Hide()"
end
kgPanels:FetchFrame("chatBox2ButtonExpand"):Show()
self:Hide()
end
_