Thread Tools Display Modes
11-30-13, 10:41 AM   #1
Khios
A Defias Bandit
Join Date: Nov 2013
Posts: 2
Chat Align Text

Ok, thanks to some help on the Tukui forum I've finally reached my point to have my chat text align right or left but during the process I stumbled upon a strange error, using the "name" parameter when configuring the alignment does not work.

I'm not asking for help, I would just like to know why the function is not working Here's the code

Code:
if id == 3 and name == LOOT.." / "..TRADE then
    frame:SetJustifyH("RIGHT")
end
The name of the tabs are created during installation using this code

Code:
if i == 1 then
    FCF_SetWindowName(frame, GENERAL)
elseif i == 2 then
    FCF_SetWindowName(frame, GUILD_EVENT_LOG)
elseif i == 3 then
    FCF_SetWindowName(frame, LOOT.." / "..TRADE)
end
Any idea? just for my brain tranquility

Full chat creation function

Code:
for i = 1, NUM_CHAT_WINDOWS do
        local frame = _G[format("ChatFrame%s", i)]
        local chatFrameId = frame:GetID()
	local chatName = FCF_GetChatWindowInfo(chatFrameId)
		
	-- move general bottom left
	if i == 1 then
		frame:ClearAllPoints()
		frame:Point("BOTTOMLEFT", LeftChatToggleButton, "TOPLEFT", 1, 3)			
	elseif i == 3 then
		frame:ClearAllPoints()
		frame:Point("BOTTOMLEFT", RightChatDataPanel, "TOPLEFT", 1, 3)
	end
		
	FCF_SavePositionAndDimensions(frame)
	FCF_StopDragging(frame)
		
	-- set default Elvui font size
	FCF_SetChatWindowFontSize(nil, frame, 12)
		
	-- rename windows general because moved to chat #3
	if i == 1 then
		FCF_SetWindowName(frame,GENERAL)
	elseif i == 2 then
		FCF_SetWindowName(frame, GUILD_EVENT_LOG)
	elseif i == 3 then 
		FCF_SetWindowName(frame, LOOT.." / "..TRADE) 
	end
end

Last edited by Khios : 11-30-13 at 10:46 AM.
  Reply With Quote
11-30-13, 11:37 AM   #2
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
So you are having an issue in one section of code but only provided a tiny piece, yet provided an entire block of code for a portion that may or may not even be related to the issue? Or is that portion you say doesn't work supposed to be in that other block?

If you need help with code you need to really provide all the code. For all we know the id in the first bit is a typo and should be i like in the second bit.

Based on what you provided, I would just do the SetJustifyH in the for loop you posted:
Code:
for i = 1, NUM_CHAT_WINDOWS do
    local frame = _G["ChatFrame"..i]

    -- window specific tweaks
    if i == 1 then
        FCF_SetWindowName(frame, GENERAL)
        frame:ClearAllPoints()
        frame:Point("BOTTOMLEFT", LeftChatToggleButton, "TOPLEFT", 1, 3)			
    elseif i == 2 then
        FCF_SetWindowName(frame, GUILD_EVENT_LOG)
    elseif i == 3 then 
        FCF_SetWindowName(frame, LOOT.." / "..TRADE) 
        frame:ClearAllPoints()
        frame:Point("BOTTOMLEFT", RightChatDataPanel, "TOPLEFT", 1, 3)
        frame:SetJustifyH("RIGHT")
    end

    FCF_SavePositionAndDimensions(frame)
    FCF_StopDragging(frame)

    -- set default Elvui font size
    FCF_SetChatWindowFontSize(nil, frame, 12)
end
  Reply With Quote
11-30-13, 04:51 PM   #3
Khios
A Defias Bandit
Join Date: Nov 2013
Posts: 2
I fixed it finally there's 2 solutions here's the cleaner one

Code:
function CH:StyleChat(frame)
    local name = frame:GetName()
    _G[name.."TabText"]:FontTemplate(LSM:Fetch("font", self.db.tabFont), self.db.tabFontSize, self.db.tabFontOutline)
	
    if frame.styled then return end
	
    frame:SetFrameLevel(4)
	
    local id = frame:GetID()
    local tabText = GetChatWindowInfo(id)
	
        if id == 1 and tabText == GENERAL then
            frame:SetJustifyH("RIGHT")
	end
	
	if id == 2 and tabText == GUILD_EVENT_LOG then
            frame:SetJustifyH("RIGHT")
	end
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Chat Align Text


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off