Example of using the MGI soft keyboard in the MiniGUI input method module

Source: Internet
Author: User

MGI is an input method component provided by the Apsara stack software. It currently provides a soft keyboard input method and a handwritten Input Method Framework, and provides you with a container for managing input methods, you can also add custom input methods. In addition, for the soft keyboard input method, you can customize the displayed keyboard bitmap, and add different input translation methods (built-in Chinese Pinyin input method ).

MGI is now open-source with MiniGUI 3.0.12. You can download it at http://www.minigui.org/downloads/index.html.

The following is the test instance code. MGI uses the default configure configuration. If -- enable-mgdesktop-version is used, pay attention to manually showwindow.

# Include <stdio. h> # include <stdlib. h> # include <MiniGUI/Common. h> # include <MiniGUI/MiniGUI. h> # include <MiniGUI/GDI. h> # include <MiniGUI/window. h> # include <MiniGUI/control. h> # include <MGI/MGI. h> # define idc_base 20000 # ifndef idc_static # define idc_static 21000 # endif # define handler 21100 hwnd g_himewnd = 0ul; static dlgtemplate handler = {ws_border | ws_caption, ws_ex_none, 200,225,400,180, "ping", 0, 91,100, null, 0}; static ctrldata s_dlgctrl_dlgping [] = {"button", ws_visible | ws_tabstop, 47, 28, idok, "OK", 0 },{ "button", ws_visible | ws_tabstop, 217, 91,100, 28, idcancel, "cancel", 0 },{ "sledit ", ws_visible | ws_tabstop | ws_border, 127, 40,199, 30, idc_edt_addr, "", 0 },{ "static", ws_visible | ws_tabstop, 42, 42, 70, 34, idc_static, "ip address", 0 },}; static hwnd success; static bool g_ime_opened = false; static void edit_assist_proc (hwnd hdlg, int ID, int NC, DWORD add_data) {ime_target_info ime_t_info; // In the message processing function of the Edit Control, print the caret location getimetargetinfo (& ime_t_info); printf ("ime_t_info.ptcaret: (% d, % d) \ n", ime_t_info.ptcaret.x, listener);} void policy_ime_status (bool opened) {g_ime_opened = opened;} static int handle (hwnd hdlg, int message, wparam, lparam) {Switch (Message) {Case msg_initdialog: g_himewnd = hdlg; seticationicationcallback (getdlgitem (hdlg, callback), edit_notif_proc); response = Response (callback); setfocuschild (getdlgitem (hdlg, callback )); // setimestatus (ime_status_autotrack, true); setimestatus (success, ime_encoding_local); setimestatus (success, true); return 1; Case msg_close: enddialog (hdlg, idcancel); break ;} return defaultdialogproc (hdlg, message, wparam, lparam);} int miniguimain (INT ARGs, const char * Arg []) {Signature = s_dlgctrl_dlgping; Signature ("skin "); dialogboxindirectparam (& s_dlgbox_dlgping, hwnd_desktop, dialogbox_dlgping_proc, 0); Return 0 ;}

Makefile

CC=gccLD=gccCFLAGS=-I/usr/local/includeLDFLAGS=-L/usr/local/lib/ -lminigui_ths -lmgi -lpng -lpthread -ldl -lfreetype -ljpegTARGET=lcdall: lcd.c.o:    $(CC) $(CFLAGS) -c $^ -o $@$(TARGET): skb_test.o    $(LD) $(LDFLAGS) $^ -o $@clean:    rm -f $(TARGET) *.o

The following is the display:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.