Skip to main content

Another Virtual Keyboard question

1 reply [Last post]
myinstinct
Offline
Joined: 2008-10-24

so I'm building another limited keyboard for valid filename characters and ran into an issue that I don't know how to solve.

I wanted no SPACE char - only UPPER/lower case letters, numbers and few symbols, so created

<br />
    public static final String[][] FILENAME_QWERTY = new String[][]{<br />
        {"q", "w", "e", "r", "t", "y", "u", "i", "o", "p"},<br />
        {"a", "s", "d", "f", "g", "h", "j", "k", "l"},<br />
        {"$Shift$", "z", "x", "c", "v", "b", "n", "m"},<br />
        {"$Mode$", "$Delete$", "$OK$"}<br />
    };<br />
    /**<br />
     * This keymap represents numbers keyboard<br />
     */<br />
    public static final String[][] FILENAME_NUMBERS = new String[][]{<br />
        {"1", "2", "3",},<br />
        {"4", "5", "6",},<br />
        {"7", "8", "9",},<br />
        {"_", "0", "-",},<br />
        {"$Mode$", "$Delete$", "$OK$"}<br />
    };<br />

and created the VKB

<br />
            VirtualKeyboard vkb = new VirtualKeyboard();<br />
            vkb.addInputMode("aBc", FILENAME_QWERTY );<br />
            vkb.addInputMode("-123", FILENAME_NUMBERS );<br />
            vkb.setInputModeOrder(new String[]{"aBc", "-123"});<br />
            VirtualKeyboard.bindVirtualKeyboard(nf, vkb);<br />

I had a problem when I used "ABC" for the InputMode which caused the DEFAULT_QWERTY to be used, so I changed mine to "aBc"

But I can't SHIFT to UPPER case using "aBc" - the code for SHIFT requires "ABC"

<br />
            case SHIFT:<br />
                if (currentMode.equals(QWERTY_MODE)) {<br />
                    upperCase = !upperCase;<br />
                    Display.getInstance().callSerially(new Runnable() {</p>
<p>                        public void run() {<br />
                            initInputButtons(upperCase);<br />
                            revalidate();<br />
                        }<br />
                    });<br />
                }<br />
                return;<br />

Does anyone see a good way to do this without changing the LWUIT source?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
myinstinct
Offline
Joined: 2008-10-24

nevermind - I solved it by removing the $SHIFT$ key and adding a third InputMode

[code]
vkb.addInputMode("abcd", FILENAME_QWERTY_LOWER );
vkb.addInputMode("ABCD", FILENAME_QWERTY_UPPER );
vkb.addInputMode("-123", FILENAME_NUMBERS );
[/code]