1
0
mirror of https://github.com/kepler155c/opus synced 2026-02-26 19:59:43 +00:00
This commit is contained in:
kepler155c@gmail.com
2017-04-05 12:35:03 -04:00
parent 72bd16502b
commit 6754eb98d3
3 changed files with 33 additions and 15 deletions

View File

@@ -338,28 +338,32 @@ end
local function nameDialog(f)
local dialog = UI.Dialog({
x = (UI.term.width - 28) / 2,
width = 28,
textEntry = UI.TextEntry({ x = 4, y = 3, width = 20, limit = 20 })
-- x = (UI.term.width - 28) / 2,
width = 22,
title = 'Enter Name',
form = UI.Form {
x = 2, rex = -2, y = 2,
textEntry = UI.TextEntry({ y = 3, width = 20, limit = 20 })
},
})
dialog.titleBar.title = 'Enter Name'
dialog.eventHandler = function(self, event)
if event.type == 'accept' then
local name = self.textEntry.value
if event.type == 'form_complete' then
local name = self.form.textEntry.value
if name then
f(name)
else
self.statusBar:timedStatus('Invalid Name', 3)
end
return true
elseif event.type == 'form_cancel' or event.type == 'cancel' then
UI:setPreviousPage()
else
return UI.Dialog.eventHandler(self, event)
end
return UI.Dialog.eventHandler(self, event)
end
dialog:setFocus(dialog.textEntry)
dialog:setFocus(dialog.form.textEntry)
UI:setPage(dialog)
end