Commit 8e9466c8 authored by nevcairiel's avatar nevcairiel
Browse files

AceGUI-3.0: Implement focus handling for the multiline editbox as well (and...

AceGUI-3.0: Implement focus handling for the multiline editbox as well (and fix a small glitch in the editbox)

git-svn-id: https://repos.wowace.com/wow/ace3/trunk@989 5debad98-a965-4143-8383-f471b3509dcf
parent 404ae58a
......@@ -60,8 +60,8 @@ local function Control_OnLeave(frame)
end
local function Frame_OnShowFocus(frame)
self.obj.editbox:SetFocus()
self:SetScript("OnShow", nil)
frame.obj.editbox:SetFocus()
frame:SetScript("OnShow", nil)
end
local function EditBox_OnEscapePressed(frame)
......@@ -130,7 +130,7 @@ local methods = {
end,
["OnRelease"] = function(self)
self.frame:SetScript("OnShow", nil)
self:ClearFocus()
end,
["SetDisabled"] = function(self, disabled)
......@@ -195,7 +195,7 @@ local methods = {
if not self.frame:IsShown() then
self.frame:SetScript("OnShow", Frame_OnShowFocus)
end
end,
end
}
--[[-----------------------------------------------------------------------------
......
local Type, Version = "MultiLineEditBox", 24
local Type, Version = "MultiLineEditBox", 25
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
......@@ -127,6 +127,15 @@ local function OnVerticalScroll(self, offset)
editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight())
end
local function OnShowFocus(frame)
frame.obj.editBox:SetFocus()
frame:SetScript("OnShow", nil)
end
local function OnFocusGained(frame)
AceGUI:SetFocus(frame.obj)
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
......@@ -141,7 +150,9 @@ local methods = {
self:SetMaxLetters(0)
end,
-- ["OnRelease"] = nil,
["OnRelease"] = function(self)
self:ClearFocus()
end,
["SetDisabled"] = function(self, disabled)
local editBox = self.editBox
......@@ -202,6 +213,18 @@ local methods = {
self.button:Show()
end
Layout(self)
end,
["ClearFocus"] = function(self)
self.editBox:ClearFocus()
self.frame:SetScript("OnShow", nil)
end,
["SetFocus"] = function(self)
self.editBox:SetFocus()
if not self.frame:IsShown() then
self.frame:SetScript("OnShow", OnShowFocus)
end
end
}
......@@ -282,6 +305,8 @@ local function Constructor()
editBox:SetScript("OnReceiveDrag", OnReceiveDrag)
editBox:SetScript("OnTextChanged", OnTextChanged)
editBox:SetScript("OnTextSet", OnTextSet)
editBox:SetScript("OnEditFocusGained", OnFocusGained)
scrollFrame:SetScrollChild(editBox)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment