diff --git a/Basalt/objects/Input.lua b/Basalt/objects/Input.lua index 654481c..32e2e99 100644 --- a/Basalt/objects/Input.lua +++ b/Basalt/objects/Input.lua @@ -332,6 +332,9 @@ return function(name) self.parent:writeText(obx, oby + (n - 1), text, bCol, fCol) end end + if(self:isFocused())then + self.parent:setCursor(true, obx + textX - wIndex, oby+math.max(math.ceil(self:getHeight()/2-1, 1)), self.fgColor) + end end end end, diff --git a/Basalt/objects/Textfield.lua b/Basalt/objects/Textfield.lua index c9c59ba..2516e01 100644 --- a/Basalt/objects/Textfield.lua +++ b/Basalt/objects/Textfield.lua @@ -596,6 +596,10 @@ return function(name) self.parent:setBG(obx, oby + n - 1, bg) self.parent:setFG(obx, oby + n - 1, fg) end + if(self:isFocused())then + local anchx, anchy = self:getAnchorPosition() + self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex, self.fgColor) + end end end end, diff --git a/examples/basaltPreview.lua b/examples/basaltPreview.lua index 5646d46..1018e8d 100644 --- a/examples/basaltPreview.lua +++ b/examples/basaltPreview.lua @@ -1,17 +1,17 @@ --Basalt configurated installer -local filePath = "basalt.lua" --here you can change the file path default: basalt.lua +local filePath = "basalt.lua" --here you can change the file path default: basalt if not(fs.exists(filePath))then shell.run("pastebin run ESs1mg7P packed true "..filePath:gsub(".lua", "")) -- this is an alternative to the wget command end -local basalt = require(filePath:gsub(".lua", "")) -- here you can change the variablename in any variablename you want default: basalt +local basalt = require(filePath:gsub(".lua", "")) local w, h = term.getSize() -local main = basalt.createFrame("mainFrame"):show() -local objFrame = main:addFrame("objectFrame"):setPosition(1,2):setBackground(colors.lightGray):setSize(w, h-1):show() -local programFrame = main:addFrame("programFrame"):setPosition(1,2):setBackground(colors.lightGray):setSize(w, h-1) -local editorFrame = main:addFrame("editorFrame"):setPosition(1,2):setBackground(colors.lightGray):setSize(w, h-1) +local main = basalt.createFrame("mainFrame") +local objFrame = main:addFrame("objectFrame"):setPosition(1,2):setBackground(colors.lightGray):setSize(w, h-1) +local programFrame = main:addFrame("programFrame"):setPosition(1,2):setBackground(colors.lightGray):setSize(w, h-1):hide() +local editorFrame = main:addFrame("editorFrame"):setPosition(1,2):setBackground(colors.lightGray):setSize(w, h-1):hide() local menuBar = main:addMenubar("mainMenuBar"):addItem("Object"):addItem("Program"):addItem("Editor"):setBackground(colors.gray):setSize(w, 1):setSpace(5):setScrollable():show() menuBar:onChange(function(self) @@ -67,7 +67,7 @@ end):start() --Program Frame: local programCount = 1 visualButton(programFrame:addButton("exampleButton"):setText("Add Shell"):setSize(13,3):setPosition(2,2):onClick(function() - local newProgramWindow = programFrame:addFrame("programFrame"..programCount):setMoveable(true):setBar("Console", colors.black, colors.lightGray):showBar():setPosition(3,3):setSize(26,12):show() + local newProgramWindow = programFrame:addFrame("programFrame"..programCount):setMovable(true):setBar("Console", colors.black, colors.lightGray):showBar():setPosition(3,3):setSize(26,12):show() local program = newProgramWindow:addProgram("exampleProgram"..programCount):setSize(26,11):setPosition(1,2):setBackground(colors.black):show() program:execute("rom/programs/shell.lua") programCount = programCount + 1 diff --git a/examples/basaltPreview2.lua b/examples/basaltPreview2.lua index 5f3da3f..c3b0220 100644 --- a/examples/basaltPreview2.lua +++ b/examples/basaltPreview2.lua @@ -1,4 +1,9 @@ -local basalt = require("Basalt") +--Basalt configurated installer +local filePath = "basalt.lua" --here you can change the file path default: basalt +if not(fs.exists(filePath))then + shell.run("pastebin run ESs1mg7P packed true "..filePath:gsub(".lua", "")) -- this is an alternative to the wget command +end +local basalt = require(filePath:gsub(".lua", "")) basalt.setVariable("buttonColor", basalt.schedule(function(self) self:setBackground(colors.black) diff --git a/examples/basaltPreview2.xml b/examples/basaltPreview2.xml index f544727..bbcbdfe 100644 --- a/examples/basaltPreview2.xml +++ b/examples/basaltPreview2.xml @@ -1,9 +1,9 @@ - -