Implement automatic spelling and matching suggestions on Windows Mobile

Source: Internet
Author: User
Keywords nbsp Contacts suggestions we as follows
Tags automatic code direct entering find function information list

Friends with Windows Mobile phones should have an understanding that to find a contact, in the process of entering the target contact name, the system will be filtered in real time according to the input, rendering in the list for the user to choose. Similarly, if we want to make a direct call, in the process of entering the phone number, the system will also be in real time to compare the input number and contact library, the matching contact is displayed in the list for the user to choose.

You should not underestimate this function, in fact, in the device small, need to spend a lot of effort to deal with input and output of embedded devices, user experience of the UI is critical. In my opinion, this automatic spelling advice is very useful, at least at present many software (such as various types of input methods, etc.) have this function. So how do you implement this functionality? How do I add this feature to my application? We have seen Christec two blog post (these two blog links I put in the end of the article), it should be very clear.

First, what we need to know is the Shsetinputcontext function. In order to be used in a managed environment, we need to invoke the code as follows:

Code
Using System.Runtime.InteropServices;

Private Enum Shic_feature:uint
{
Restoredefault = 0,

AutoCorrect = 1,

AutoSuggest = 2,

Havetrailer = 3,

CLASS = 4
};


[DllImport ("Aygshell.dll")]

private static extern int Shsetinputcontext (IntPtr hwnd,shic_feature dwfeature,[marshalas (unmanagedtype.bool)]ref BOOL lpvalue);

Then, when used, as long as the value given to this function, such as the following code, is prohibited auto suggestion:

BOOL value = FALSE;
Shsetinputcontext (TextBox1. Handle,shic_feature. Autosuggest,ref value);

In order to make a description of the image, we can try. First, create two new contacts, as shown in Figure 1 below:

Figure 1: New two contacts

Then, connect the emulator to the Honeycomb emulator, and refer to the ring Tone Manager on Windows Mobile.

Next, start our application, given the example is this, we can send a short message to a friend, in the process of entering their names, the system will be compared with the contact library, will match the person displayed for the user to choose. As shown in Figure 2 below: In the recipient, I only entered the first letter "S", in the input method, there is a match between the contact information.

Figure 2: Entering automatic suggestions for contacts

Also, when you enter the content (message) of the information, the system also gives an automatic spelling suggestion, as shown in Figure 3 below:

Figure 3: Automatic spelling suggestions for entering information content

In addition, we can choose whether to send the battery endurance information to each other, as shown in Figure 4 below:

Figure 4: Whether the battery information option is included

Clicking Send "Send", we can see the information in the Honeycomb emulator, as shown in Figure 5 below:

Figure 5: Information in the Honeycomb emulator

Related Article

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.