|
|
On-Screen
Keyboard |
|
Once you start using GAPI for graphics you have to re-invent almost
everything which Microsoft make available through normal windows functions
including the soft input panel (SIP). The example project enclosed shows a
simple soft keyboard together with the output of text entered to the
display. |
|
|
The keyboard shown of the left has been simplified by lining up the keys instead of having them staggered. As it was only designed for entry of registration codes this is fine for the job however you can see a full GAPI SIP keyboard on the GapiDraw forum. |
Key presses are recorded using PocketFrog's regular functions and the actual key pressed is determined by taking the x,y of the stylus tap & converting this to a unique number. |
|
A case statement is used to associate the code obtained with a string table entry and this is loaded into a string for on-screen display. I the special case of backspace ( <bk ) a character is removed from the string. The enter key causes a new line. |
|
|
In this demo I use a True Type Font for display but you can also use a bitmap font function instead if you need better performance. |
|
|
To highlight the key pressed I used line drawing and alpha blending to make it look like the key was moving down. I also added a little glowing light on the right of the keyboard each time a key is pressed. |
|
The sample project provided is fully working but was hacked out of a larger program so if you find a line of code which you think has no purpose you are probably correct. I have added some extra comments to assist in following the code Some hard buttons report the button pressed and the down button on the D-Pad exits. |
|
|
|
|
|
|
| disclaimer: This article is the work of Conan of SundialSoft, a user of PocketFrog. I, Conan, have no connection with the toolkit author Thierry Tremblay. I hope this page turns out to be useful & helps people get into this really good toolkit but accept no responsibility for misleading mistakes which waste your valuable time. |