editbox refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-05-01 18:34:20 +02:00
parent 77b887a7ca
commit 8436988ae7
3 changed files with 17 additions and 68 deletions
-44
View File
@@ -257,26 +257,6 @@ function public.on_load()
this:ClearFocus()
public.start_search()
end)
editbox:SetScript('OnEscapePressed', function()
this:HighlightText(0, 0)
this:ClearFocus()
end)
editbox:SetScript('OnEditFocusGained', function()
this:HighlightText()
end)
do
local last_time, last_x, last_y
editbox:SetScript('OnMouseUp', function()
local x, y = GetCursorPosition()
if last_time and last_time > GetTime() - .5 and abs(x - last_x) < 10 and abs(y - last_y) < 10 then
this:HighlightText()
last_time = nil
else
last_time = GetTime()
last_x, last_y = GetCursorPosition()
end
end)
end
editbox:SetScript('OnReceiveDrag', function()
local item_info = Aux.cursor_item() and Aux.info.item(Aux.cursor_item().item_id)
if item_info then
@@ -425,12 +405,6 @@ function public.on_load()
this:ClearFocus()
public.start_search()
end)
editbox:SetScript('OnEscapePressed', function()
this:ClearFocus()
end)
editbox:SetScript('OnEditFocusGained', function()
this:HighlightText()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Name')
@@ -462,12 +436,6 @@ function public.on_load()
this:ClearFocus()
public.start_search()
end)
editbox:SetScript('OnEscapePressed', function()
this:ClearFocus()
end)
editbox:SetScript('OnEditFocusGained', function()
this:HighlightText()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Level Range')
@@ -489,12 +457,6 @@ function public.on_load()
this:ClearFocus()
public.start_search()
end)
editbox:SetScript('OnEscapePressed', function()
this:ClearFocus()
end)
editbox:SetScript('OnEditFocusGained', function()
this:HighlightText()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
label:SetText('-')
@@ -729,12 +691,6 @@ function public.on_load()
editbox:SetScript('OnEnterPressed', function()
on_click()
end)
editbox:SetScript('OnEscapePressed', function()
this:ClearFocus()
end)
editbox:SetScript('OnEditFocusGained', function()
this:HighlightText()
end)
tinsert(btn.inputs, editbox)
end
end