ketai keyboard does not work

edited May 2017 in Android Mode

hello! I'm using the ketai library to call the keyboard on android device. With this keyboard the system variable "key" work fine to get all the letters key and numbers but the ENTER or DELETE key doesn't work. This problem is apparently very old because this post of 2015 talk about this problem too but haven't answer for this. So is there any solution to solve this problem? Thanks you by advance :)

Answers

  • In what event are you catching these keys? in void keyPressed(){}? If you provide some code, I can see if I can reproduce it. Also you can comment in that github ticket and see what is the status, if it was already fixed.

    Kf

  • edited May 2017

    I've tried with a simple code like this one :

    import ketai.ui.*;
    
    void setup(){
      textSize(50);
      background(0);
    }
    void draw(){
    
    }
    void keyPressed(){
      background(0);
      if(keyCode==BACKSPACE) text("backspace",width/2,height/2);
      if(keyCode==ENTER) text("enter",width/2,height/2);
      if(keyCode==DELETE) text("delete",width/2,height/2);
    }
    void mousePressed(){
      KetaiKeyboard.toggle(this);
    }
    
  • Did you check the example provided in the ketai.org website? Check under the UI section. Are you able to run that example in your device?

    Kf

  • Yes I've tried the ketai UI example : the letters keys are well detect but the space key isn't never detect.

  • Yes, so it seems the codes provided by Processing do not much the ones output by ketai. I have modified your code to keep track of the last 3 codes detected by the system. I keep track of both key and keyCode values and tehy are presented in hex format.

    In my example, the symbols # and ! triggered the ENTER's and BACKSPACE's alert dialog. However, some random key combination could trigger them as well.

    So my advised, check the android library to see if they provide access to certain keyboards through the android API.

    Notice that to toggle the keyboard, you have to hit the top part of the screen.

    Kf

    import ketai.ui.*;
    
    String specialMsg="000";
    String in="000";
    
    
    void setup() {
      fullScreen();
      orientation(PORTRAIT);
      textSize(50);
      textAlign(CENTER, CENTER);
    }
    void draw() {
      background(0);
      stroke(185, 0, 20);
      line(0, height/4, width, height/4);
      fill(250, 0, 20);
      text("Toggle Keyboard", width/2, height/8);
      fill(255);
    
      text("KeyCode stream:\n"+hex(specialMsg.charAt(0), 2)+" "+hex(specialMsg.charAt(1), 2)+" "+hex(specialMsg.charAt(2), 2), width/2, height/4);
      text("Key stream:\n"+hex(in.charAt(0), 2)+" "+hex(in.charAt(1), 2)+" "+hex(in.charAt(2), 2), width/2, height/2);
    }
    void keyPressed() {
    
    
      in+=key;
      in=in.substring(1); //Take last 3 chars
    
      specialMsg+=keyCode;
      specialMsg=specialMsg.substring(1);//Take last 3 chars
    
      if (keyCode==BACKSPACE) KetaiAlertDialog.popup(this, "Pop Up!", "BACKSPACE");// This char triggers this alert:  !
      if (keyCode==ENTER) KetaiAlertDialog.popup(this, "Pop Up!", "ENTER");  // This char triggers this alert: #
      if (keyCode==DELETE) KetaiAlertDialog.popup(this, "Pop Up!", "DELETE");// This char triggers this alert: char not found
    }
    void mousePressed() {
    
      //Only toggle if hitting the top of the screen
      if (mouseY<height/4)  
        KetaiKeyboard.toggle(this);
    }
    
  • edited May 2017

    Thanks you @kfrajer but this isn't work too. I will check the on the developer.android site to get more information.*

    Ps : With my code I saw that the BACKSPACE key is detect by the key "1" and the ENTER key is detect by the "3" key.

Sign In or Register to comment.