Announcement

Collapse
No announcement yet.

Qwerty keyboard problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ESPsupport
    replied
    Thanks for the simplified example.

    You need to use the address of the array element, not the contents of it.

    This will work

    Code:
        // store address of tbLogin[TB_TEXT] to tbLogin[TB_PTEXT]
        tbLogin[TB_PTEXT] := str_Ptr(&tbLogin[TB_TEXT]);
    
        // insert 12345678 values to tbLogin[TB_TEXT]
        for(i:=0; i<VALUE_LENGTH; i++)
            str_PutByte(tbLogin[TB_PTEXT]++, i+'1');
        next
        str_PutByte(tbLogin[TB_PTEXT]++, 0); // null
    
        // read tbLogin[TB_TEXT]
        print([STR]&tbLogin[TB_TEXT]);
    Also note the change to the first putbyte, you need to put an ASCII number not a binary one.

    Leave a comment:


  • edha
    started a topic Qwerty keyboard problem

    Qwerty keyboard problem

    Hello Sir,

    I create a login window with input from the numeric keyboard or qwerty keyboard.

    When I use the numeric keyboard, login process run normally (start of input of numeric keyboard to search for data in the list).

    But when I tried switch to use the qwerty keyboard, problems began to arise. Input from qwerty keyboard always failed to find data in the list. The search process in the list using the same function, only the difference input of numeric or qwerty keyboard.

    I see the character generated by the qwerty keyboard when the keystrokes, is correct. But I lost the character 7th from tbLogin[TB_TEXT] buffer when I enter the last character (8th character). I don't know cause. What is the solution?


    Code:
    // main function
    func main()
        gfx_Cls();
        gfx_ScreenMode(LANDSCAPE) ;
        touch_Set(TOUCH_ENABLE);
    
        while(!file_Mount())
        wend
    
        numKbHandle := NULL;
        qweKbHandle  := NULL;
        while(!numKbHandle && !qweKbHandle)
            numKbHandle  := file_LoadImageControl("numkb.dat", "numkb.gci", 0);
            qweKbHandle  := file_LoadImageControl("qwekb.dat", "qwekb.gci", 0);
        wend
    
        // init User1 and User2
        isValidAccount    := FALSE;
        accountInit();
    
        // Option 1 (WORKED)
        currentKeyboard := NUMERIC; // Switch between NUMERIC or QWERTY
        /*
            Press 12345678 Enter, output: "Valid account, Login as User1" // read from struct (Write Read on runtime)
            Press 22222222 Enter, output: "Valid account, Login as User2" // read from struct (Write Read on runtime)
            Press 71777554 Enter, output: "Valid account, Login as ADMIN" // read from constant (Read Only on runtime)
        */
    
        // Option 2 (NOT WORKED)                                                                                                                   
        //currentKeyboard := QWERTY; // TROUBLE OCCCURED WHEN THIS LINE UNCOMMENT (currentKeyboard switch to QWERTY)
        /*
        Press 12345678 Enter, output: "Invalid account"
        Press 22222222 Enter, output: "Invalid account"
        Press 71777554 Enter, output: "Invalid account"
        */
    
        isKeyboardVisible := FALSE;
        showKeyboard();
    
        repeat
            if(touch_Get(TOUCH_STATUS)==TOUCH_PRESSED)
                if(isKeyboardVisible==TRUE)
                    readKeyboard();
    
                    if(keyValue==ENTER)
                        if(isValidAccount==TRUE)
                            print("\nValid Account, Login as ", [STR]currentUsername);
                        else
                            print("\nInvalid Account");
                        endif
                    else if(keyValue==BACKSPACE)
                        showKeyboard();  // re initialize keyboard
                    endif
                endif
            endif
        forever
    
    endfunc
    Last edited by edha; 31st July 2015, 11:04 AM.
Working...
X