From f3974627bddb9f62132bf54bde3a66c87dbf7b23 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sun, 15 Sep 2019 18:28:55 -0300 Subject: Add lastInput function to forms --- ui/form/Form.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ui/form/Form.js b/ui/form/Form.js index 74a1065..451baa4 100644 --- a/ui/form/Form.js +++ b/ui/form/Form.js @@ -117,6 +117,21 @@ module.exports = class Form extends FocusElement { } } + lastInput(selectForm = true) { + this.curIndex = this.inputs.length - 1 + + // TODO: See previousInput + if (!this.inputs[this.curIndex].selectable) { + this.previousInput() + } + + if (selectForm || ( + this.root.isChildOrSelfSelected && this.root.isChildOrSelfSelected(this) + )) { + this.updateSelectedElement() + } + } + selected() { if (this.root.selectedElement === this) { this.updateSelectedElement() -- cgit 1.3.0-6-gf8a5