diff ui/AmrUiTextarea.lua @ 61:cf2b6b9a8337 v23

6.2 update, shopping list bug fixes, ui scale option
author yellowfive
date Tue, 23 Jun 2015 00:27:21 -0700
parents 01b63b8ed811
children 0515882856f1
line wrap: on
line diff
--- a/ui/AmrUiTextarea.lua	Sun Jun 07 15:20:25 2015 -0700
+++ b/ui/AmrUiTextarea.lua	Tue Jun 23 00:27:21 2015 -0700
@@ -60,6 +60,10 @@
 	self:Fire("OnTextSet", self.editbox:GetText())
 end
 
+local function editboxEnterPressed(self)
+	self.obj:Fire("OnEnterPressed")
+end
+
 -- works for both the scrollframe and the editbox, handles e.g. dragging a spell link into the textarea
 local function onReceiveDrag(self)
 	local type, id, info = GetCursorInfo()
@@ -86,6 +90,7 @@
 		-- restore default values
 		self:SetWidth(200)
 		self:SetHeight(24)
+		self:SetMultiLine(true)
 		self:SetFont(Amr.CreateFont("Regular", 16, Amr.Colors.Text))
 		self:SetText("")
 		self.frame:ClearAllPoints()
@@ -122,8 +127,13 @@
 	
 	["ClearFocus"] = function(self)
 		self.editbox:ClearFocus()
+		self.editbox:HighlightText(0, 0)
 		self.frame:SetScript("OnShow", nil)
 	end,
+	
+	["SetMultiLine"] = function(self, multi)
+		self.editbox:SetMultiLine(multi)
+	end,
 
 	["SetFocus"] = function(self, highlight)
 		self.editbox:SetFocus()
@@ -167,6 +177,7 @@
 	
 	editbox:SetScript("OnCursorChanged", editboxCursorChanged)
 	editbox:SetScript("OnEscapePressed", editbox.ClearFocus)
+	editbox:SetScript("OnEnterPressed", editboxEnterPressed)
 	editbox:SetScript("OnEditFocusLost", editboxEditFocusLost)
 	editbox:SetScript("OnTextChanged", editboxTextChanged)
 	editbox:SetScript("OnTextSet", editboxTextSet)