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