2024年6月11日发(作者:)

简单的MiniGUI软键盘

由于已经购买mGi模块,故而自己写的这个用不着了,留在这里做个记念吧。以下是关键

代码,其实思想蛮简单,就是发送消息给输入法窗口就万事大吉了。但是有个最重要的bug

就是中文输入无法选择所有的汉字,估计要改一下minigui输入法的源码,mGi的软键盘

是利用了两行。示例图如下,很简陋,如果经过美化,可以做到很漂亮。

#include "common.h"

#define ITEM_NUM1 14 /* coolbar */

#define ITEM_NUM2 14 /* coolbar */

#define ITEM_NUM3 12 /* coolbar */

#define ITEM_NUM4 12 /* coolbar */

#define ITEM_NUM5 8 /* coolbar */

#define IDC_NovaSKB1 1001 /* ime */

#define IDC_NovaSKB2 1002 /* ime */

#define IDC_NovaSKB3 1003 /* ime */

#define IDC_NovaSKB4 1004 /* ime */

#define IDC_NovaSKB5 1005 /* ime */

#define HEIGHT_SKB 115 /* 软键盘 */

#define WIDTH_SKB 240 /* 软键盘 */

static const char* caption1[] =

{

" ` ", " 1 ", " 2 ", " 3 ", " 4 ", " 5 "," 6 ", " 7 ", " 8 ",

" 9 ", " 0 ", " - ", " = ", " <- "

};

static const int SCANCODE1[] =

{

SCANCODE_GRAVE, SCANCODE_1, SCANCODE_2, SCANCODE_3,

SCANCODE_4,

SCANCODE_5, SCANCODE_6, SCANCODE_7, SCANCODE_8,

SCANCODE_9,

SCANCODE_0, SCANCODE_MINUS, SCANCODE_EQUAL,

SCANCODE_BACKSPACE

};

static const char* caption2[] =

{

"Tab", " q ", " w ", " e ", " r ", " t "," y ", " u ", " i ",

" o ", " p ", " [ ", " ] ", " "

};

static const int SCANCODE2[] =

{

SCANCODE_TAB, SCANCODE_Q, SCANCODE_W, SCANCODE_E,

SCANCODE_R,

SCANCODE_T, SCANCODE_Y, SCANCODE_U, SCANCODE_I,

SCANCODE_O,

SCANCODE_P, SCANCODE_BRACKET_LEFT,

SCANCODE_BRACKET_RIGHT, SCANCODE_BACKSLASH

};

static const char* caption3[] =

{

"Shift ", " a ", " s ", " d ", " f ", " g "," h ", " j ", "

k ", " l ", " ; ", " ' "

};

static const int SCANCODE3[] =

{

SCANCODE_LEFTSHIFT, SCANCODE_A, SCANCODE_S, SCANCODE_D,

SCANCODE_F,

SCANCODE_G, SCANCODE_H, SCANCODE_J, SCANCODE_K,

SCANCODE_L,

SCANCODE_SEMICOLON, SCANCODE_APOSTROPHE

};

static const char* caption4[] =

{