Partager via


Using the Japanese Pocket IME UI (Windows Embedded CE 6.0)

1/6/2010

By default, the Pocket IME UI displays the candidate list window under the composition window. If there is a software input panel under the composition window, the software input panel overlaps the candidate window. This is not a problem if you can move the software input panel. If the software input panel is docked, as on a small screen, problems occur when you attempt to select the candidate window. If you plan to make the software input panel docked, you can modify Pocket IME UI source code to move the IME candidate window and avoid overlapping the IM window.

The following example modifies Cand100.cpp, the source code file that creates a candidate window. The example uses SipGetInfo to retrieve the IM window position, and to check whether the IME candidate window overlaps with it.

Note

The code modifications are noted by comment. If you want to implement this modification, insert the new code in Cand100.cpp. To make the following code example easier to read, error checking is not included. This code example should not be used in a release configuration unless it has been modified to include secure error handling.

%_WINCEROOT%\public\common\oak\drivers\imejpp\imeui\cand100.cpp
........
//
// First include the SIPAPI before AdjustCandPos
//
#include "sipapi.h"
     
 void     AdjustCandPos(POINT *pt, SIZE sizeCandWnd)
     
          int          nScreenSize;
          int          nHideSize;
     
          if(pt->x < 0)
               pt->x = 0;
     
          if(pt->y < 0)
               pt->y = 0;
     
          nScreenSize = GetSystemMetrics(SM_CXSCREEN);
          if(pt->x + sizeCandWnd.cy > nScreenSize) {
               nHideSize = pt->x + sizeCandWnd.cx - nScreenSize;
               pt->x -= nHideSize;
          }
     
          nScreenSize = GetSystemMetrics(SM_CYSCREEN);
          if(pt->y + sizeCandWnd.cy > nScreenSize) {
               pt->y -= sizeCandWnd.cy + sizeT.cy + 2;
          }
//
// Insert modification here
//
// The new code checks to see if the IM window position overlaps, and moves the IME candidate if necessary
//
          else {
               SIPINFO     SipInfo;
               SipInfo.cbSize = sizeof(SIPINFO);
               SipInfo.dwImDataSize = 0;
               if (SipGetInfo(&SipInfo)) {
                    if ((SipInfo.rcSipRect.top < pt->y + sizeCandWnd.cy)
                    && (SipInfo.rcSipRect.bottom >= pt->y)
                    && (SipInfo.rcSipRect.left < pt->x + sizeCandWnd.cx)
                    && (SipInfo.rcSipRect.right >= pt->x)
                    && (pt->y - (sizeCandWnd.cy + sizeT.cy + 2) >= 0)) {
                    pt->y -= sizeCandWnd.cy + sizeT.cy + 2;
                    }
               }
          }
     }

See Also

Concepts

Japanese Pocket IME UI Code

Other Resources

Programming a Software-Based Input Panel
SipGetInfo