small bugfix, can now rightclick editboxes to clear the content
This commit is contained in:
+29
-10
@@ -307,6 +307,11 @@ function public.editbox(parent)
|
|||||||
end)
|
end)
|
||||||
editbox:SetScript('OnEnterPressed', function() (this.enter or nop)() end)
|
editbox:SetScript('OnEnterPressed', function() (this.enter or nop)() end)
|
||||||
editbox:SetScript('OnEditFocusGained', function()
|
editbox:SetScript('OnEditFocusGained', function()
|
||||||
|
if this.block_focus then
|
||||||
|
this.block_focus = false
|
||||||
|
this:ClearFocus()
|
||||||
|
return
|
||||||
|
end
|
||||||
this.overlay:Hide()
|
this.overlay:Hide()
|
||||||
this:SetTextColor(color.text.enabled())
|
this:SetTextColor(color.text.enabled())
|
||||||
this.focused = true
|
this.focused = true
|
||||||
@@ -329,16 +334,22 @@ function public.editbox(parent)
|
|||||||
do
|
do
|
||||||
local last_click = T('t', 0)
|
local last_click = T('t', 0)
|
||||||
editbox:SetScript('OnMouseDown', function()
|
editbox:SetScript('OnMouseDown', function()
|
||||||
local x, y = GetCursorPosition()
|
if arg1 == 'RightButton' then
|
||||||
-- local offset = x - editbox:GetLeft()*editbox:GetEffectiveScale() TODO use a fontstring to measure getstringwidth for structural highlighting
|
this:SetText''
|
||||||
-- or use an overlay with itemlinks
|
this:ClearFocus()
|
||||||
if GetTime() - last_click.t < .5 and x == last_click.x and y == last_click.y then
|
this.block_focus = true
|
||||||
thread(function() editbox:HighlightText() end)
|
else
|
||||||
end
|
local x, y = GetCursorPosition()
|
||||||
wipe(last_click)
|
-- local offset = x - editbox:GetLeft()*editbox:GetEffectiveScale() TODO use a fontstring to measure getstringwidth for structural highlighting
|
||||||
last_click.t = GetTime()
|
-- or use an overlay with itemlinks
|
||||||
last_click.x = x
|
if GetTime() - last_click.t < .5 and x == last_click.x and y == last_click.y then
|
||||||
last_click.y = y
|
thread(function() editbox:HighlightText() end)
|
||||||
|
end
|
||||||
|
wipe(last_click)
|
||||||
|
last_click.t = GetTime()
|
||||||
|
last_click.x = x
|
||||||
|
last_click.y = y
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
function editbox:SetAlignment(alignment)
|
function editbox:SetAlignment(alignment)
|
||||||
@@ -547,3 +558,11 @@ function public.checkbox(parent)
|
|||||||
checkbox:GetHighlightTexture'BLEND'
|
checkbox:GetHighlightTexture'BLEND'
|
||||||
return checkbox
|
return checkbox
|
||||||
end
|
end
|
||||||
|
|
||||||
|
do
|
||||||
|
local editbox = CreateFrame'EditBox'
|
||||||
|
function public.clear_focus()
|
||||||
|
editbox:SetFocus()
|
||||||
|
editbox:ClearFocus()
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -87,6 +87,7 @@ function private.update_form()
|
|||||||
for key in temp-S('min_level', 'max_level') do
|
for key in temp-S('min_level', 'max_level') do
|
||||||
if blizzard_query.exact then
|
if blizzard_query.exact then
|
||||||
_M[key .. '_input']:EnableMouse(false)
|
_M[key .. '_input']:EnableMouse(false)
|
||||||
|
_M[key .. '_input']:ClearFocus()
|
||||||
else
|
else
|
||||||
_M[key .. '_input']:EnableMouse(true)
|
_M[key .. '_input']:EnableMouse(true)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ do
|
|||||||
editbox:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
|
editbox:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
|
||||||
editbox:SetWidth(40)
|
editbox:SetWidth(40)
|
||||||
editbox:SetHeight(25)
|
editbox:SetHeight(25)
|
||||||
|
editbox:SetAlignment'CENTER'
|
||||||
editbox:SetNumeric(true)
|
editbox:SetNumeric(true)
|
||||||
editbox:SetScript('OnTabPressed', function() first_page_input:SetFocus() end)
|
editbox:SetScript('OnTabPressed', function() first_page_input:SetFocus() end)
|
||||||
editbox.enter = execute
|
editbox.enter = execute
|
||||||
@@ -124,6 +125,7 @@ do
|
|||||||
editbox:SetPoint('RIGHT', last_page_input, 'LEFT', -5.8, 0)
|
editbox:SetPoint('RIGHT', last_page_input, 'LEFT', -5.8, 0)
|
||||||
editbox:SetWidth(40)
|
editbox:SetWidth(40)
|
||||||
editbox:SetHeight(25)
|
editbox:SetHeight(25)
|
||||||
|
editbox:SetAlignment'CENTER'
|
||||||
editbox:SetNumeric(true)
|
editbox:SetNumeric(true)
|
||||||
editbox:SetScript('OnTabPressed', function() last_page_input:SetFocus() end)
|
editbox:SetScript('OnTabPressed', function() last_page_input:SetFocus() end)
|
||||||
editbox.enter = execute
|
editbox.enter = execute
|
||||||
@@ -289,6 +291,7 @@ do
|
|||||||
local editbox = gui.editbox(frame.filter)
|
local editbox = gui.editbox(frame.filter)
|
||||||
editbox:SetPoint('TOPLEFT', name_input, 'BOTTOMLEFT', 0, -FILTER_SPACING)
|
editbox:SetPoint('TOPLEFT', name_input, 'BOTTOMLEFT', 0, -FILTER_SPACING)
|
||||||
editbox:SetWidth(125)
|
editbox:SetWidth(125)
|
||||||
|
editbox:SetAlignment'CENTER'
|
||||||
editbox:SetNumeric(true)
|
editbox:SetNumeric(true)
|
||||||
editbox:SetScript('OnTabPressed', function()
|
editbox:SetScript('OnTabPressed', function()
|
||||||
if IsShiftKeyDown() then
|
if IsShiftKeyDown() then
|
||||||
@@ -314,6 +317,7 @@ do
|
|||||||
local editbox = gui.editbox(frame.filter)
|
local editbox = gui.editbox(frame.filter)
|
||||||
editbox:SetPoint('TOPLEFT', min_level_input, 'TOPRIGHT', 10, 0)
|
editbox:SetPoint('TOPLEFT', min_level_input, 'TOPRIGHT', 10, 0)
|
||||||
editbox:SetWidth(125)
|
editbox:SetWidth(125)
|
||||||
|
editbox:SetAlignment'CENTER'
|
||||||
editbox:SetNumeric(true)
|
editbox:SetNumeric(true)
|
||||||
editbox:SetScript('OnTabPressed', function()
|
editbox:SetScript('OnTabPressed', function()
|
||||||
if IsShiftKeyDown() then
|
if IsShiftKeyDown() then
|
||||||
|
|||||||
@@ -305,8 +305,6 @@ function public.execute(resume, real_time)
|
|||||||
new_search(filter_string, first_page, last_page)
|
new_search(filter_string, first_page, last_page)
|
||||||
else
|
else
|
||||||
current_search.filter_string = filter_string
|
current_search.filter_string = filter_string
|
||||||
current_search.first_page = first_page
|
|
||||||
current_search.last_page = last_page
|
|
||||||
end
|
end
|
||||||
new_recent_search(filter_string, join(map(copy(queries), function(filter) return filter.prettified end), ';'))
|
new_recent_search(filter_string, join(map(copy(queries), function(filter) return filter.prettified end), ';'))
|
||||||
else
|
else
|
||||||
@@ -316,6 +314,8 @@ function public.execute(resume, real_time)
|
|||||||
current_search.table:Reset()
|
current_search.table:Reset()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
current_search.first_page = first_page
|
||||||
|
current_search.last_page = last_page
|
||||||
current_search.real_time = real_time_button:GetChecked()
|
current_search.real_time = real_time_button:GetChecked()
|
||||||
current_search.auto_buy_validator = auto_buy_validator
|
current_search.auto_buy_validator = auto_buy_validator
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user