summary refs log blame commit diff stats
path: root/doc/pydoc/ranger.gui.curses_shortcuts.html
blob: 724177b31ccc283e609205fa0ac158bbf4e7ee2d (plain) (tree)
.input = self.input .. upper[self.letterIndex + 10] end elseif self.rowIndex == 3 then if self.lower then self.input = self.input .. chars[self.letterIndex + 20] else self.input = self.input .. upper[self.letterIndex + 20] end elseif self.rowIndex == 4 then if self.letterIndex == row4CharCount then if string.len(self.input) > 0 then self.input = self.input:sub(1, -2) end else if self.lower then self.input = self.input .. chars[self.letterIndex + 29] else self.input = self.input .. upper[self.letterIndex + 29] end end elseif self.rowIndex == 5 then if self.letterIndex == 1 then self.input = self.input .. " " elseif self.letterIndex == 2 then self:pop() return end end print("Input: " .. self.input) if string.len(self.input) > 0 then local inputImage = gfx.imageWithText(self.input, 400, 100) self.inputSprite:setImage(inputImage) self.inputSprite:add() else self.inputSprite:remove() end end, BButtonUp = function() end, AButtonUp = function() self.focusSprite:moveBy(0, -1) self.spacebarSprite:moveBy(0, -1) self.deleteSprite:moveBy(0, -1) end } playdate.inputHandlers.push(self.inputHandler) self.showing = true end function TextInputScreen:updateFocusCaret() if self.rowIndex == 1 then self.focusSprite:moveTo(xCoords[self.letterIndex], yCoords[self.rowIndex] + (focusHeight/2) - 5) self.focusSprite:add() self.spacebarSprite:remove() self.deleteSprite:remove() elseif self.rowIndex == 2 then self.focusSprite:moveTo(xCoords[self.letterIndex + 10], yCoords[self.rowIndex] + (focusHeight/2) - 5) self.focusSprite:add() self.spacebarSprite:remove() self.deleteSprite:remove() elseif self.rowIndex == 3 then self.focusSprite:moveTo(xCoords[self.letterIndex + 20], yCoords[self.rowIndex] + (focusHeight/2) - 5) self.focusSprite:add() self.spacebarSprite:remove() self.deleteSprite:remove() elseif self.rowIndex == 4 then if self.letterIndex == row4CharCount then --delete self.focusSprite:remove() self.spacebarSprite:remove() self.deleteSprite:add() else self.focusSprite:moveTo(xCoords[self.letterIndex + 29], yCoords[self.rowIndex] + (focusHeight/2) - 5) self.focusSprite:add() self.spacebarSprite:remove() self.deleteSprite:remove() end self.doneSprite:remove() elseif self.rowIndex == 5 then self.focusSprite:remove() self.deleteSprite:remove() if self.letterIndex == 1 then self.spacebarSprite:add() self.doneSprite:remove() elseif self.letterIndex == 2 then self.spacebarSprite:remove() self.doneSprite:add() end else print("Invalid row index: " .. self.rowIndex) end end function TextInputScreen:pop() self.isShowing = false gfx.setFont(self.defaultFont) self.focusSprite:remove() self.spacebarSprite:remove() self.deleteSprite:remove() self.doneSprite:remove() self.inputSprite:remove() self.focusSprite = nil self.spacebarSprite = nil self.deleteSprite = nil self.doneSprite = nil self.inputSprite = nil if self.messageSprite ~= nil then self.messageSprite:remove() self.messageSprite = nil end self:remove() playdate.inputHandlers.pop() if self.onDone ~= nil then self.onDone(self.input) end end