diff LibFarmbuyer.lua @ 39:8f7ec6ccf5e3

Comment/debug changes to help in tracking down cache bug. Do not run OnAccept when pressing Enter in an empty editbox.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Thu, 29 Dec 2011 23:15:51 +0000
parents f560cf82e7d3
children 1001dd95dbeb
line wrap: on
line diff
--- a/LibFarmbuyer.lua	Fri Dec 23 01:08:02 2011 +0000
+++ b/LibFarmbuyer.lua	Thu Dec 29 23:15:51 2011 +0000
@@ -25,7 +25,7 @@
   Fills out "typical" settings inside T, especially if T contains any kind
   of editbox:
    + cannot accept an empty editbox
-   + pressing Enter runs OnAccept
+   + pressing Enter runs OnAccept (also will not accept empty editbox)
    + editbox grabs keyboard focus
    + OnAccept runs with editbox's text in dialog.usertext
   Returns T.
@@ -50,7 +50,7 @@
   Ditto for table recycling.
 ]]
 
-local MAJOR, MINOR = "LibFarmbuyer", 12
+local MAJOR, MINOR = "LibFarmbuyer", 13
 assert(LibStub,MAJOR.." requires LibStub")
 local lib = LibStub:NewLibrary(MAJOR, MINOR)
 if not lib then return end
@@ -144,9 +144,10 @@
 	end
 end
 local function EditBoxOnEnterPressed_accept (editbox)
-    local dialog = editbox:GetParent()
-    StaticPopupDialogs[dialog.which].OnAccept (dialog, dialog.data, dialog.data2)
-    dialog:Hide()
+	if editbox:GetText() == "" then return end
+	local dialog = editbox:GetParent()
+	StaticPopupDialogs[dialog.which].OnAccept (dialog, dialog.data, dialog.data2)
+	dialog:Hide()
 end
 local function OnShow_witheditbox (dialog, data)
 	local info = StaticPopupDialogs[dialog.which]