Quantcast

Reset specialization button selected on first show

Adrian L Lange [04-27-13 - 20:34]
Reset specialization button selected on first show
Filename
HabeebIt.lua
diff --git a/HabeebIt.lua b/HabeebIt.lua
index 827422d..b5a0924 100644
--- a/HabeebIt.lua
+++ b/HabeebIt.lua
@@ -123,6 +123,18 @@ local function PopulateList()
 	end
 end

+local function UpdateSpecializations(currentIndex)
+	for index, button in pairs(specializations) do
+		if(currentIndex == index) then
+			button.LeftBorder:SetVertexColor(1, 0, 0)
+			button.RightBorder:SetVertexColor(1, 0, 0)
+		else
+			button.LeftBorder:SetVertexColor(1, 1, 1)
+			button.RightBorder:SetVertexColor(1, 1, 1)
+		end
+	end
+end
+
 local function InitializeList(specialization, shown)
 	for index, button in pairs(items) do
 		button:Hide()
@@ -131,6 +143,7 @@ local function InitializeList(specialization, shown)
 	if(not shown) then
 		collapsed = false
 		Handle:GetScript('OnClick')(Handle)
+		UpdateSpecializations(specialization)
 	end

 	local currentInstance = EJ_GetCurrentInstance()
@@ -146,18 +159,6 @@ local function InitializeList(specialization, shown)
 	PopulateList()
 end

-local function UpdateSpecializations(currentIndex)
-	for index, button in pairs(specializations) do
-		if(currentIndex == index) then
-			button.LeftBorder:SetVertexColor(1, 0, 0)
-			button.RightBorder:SetVertexColor(1, 0, 0)
-		else
-			button.LeftBorder:SetVertexColor(1, 1, 1)
-			button.RightBorder:SetVertexColor(1, 1, 1)
-		end
-	end
-end
-
 local function SpecializationClick(self)
 	UpdateSpecializations(self.index)
 	InitializeList(self.index, true)