Open the Delphi 2010 window to program,
When programming, the IMEMode property of a component that is input Western or West is generally set to the default value, while the IMEMode property of the input Chinese or Chinese-dominated component is set to the Imopen;imename property value when the program is run by the user. This is the flexibility of this approach. Also, you need to set the value of Edit1.text, Edit2.text, and memo1.lines to null.
(3) Add a label Label4 to the Form1 and set its properties to:
Caption = Choose your favorite Input method
Font.size=12
Font.color= Red
(4) Add a drop-down combo box in the Form1 ComboBox1, select the Events tab in Object Viewer, and double-click Ondropdown to program the event with the following code:
Combobox1.items.commatext:=screen.imes.commatext;
The above statement can add the Chinese character input method installed in Windows 95 to the drop-down combo box, which skillfully applies the IMEs property of the Tscreen class, and the IMEs attribute itself is a tstring class whose properties Commatext contains the Windows 95 installed Chinese character input method, you can assign it directly to the corresponding properties of ComboBox1. If you edit the properties of ComboBox1 directly to add the name of the Chinese character input method, the application's non-commonality will be caused by the uncertainty of the user's machine character input method when the application is published.
Double-click the OnExit event in the Object Viewer to program this event with the following code:
Edit1.imename:=combobox1.text;
Memo1.imename:=combobox1.text;
(5) Add a command button Button1 in Form1 and set its properties to:
Caption= exit
Font.size=12
Double-click the command button to program the Click event, with the following code:
Close;
At this point, the entire example of the program design process is completed, save the application and form, and then compile, run.
3. The use of Chinese character input method
First select your favorite Chinese character input method in the dropdown combo box, move the cursor to the Chinese input edit box to find that the selected Chinese character input method has automatically appeared on the screen, and then move the cursor to the Latin input edit box, the Chinese character input method will be automatically closed; If you move the cursor to the Chinese multi-line text edit box, The Chinese character input method is selected and appears automatically.
From the above program can be drawn, in the application input interface, set up a selection of input method drop-down combo box, and let it control the input interface of all the Imename attributes can be entered, not only in the Chinese and Western text input process does not have to enter the method of switching back and forth, can also be done to allow users to choose their favorite Chinese character input method, and this input interface for users is also very friendly, convenient and fast. Pcc
Must use ' identifier, but direct with ' error
tdataset.filter:= ' Somebodyname= ' +CHR (39) + ' Lee * ' +CHR (39)
End.
Delphi easy to implement input method programming