API:AccountBagFrame OnLoad

__NOTOC__
Called on the initialization of AccountBagFrame. This function has 2 roles: updating the AccountBagFrame or hiding it.
AccountBagFrame_OnLoad(this)
== Parameters ==
=== Arguments ===
:;this
::String - uses self frame name, "AccountBagFrame"
=== Returns ===
:nil
== Example ==
AccountBagFrame_OnEvent("AccountBagFrame")
== Related Functions ==
* AccountBagFrame_OnEvent
* AccountBagFrame_OnShow
* AccountBagFrame_Update
== Source Code ==
function AccountBagFrame_OnLoad(this)
	this:RegisterEvent("ACCOUNTBAG_UPDATE");
	this:RegisterEvent("ACCOUNTBAG_CLOSE");
	
	local itemButton;
	local lineItems = 7;
	local maxlines = math.floor((MAX_ACCOUNT_BAG_ITEMS + lineItems - 1) / lineItems);
	for i = 2, MAX_ACCOUNT_BAG_ITEMS do
		itemButton = getglobal("AccountBagItemButton"..i);
		itemButton:ClearAllAnchors();
		if ( i <= lineItems ) then
			itemButton:SetAnchor("TOPLEFT", "TOPRIGHT", "AccountBagItemButton"..(i - 1), 3, 0);
		else
			itemButton:SetAnchor("TOPLEFT", "BOTTOMLEFT", "AccountBagItemButton"..(i - lineItems), 0, 3);
		end
	end
	local width = BAG_ITMEBUTTON_SIZE * (lineItems + 1) + BAG_ITEM_SPACING * lineItems + 4;
	local height = BAG_ITMEBUTTON_SIZE * (maxlines + 1) + BAG_ITEM_SPACING * maxlines + AccountBagItemControlText:GetHeight() + 20;
	
	AccountBagItemFrame:SetWidth(width);
	AccountBagItemFrame:SetHeight(height);
	AccountBagFrame:SetWidth(width);
	AccountBagFrame:SetHeight(height + 26);
	AccountBagFrame_Update();
end
Category:Functions