key board

How do you make a pop up keyboard

Try searching for keyboard in the search box above

@Ray_Spahn Do you mean how to make your very own keyboard, or how to make the Codea keyboard show/hide.

@dave1707how to make your very own keyboard

@Ray_Spahn Here’s something I threw together, maybe this will help.


displayMode(FULLSCREEN)

function setup()
    k1=keybrd(100,300)    
end

function draw()
    background(40, 40, 50)
    fill(255)
    k1:draw()
end

function touched(t)
    k1:touched(t)
end

keybrd=class()

function keybrd:init(x,y)
    self.caps=false
    self.size=50
    self.x=x
    self.y=y
    self.tx=0
    self.ty=0
    self.key=""
    self.keys={{" ZXCVBNM,. "},{"ASDFGHJKL  "},{"QWERTYUIOP "},{"1234567890 "}}  
end

function keybrd:draw()
    for y=1,4 do
        for x=1,string.len(self.keys[y][1]) do
            fill(255)
            rect(self.x+x*self.size,self.y+y*self.size,self.size,self.size)
            fill(0)
            text(string.sub(self.keys[y][1],x,x),
                    self.x+x*self.size+self.size/2,self.y+y*self.size+self.size/2)
            if y==2 and x==10 then  -- return
                text("retn",self.x+x*self.size+self.size/2,self.y+y*self.size+self.size/2)
            end
            if y==2 and x==11 then  -- space
                text("space",self.x+x*self.size+self.size/2,self.y+y*self.size+self.size/2)
            end
            if y==3 and x==11 then  -- back space
                text("back\
space",self.x+x*self.size+self.size/2,self.y+y*self.size+self.size/2)
            end
            if y==1 and (x==1 or x==11) then    -- caps
                if self.caps then
                    text("caps\
 on",self.x+x*self.size+self.size/2,self.y+y*self.size+self.size/2)
                else
                    text("caps\
off",self.x+x*self.size+self.size/2,self.y+y*self.size+self.size/2)
                end
            end
        end
    end
    fill(255)
    text(self.key,self.x+250,self.y+300) 
end

function keybrd:touched(t)
    if t.state==ENDED then
        self.tx=math.floor((t.x-self.x)/self.size)
        self.ty=math.floor((t.y-self.y)/self.size)
        if self.tx<1 or self.tx>11 or self.ty<1 or self.ty>4 then
            return
        end
        if self.ty==1 and (self.tx==1 or self.tx==11) then    -- capital key
            self.caps = not self.caps
            return
        end
        if self.ty==2 and self.tx==10 then  -- return key
            self.key=""
            return
        end
        if self.ty==3 and self.tx==11 then  -- backspace key
            self.key=string.sub(self.key,1,string.len(self.key)-1)
            return
        end
        if self.caps then
            self.key=self.key..string.sub(self.keys[self.ty][1],self.tx,self.tx)
        else
            print(self.tx,self.ty)
            self.key=self.key..
                string.lower(string.sub(self.keys[self.ty][1],self.tx,self.tx))
        end
    end
end

@dave1707 thank you sooooo much this is very helpful, and creative