Quantcast

AckisRecipeList:

Jim-Bim [11-17-08 - 01:43]
AckisRecipeList:
- search button isn't enabled for default text anymore
- enable search button after typing in new text
- disable search button after search succeeded
- remember last text to be able to disable correctly
Filename
ARLFrame.lua
diff --git a/ARLFrame.lua b/ARLFrame.lua
index 7db3237..1dd6d77 100644
--- a/ARLFrame.lua
+++ b/ARLFrame.lua
@@ -3226,8 +3226,9 @@ function addon:CreateFrame(
 			ARL_ExpandButton:SetScript("OnClick", addon.ExpandAll_Clicked)

 		local ARL_SearchButton = addon:GenericCreateButton("ARL_SearchButton", addon.Frame,
-			25, 74, "TOPLEFT", ARL_SortButton, "BOTTOMRIGHT", 41, -2, "GameFontNormalSmall",
+			25, 74, "TOPLEFT", ARL_SortButton, "BOTTOMRIGHT", 41, -2, "GameFontDisableSmall",
 			"GameFontHighlightSmall", L["Search"], "CENTER", L["SEARCH_DESC"], 1)
+			ARL_SearchButton:Disable()
 			ARL_SearchButton:SetScript("OnClick",
 				function(this)

@@ -3236,10 +3237,15 @@ function addon:CreateFrame(

 					if (searchtext ~= "") then

+						ARL_LastSearchedText = searchtext
+
 						addon:SearchRecipeDB(recipeDB, searchtext)
 						initDisplayStrings()
 						RecipeList_Update()

+						ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
+						ARL_SearchButton:Disable()
+
 					end

 				end
@@ -3261,6 +3267,9 @@ function addon:CreateFrame(
 					-- Make sure to clear the focus of the searchbox
 					ARL_SearchText:ClearFocus()

+					-- Make sure to clear text for last search
+					ARL_LastSearchedText = ""
+
 					initDisplayStrings()
 					RecipeList_Update()

@@ -3277,10 +3286,15 @@ function addon:CreateFrame(

 					if (searchtext ~= "") then

+						ARL_LastSearchedText = searchtext
+
 						addon:SearchRecipeDB(recipeDB, searchtext)
 						initDisplayStrings()
 						RecipeList_Update()

+						ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
+						ARL_SearchButton:Disable()
+
 					end

 				end
@@ -3307,6 +3321,23 @@ function addon:CreateFrame(

 				end
 			)
+			ARL_SearchText:SetScript("OnTextChanged",
+				function(this)
+
+					if (this:GetText() ~= "" and this:GetText() ~= L["SEARCH_BOX_DESC"] and this:GetText() ~= ARL_LastSearchedText) then
+
+						ARL_SearchButton:SetNormalFontObject("GameFontNormalSmall")
+						ARL_SearchButton:Enable()
+
+					else
+
+						ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
+						ARL_SearchButton:Disable()
+
+					end
+
+				end
+			)
 			ARL_SearchText:EnableMouse(true)
 			ARL_SearchText:SetAutoFocus(false)
 			ARL_SearchText:SetFontObject(ChatFontNormal)