comparison 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
comparison
equal deleted inserted replaced
38:bb41be8f13b2 39:8f7ec6ccf5e3
23 23
24 - t = StaticPopup(t) 24 - t = StaticPopup(t)
25 Fills out "typical" settings inside T, especially if T contains any kind 25 Fills out "typical" settings inside T, especially if T contains any kind
26 of editbox: 26 of editbox:
27 + cannot accept an empty editbox 27 + cannot accept an empty editbox
28 + pressing Enter runs OnAccept 28 + pressing Enter runs OnAccept (also will not accept empty editbox)
29 + editbox grabs keyboard focus 29 + editbox grabs keyboard focus
30 + OnAccept runs with editbox's text in dialog.usertext 30 + OnAccept runs with editbox's text in dialog.usertext
31 Returns T. 31 Returns T.
32 32
33 - nullfunc() 33 - nullfunc()
48 48
49 - new(...), del(t), copy(t), clear() 49 - new(...), del(t), copy(t), clear()
50 Ditto for table recycling. 50 Ditto for table recycling.
51 ]] 51 ]]
52 52
53 local MAJOR, MINOR = "LibFarmbuyer", 12 53 local MAJOR, MINOR = "LibFarmbuyer", 13
54 assert(LibStub,MAJOR.." requires LibStub") 54 assert(LibStub,MAJOR.." requires LibStub")
55 local lib = LibStub:NewLibrary(MAJOR, MINOR) 55 local lib = LibStub:NewLibrary(MAJOR, MINOR)
56 if not lib then return end 56 if not lib then return end
57 57
58 _G[MAJOR] = lib 58 _G[MAJOR] = lib
142 else 142 else
143 editbox:GetParent().button1:Disable() 143 editbox:GetParent().button1:Disable()
144 end 144 end
145 end 145 end
146 local function EditBoxOnEnterPressed_accept (editbox) 146 local function EditBoxOnEnterPressed_accept (editbox)
147 local dialog = editbox:GetParent() 147 if editbox:GetText() == "" then return end
148 StaticPopupDialogs[dialog.which].OnAccept (dialog, dialog.data, dialog.data2) 148 local dialog = editbox:GetParent()
149 dialog:Hide() 149 StaticPopupDialogs[dialog.which].OnAccept (dialog, dialog.data, dialog.data2)
150 dialog:Hide()
150 end 151 end
151 local function OnShow_witheditbox (dialog, data) 152 local function OnShow_witheditbox (dialog, data)
152 local info = StaticPopupDialogs[dialog.which] 153 local info = StaticPopupDialogs[dialog.which]
153 --dialog[info.hasWideEditBox and "wideEditBox" or "editBox"]:SetFocus() 154 --dialog[info.hasWideEditBox and "wideEditBox" or "editBox"]:SetFocus()
154 dialog.editBox:SetFocus() 155 dialog.editBox:SetFocus()