Numeric Keyboard

Is there a way to have ShowKeyboard() display the numeric keyboard?

thanks

@DaveW Not at this time. I requested an option to display the numeric or alpha keyboard a long time ago. Nothing yet.

@dave1701. Thanks for the reply. This would be nice for a multiplication app I’m working on for Elementary students. They have to change the keyboard every time a new problem is presented.

I know. It’s irritating having to constantly select the numeric keyboard if you move around. One solution for you would be to create your own keyboard with just the keys you need. That wouldn’t be hard at all.

@dave1707. Great Idea! That would be simpler for the students. Thanks.

@DaveW Here’s a simple keyboard I had. You can modify it for your needs.

function setup()
    rectMode(CENTER)
    xx=100
    yy=300
    num={}
    table.insert(num,numKeys(xx,yy,1))
    table.insert(num,numKeys(xx+70,yy,2))
    table.insert(num,numKeys(xx+140,yy,3))
    table.insert(num,numKeys(xx,yy-50,4))
    table.insert(num,numKeys(xx+70,yy-50,5))
    table.insert(num,numKeys(xx+140,yy-50,6))
    table.insert(num,numKeys(xx,yy-100,7))
    table.insert(num,numKeys(xx+70,yy-100,8))
    table.insert(num,numKeys(xx+140,yy-100,9))
    table.insert(num,numKeys(xx+70,yy-150,0))    
end

function draw()
    background(40, 40, 50)
    for a,b in pairs(num) do
        b:draw()
    end
end

function touched(t)
    for a,b in pairs(num) do
        b:touched(t)
    end
end

numKeys=class()

function numKeys:init(x,y,n)
    self.x=x
    self.y=y
    self.n=n
end

function numKeys:draw()
    fill(255)
    rect(self.x,self.y,60,40)
    fill(255,0,0)
    text(self.n,self.x,self.y)   
end

function numKeys:touched(t)
    if t.state==ENDED then
        if t.x>self.x-30 and t.x<self.x+30 and t.y>self.y-20 and t.y<self.y+20 then
            keyPressed=self.n
            print(keyPressed)
        end
    end
end

@dave1707. Thanks. This will be good for me to study as I’m doing a lot of repetitive code for setting up buttons and checking touched.