Does some sort of text box/field exists? I cannot find it in the docs. Where is it in the docs? How do I use it?
@Zacharyl123
There isn’t a predefined input text box/field. You have to create your own using rect, text, keyboard, etc. Here is a simple program to give you an example.
function setup()
displayMode(FULLSCREEN)
str = ""
bcolor= 0
x=300
y=500
w=200
h=50
l=x-w/2
r=x+w/2
b=y-h/2
t=y+h/2
end
function draw()
background(30,30,0,255)
strokeWidth(6)
rectMode(CENTER)
textMode(CENTER)
fill(255)
text("Tap button then input data",x,700)
text("Press RETURN to show input",x,650)
text("Enter value",x,550)
if bcolor == 0 then
fill(255, 0, 0, 255)
else
fill(128,0,0,255)
end
rect(x,y,w,h) -- input area
fill(255)
if keyboardBuffer() ~= nil then
text(keyboardBuffer(),x,500) -- show data as it is keyed
else
text(str,x,500) -- show data in input area
end
text(str,x,450) -- also shows data below input area
end
function touched()
-- check if input area was touched
if CurrentTouch.x > l and CurrentTouch.x < r then
if CurrentTouch.y > b and CurrentTouch.y < t then
showKeyboard()
bcolor = 1
end
end
end
function keyboard(key)
-- move keyboardBuffer to str when return is pressed
if key == RETURN then
str = keyboardBuffer() -- str holds input data
hideKeyboard()
bcolor = 0
end
end
@Zacharyl123
I suppose that you are new to Codea programming, and as a beginner I had the same reflexions about textbox, buttons, sliders, …
So I suggest to you to search on the forum the term CIDER and you will find a lot of what you are looking for. It’s a fantastic program very helpfull, thanks to @Mark and to the whole forum members who are improving this program by their suggestions. And I suggest by the way to @Mark to add on the main interface a grid so we can align controls as precisely as possible and we afford efforts on aligning them.