View Single Post
05-04-14, 11:19 PM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Also I peeked at one of your modules (Professions.lua), and you're leaking globals again; I assume the others have the same issue. For example, near the top you're leaking "db", "hexa" and "hexb" as globals.

Also you're doing some things wrong again:

Code:
nData:PlacePlugin(db.pro, Text)
1 - Aside from needing to update this for the ordering changes, you should be passing the plugin button/frame object to PlacePlugin, not the object's font string. Otherwise you will end up with the same problems you had before, with invisible clickable regions, etc.

2 - You should not be placing the plugin inside its constructor function anyway. Just delete this line entirely.

Code:
Text:SetFormattedText(hexa.."Professions"..hexb)
There's no reason to use SetFormattedText if you're not actually formatting anything. If you're passing a plain string that doesn't require formatting, use SetText instead.

Code:
if v ~= nil then
	local name, texture, rank, maxRank = GetProfessionInfo(v)
	Text:SetFormattedText(hexa.."Professions"..hexb)
end
If you're not using any of the info returned by GetProfessionInfo, save yourself the function call and don't call it at all.

Code:
local plugin = CreateFrame('Button', nil, Datapanel)
I was going to tell you this is pointless because "Datapanel" isn't defined in this scope... and then I looked at your other file and noticed you've reverted to using this generic name as the global name of your frame. Don't do that. Global object names, like all globals, should be unique, and should clearly identify the addon creating them. "Datapanel" doesn't satisfy either of those criteria. "nData_Datapanel" would be better -- it clearly identifies the frame as belonging to the nData addon, and it's extremely unlikely to conflict with any global created by any other addon or the default UI.

However, specifying a parent here is still pointless, because you're going to re-parent the plugin frame later anyway.

Code:
self:SetAllPoints(Text)
Instead of that, do this:

Code:
self:SetWidth(self:GetStringWidth())
Otherwise you will mess up parenting again.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote