包含在尋找其他文件熱門支援資源 | 以 PDF 格式下載這本書 (189 KB)
Chapter 3 Adding CTL Support to an ApplicationAdding CTL support to an application requires little or no change to the source code. Certain resources are set in the resource file to control the behavior of the language engine for all Text, TextField, and other static text. If an application was compiled in an earlier version of Solaris, the code should be recompiled in Solaris 8. Ensure that the application is linked to the default Motif library in Solaris 8 (libXm.so) which is linked to the latest Motif library (libXm.so.4). Add the flag -DSUN_CTL to Makefiles for compilation. For finer control over CTL attributes, such as cursor positioning and character and cell deletion, use the APIs provided in PLS with its configuration file. For more information about the Portable Layout Services APIs, see CAE Specification: Portable Layout Services: ISBN 1-85912-142-X 3.1 CTL Motif ResourcesTo control CTL functionality in an application, use the following Motif resources:
Step 1. Control the behavior of the language engine through the layoutModifier resource in the application resource file. For example, the default numeral type, text type, and text orientation can be changed using the following resource:*layoutModifier: @ls numerals=nominal:contextual,typeoftext=implicit:visual, orientation=ltr:rtl Table 3-1 Common Modifiers
For a complete list of layout modifiers, see Portable Layout Services: Context-Dependent and Directional Text: ISBN 1-85912-075-X. Step 2. Configure Hebrew and Arabic locales to support Visual mode for editing in the resource file as follows: *editPolicy: XmEDIT_VISUAL (default is XmEDIT_LOGICAL) Step 3. To override the default keystrokes in an application, make the necessary changes in the resource file, as shown in the following example: *XmText.translations: #override \n\ c <Key>q:right-word() \n\ c <Key>w:left-word() \n\ c <Key>g:forward-word(extend) \n\ c <Key>h:backward-word(extend) \n\ c <Key>f:next-line(extend) \n\ c <Key>b:previous-line(extend) \n\ c <Key>>:right-character() \n\ c <Key><:left-character() \n\ c <Key>t:prev-cell() \n\ c <Key>v:forward-cell() \n\ c <Key>+:delete-right-word() \n\ c <Key>-:delete-left-word() \n\ c <Key>r:right-character(extend) \n\ c <Key>l:left-character(extend) Step 4. The Motif resource layoutDirection can be used to set the right to left screen layout. In this screen mode, the screen origin is the top right corner and all application Motif widgets are mirrored. The following example shows how to set this in the resource file:*layoutDirection: XmBOTTOM_TO_TOP_RIGHT_TO_LEFT This resource changes the layout of the whole application. To change the layout of some widgets only, such as Text or TextField, use the following: *XmText*layoutDirection: XmBOTTOM_TO_TOP_RIGHT_TO_LEFT *XmTextField*layoutDirection: XmBOTTOM_TO_TOP_RIGHT_TO_LEFT Step 5. The screen layout can be dynamically switched for the Text and TextField widgets by defining the dynamic switching hot keys in the Motif translation table. The following example shows how to add this function to the resource file: *XmText.translations: #override \n\ Ctrl<Key>m:toggle-rtl-mode()2-TextField: *XmTextField.translations: #override \n\ Ctrl<Key>m:toggle-rtl-mode() Note - CTRL+m is defined as the key combination to dynamically switch the screen layout. Any key combination which doesn't interfere with the application hot keys can be defined instead. This entry can also be appended to the original key translation table as discussed in Step 3 above. 3.2 CTL PrintingEach locale provides text input and display in the locale language and in English. Solaris 8 also includes the print utilities ctlmp and ctlconvert_text which can be used to print the CTL text.
|
||||||||||||||||||||||||||||||||||||