ITextInputPanel
COM公式ドキュメント
Tablet PC 入力パネルの外観と動作を制御します。
解説(Remarks)
ITextInputPanel Interface は、PenInputPanel Class よりも入力パネルの状態に関する多くの制御と情報をアプリケーション開発者に提供します。ITextInputPanel Interface は、入力パネルをプログラムから操作するための推奨される仕組みとして PenInputPanel Class に代わるものです。
ITextInputPanel Interface は次の機能を提供します。
- アプリケーションがフォーカスを持っているときの、インプレース入力パネルの配置に対する完全な制御。
- 認識されたテキストに加えて、入力パネルによるテキスト挿入で得られるインク (手書き) オブジェクトへのアクセス。
- 入力パネルの機能に厳密に対応する一連のプロパティ。これにより、入力パネルの現在の状態を把握することと、入力パネルの構成をカスタマイズすることの両方が可能になります。
この要素は Peninputpanel.h で宣言されています。
メソッド 25
vtbl = vtable インデックス(0始まり)。HSP等からCOMメソッドをインデックス指定で呼ぶ際に使用します。0〜2 は IUnknown。
ITextInputPanel オブジェクトがアタッチされているオブジェクトのウィンドウハンドルを取得または設定します。(Get)
| AttachedEditWindow | HWND* | out | 入力パネルが関連付けられている編集ウィンドウのハンドルを受け取る出力ポインタである。 |
解説(Remarks)
オブジェクトのウィンドウハンドルは変化する場合があります。
例
この C++ の例では、ITextInputPanel オブジェクト g_pTip を作成し、ITextInputPanel::AttachedEditWindow Property プロパティを設定することで、InkEdit コントロール IDC_EDIT3 のウィンドウハンドルにアタッチします。
if (SUCCEEDED(CoInitialize(NULL)))
{
if (SUCCEEDED(CoCreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC, IID_ITextInputPanel, (VOID**)&g_pTip)))
{
if (SUCCEEDED(g_pTip->put_AttachedEditWindow(GetDlgItem(IDC_EDIT3)->m_hWnd)))
{
g_pTip->put_DefaultInPlaceState(InPlaceState_Expanded);
InPlaceState ips;
g_pTip->get_DefaultInPlaceState(&ips);
TRACE("DefaultInplaceState: %d\n", ips);
g_pTip->put_DefaultInputArea(PanelInputArea_CharacterPad);
PanelInputArea pia;
g_pTip->get_DefaultInputArea(&pia);
TRACE("DefaultInputArea: %d\n", pia);
g_pTip->put_ExpandPostInsertionCorrection(FALSE);
BOOL epic;
g_pTip->get_ExpandPostInsertionCorrection(&epic);
TRACE("ExpandPostInsertionCorrection: %d\n", epic);
g_pTip->put_InPlaceVisibleOnFocus(TRUE);
BOOL ipvof;
g_pTip->get_InPlaceVisibleOnFocus(&ipvof);
TRACE("InPlaceVisibleOnFocus: %d\n", ipvof);
g_pTip->put_PreferredInPlaceDirection(InPlaceDirection_Top);
InPlaceDirection direction;
g_pTip->get_PreferredInPlaceDirection(&direction);
TRACE("PreferredInPlaceDirection: %d\n", direction);
}
}
else
{
TRACE("Failed to create ITextInputPanel object.\n");
}
}
ITextInputPanel オブジェクトがアタッチされているオブジェクトのウィンドウハンドルを取得または設定します。(Put)
| AttachedEditWindow | HWND | in | 入力パネルを関連付ける編集ウィンドウのハンドルを指定する。 |
解説(Remarks)
オブジェクトのウィンドウハンドルは変化する場合があります。
例
この C++ の例では、ITextInputPanel オブジェクト g_pTip を作成し、ITextInputPanel::AttachedEditWindow Property プロパティを設定することで、InkEdit コントロール IDC_EDIT3 のウィンドウハンドルにアタッチします。
if (SUCCEEDED(CoInitialize(NULL)))
{
if (SUCCEEDED(CoCreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC, IID_ITextInputPanel, (VOID**)&g_pTip)))
{
if (SUCCEEDED(g_pTip->put_AttachedEditWindow(GetDlgItem(IDC_EDIT3)->m_hWnd)))
{
g_pTip->put_DefaultInPlaceState(InPlaceState_Expanded);
InPlaceState ips;
g_pTip->get_DefaultInPlaceState(&ips);
TRACE("DefaultInplaceState: %d\n", ips);
g_pTip->put_DefaultInputArea(PanelInputArea_CharacterPad);
PanelInputArea pia;
g_pTip->get_DefaultInputArea(&pia);
TRACE("DefaultInputArea: %d\n", pia);
g_pTip->put_ExpandPostInsertionCorrection(FALSE);
BOOL epic;
g_pTip->get_ExpandPostInsertionCorrection(&epic);
TRACE("ExpandPostInsertionCorrection: %d\n", epic);
g_pTip->put_InPlaceVisibleOnFocus(TRUE);
BOOL ipvof;
g_pTip->get_InPlaceVisibleOnFocus(&ipvof);
TRACE("InPlaceVisibleOnFocus: %d\n", ipvof);
g_pTip->put_PreferredInPlaceDirection(InPlaceDirection_Top);
InPlaceDirection direction;
g_pTip->get_PreferredInPlaceDirection(&direction);
TRACE("PreferredInPlaceDirection: %d\n", direction);
}
}
else
{
TRACE("Failed to create ITextInputPanel object.\n");
}
}
InteractionMode 列挙型で指定される、Tablet PC 入力パネルの配置を取得します。
| CurrentInteractionMode | InteractionMode* | out | 入力パネルの現在の操作モード(In-Place か Docked か等)を受け取る出力ポインタである。 |
解説(Remarks)
現在の対話モードはユーザーによって決まります。ただし、InteractionMode_InPlace モードは、アプリケーションがフィールド単位で無効にできます。
例
この C++ の例では、Edit コントロール IDC_EDIT3 の EN_SETFOCUS イベントハンドラーを実装します。まず、ITextInputPanel オブジェクト g_pTip が作成済みかどうかを確認します。存在する場合は、TRACE マクロを使用して、いくつかの ITextInputPanel Interface プロパティの値をデバッグ出力に報告します。
void CCOMTIPDlg::OnEnSetFocusEdit3()
{
if (NULL != g_pTip)
{
CorrectionMode mode;
if (SUCCEEDED(g_pTip->get_CurrentCorrectionMode(&mode)))
{
TRACE("CurrentCorrectionMode: %d\n", mode);
}
InPlaceState state;
if (SUCCEEDED(g_pTip->get_CurrentInPlaceState(&state)))
{
TRACE("CurrentInPlaceState: %d\n", state);
}
PanelInputArea area;
if (SUCCEEDED(g_pTip->get_CurrentInputArea(&area)))
{
TRACE("CurrentInputArea: %d\n", area);
}
InteractionMode iMode;
if (SUCCEEDED(g_pTip->get_CurrentInteractionMode(&iMode)))
{
TRACE("CurrentInteractionMode: %d\n", iMode);
}
RECT rect;
if (SUCCEEDED(g_pTip->get_InPlaceBoundingRectangle(&rect)))
{
TRACE("InPlaceBoundingRectangle.top: %d\n", rect.top);
TRACE("InPlaceBoundingRectangle.left: %d\n", rect.left);
TRACE("InPlaceBoundingRectangle.bottom: %d\n", rect.bottom);
TRACE("InPlaceBoundingRectangle.right: %d\n", rect.right);
}
int nHeight;
if (SUCCEEDED(g_pTip->get_PopDownCorrectionHeight(&nHeight)))
{
TRACE("PopDownCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->get_PopUpCorrectionHeight(&nHeight)))
{
TRACE("PopUpCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->SetInPlacePosition(300, 300, CorrectionPosition_Bottom)))
{
TRACE("Call to SetInPlacePosition() succeeded.\n");
}
else
{
TRACE("Call to SetInPlacePosition() failed.\n");
}
}
else
{
TRACE("ITextInputPanel object is NULL.\n");
}
}
InPlaceState 列挙型で指定される既定のインプレース状態を取得または設定します。(Get)
| State | InPlaceState* | out | インプレース入力パネルの既定の表示状態を受け取る出力ポインタである。 |
解説(Remarks)
ユーザーがホバーターゲットをタップしなくても入力パネルが開くようにするには、このプロパティに InPlaceState_Expanded を設定します。既定の状態に InPlaceState_HoverTarget を設定すると、展開状態を維持するかどうかを判断する入力パネルのヒューリスティックが上書きされます。フィールドを切り替える際に既定値を設定しておくと、フォーカスの変更後、入力パネルは折りたたみ状態またはホバー状態に強制されます。システムの既定値は InPlaceState_Auto です。
例
この C++ の例では、ITextInputPanel オブジェクト g_pTip を作成し、ITextInputPanel::AttachedEditWindow Property プロパティを設定することで、InkEdit コントロール IDC_EDIT3 のウィンドウハンドルにアタッチします。さらに、ITextInputPanel::DefaultInPlaceState Property を設定してから取得します。
if (SUCCEEDED(CoInitialize(NULL)))
{
if (SUCCEEDED(CoCreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC, IID_ITextInputPanel, (VOID**)&g_pTip)))
{
if (SUCCEEDED(g_pTip->put_AttachedEditWindow(GetDlgItem(IDC_EDIT3)->m_hWnd)))
{
g_pTip->put_DefaultInPlaceState(InPlaceState_Expanded);
InPlaceState ips;
g_pTip->get_DefaultInPlaceState(&ips);
TRACE("DefaultInplaceState: %d\n", ips);
g_pTip->put_DefaultInputArea(PanelInputArea_CharacterPad);
PanelInputArea pia;
g_pTip->get_DefaultInputArea(&pia);
TRACE("DefaultInputArea: %d\n", pia);
g_pTip->put_ExpandPostInsertionCorrection(FALSE);
BOOL epic;
g_pTip->get_ExpandPostInsertionCorrection(&epic);
TRACE("ExpandPostInsertionCorrection: %d\n", epic);
g_pTip->put_InPlaceVisibleOnFocus(TRUE);
BOOL ipvof;
g_pTip->get_InPlaceVisibleOnFocus(&ipvof);
TRACE("InPlaceVisibleOnFocus: %d\n", ipvof);
g_pTip->put_PreferredInPlaceDirection(InPlaceDirection_Top);
InPlaceDirection direction;
g_pTip->get_PreferredInPlaceDirection(&direction);
TRACE("PreferredInPlaceDirection: %d\n", direction);
}
}
else
{
TRACE("Failed to create ITextInputPanel object.\n");
}
}
InPlaceState 列挙型で指定される既定のインプレース状態を取得または設定します。(Put)
| State | InPlaceState | in | インプレース入力パネルの既定の表示状態を指定する。 |
解説(Remarks)
ユーザーがホバーターゲットをタップしなくても入力パネルが開くようにするには、このプロパティに InPlaceState_Expanded を設定します。既定の状態に InPlaceState_HoverTarget を設定すると、展開状態を維持するかどうかを判断する入力パネルのヒューリスティックが上書きされます。フィールドを切り替える際に既定値を設定しておくと、フォーカスの変更後、入力パネルは折りたたみ状態またはホバー状態に強制されます。システムの既定値は InPlaceState_Auto です。
例
この C++ の例では、ITextInputPanel オブジェクト g_pTip を作成し、ITextInputPanel::AttachedEditWindow Property プロパティを設定することで、InkEdit コントロール IDC_EDIT3 のウィンドウハンドルにアタッチします。さらに、ITextInputPanel::DefaultInPlaceState Property を設定してから取得します。
if (SUCCEEDED(CoInitialize(NULL)))
{
if (SUCCEEDED(CoCreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC, IID_ITextInputPanel, (VOID**)&g_pTip)))
{
if (SUCCEEDED(g_pTip->put_AttachedEditWindow(GetDlgItem(IDC_EDIT3)->m_hWnd)))
{
g_pTip->put_DefaultInPlaceState(InPlaceState_Expanded);
InPlaceState ips;
g_pTip->get_DefaultInPlaceState(&ips);
TRACE("DefaultInplaceState: %d\n", ips);
g_pTip->put_DefaultInputArea(PanelInputArea_CharacterPad);
PanelInputArea pia;
g_pTip->get_DefaultInputArea(&pia);
TRACE("DefaultInputArea: %d\n", pia);
g_pTip->put_ExpandPostInsertionCorrection(FALSE);
BOOL epic;
g_pTip->get_ExpandPostInsertionCorrection(&epic);
TRACE("ExpandPostInsertionCorrection: %d\n", epic);
g_pTip->put_InPlaceVisibleOnFocus(TRUE);
BOOL ipvof;
g_pTip->get_InPlaceVisibleOnFocus(&ipvof);
TRACE("InPlaceVisibleOnFocus: %d\n", ipvof);
g_pTip->put_PreferredInPlaceDirection(InPlaceDirection_Top);
InPlaceDirection direction;
g_pTip->get_PreferredInPlaceDirection(&direction);
TRACE("PreferredInPlaceDirection: %d\n", direction);
}
}
else
{
TRACE("Failed to create ITextInputPanel object.\n");
}
}
InPlaceState 列挙型で指定される現在のインプレース状態を取得します。
| State | InPlaceState* | out | インプレース入力パネルの現在の表示状態を受け取る出力ポインタである。 |
解説(Remarks)
Tablet PC 入力パネルが閉じられるか非表示になると、現在のインプレース状態は既定の状態にリセットされます。ただし、既定の状態が Auto の場合、現在のインプレース状態は Hover にリセットされます。
例
この C++ の例では、Edit コントロール IDC_EDIT3 の EN_SETFOCUS イベントハンドラーを実装します。まず、ITextInputPanel オブジェクト g_pTip が作成済みかどうかを確認します。存在する場合は、TRACE マクロを使用して、いくつかの ITextInputPanel Interface プロパティの値をデバッグ出力に報告します。
void CCOMTIPDlg::OnEnSetFocusEdit3()
{
if (NULL != g_pTip)
{
CorrectionMode mode;
if (SUCCEEDED(g_pTip->get_CurrentCorrectionMode(&mode)))
{
TRACE("CurrentCorrectionMode: %d\n", mode);
}
InPlaceState state;
if (SUCCEEDED(g_pTip->get_CurrentInPlaceState(&state)))
{
TRACE("CurrentInPlaceState: %d\n", state);
}
PanelInputArea area;
if (SUCCEEDED(g_pTip->get_CurrentInputArea(&area)))
{
TRACE("CurrentInputArea: %d\n", area);
}
InteractionMode iMode;
if (SUCCEEDED(g_pTip->get_CurrentInteractionMode(&iMode)))
{
TRACE("CurrentInteractionMode: %d\n", iMode);
}
RECT rect;
if (SUCCEEDED(g_pTip->get_InPlaceBoundingRectangle(&rect)))
{
TRACE("InPlaceBoundingRectangle.top: %d\n", rect.top);
TRACE("InPlaceBoundingRectangle.left: %d\n", rect.left);
TRACE("InPlaceBoundingRectangle.bottom: %d\n", rect.bottom);
TRACE("InPlaceBoundingRectangle.right: %d\n", rect.right);
}
int nHeight;
if (SUCCEEDED(g_pTip->get_PopDownCorrectionHeight(&nHeight)))
{
TRACE("PopDownCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->get_PopUpCorrectionHeight(&nHeight)))
{
TRACE("PopUpCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->SetInPlacePosition(300, 300, CorrectionPosition_Bottom)))
{
TRACE("Call to SetInPlacePosition() succeeded.\n");
}
else
{
TRACE("Call to SetInPlacePosition() failed.\n");
}
}
else
{
TRACE("ITextInputPanel object is NULL.\n");
}
}
PanelInputArea 列挙型で指定される既定の入力領域を取得または設定します。(Get)
| Area | PanelInputArea* | out | 入力パネルの既定の入力領域(手書き入力や文字パッド等)を受け取る出力ポインタである。 |
解説(Remarks)
システムの既定値は PanelInputArea_Auto ですが、パスワードフィールドではシステムの既定値は PanelInputArea_Keyboard です。既定の入力領域を設定すると、あらゆる場合にシステムの既定値が上書きされます。ただし、現在の認識エンジンがそのモードをサポートしていない、または現在の入力言語に対応する認識エンジンが存在しないために入力領域を利用できない場合は除きます。
例
この C++ の例では、ITextInputPanel オブジェクト g_pTip を作成し、ITextInputPanel::AttachedEditWindow Property プロパティを設定することで、InkEdit コントロール IDC_EDIT3 のウィンドウハンドルにアタッチします。さらに、ITextInputPanel::DefaultInputArea Property を設定してから取得します。
if (SUCCEEDED(CoInitialize(NULL)))
{
if (SUCCEEDED(CoCreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC, IID_ITextInputPanel, (VOID**)&g_pTip)))
{
if (SUCCEEDED(g_pTip->put_AttachedEditWindow(GetDlgItem(IDC_EDIT3)->m_hWnd)))
{
g_pTip->put_DefaultInPlaceState(InPlaceState_Expanded);
InPlaceState ips;
g_pTip->get_DefaultInPlaceState(&ips);
TRACE("DefaultInplaceState: %d\n", ips);
g_pTip->put_DefaultInputArea(PanelInputArea_CharacterPad);
PanelInputArea pia;
g_pTip->get_DefaultInputArea(&pia);
TRACE("DefaultInputArea: %d\n", pia);
g_pTip->put_ExpandPostInsertionCorrection(FALSE);
BOOL epic;
g_pTip->get_ExpandPostInsertionCorrection(&epic);
TRACE("ExpandPostInsertionCorrection: %d\n", epic);
g_pTip->put_InPlaceVisibleOnFocus(TRUE);
BOOL ipvof;
g_pTip->get_InPlaceVisibleOnFocus(&ipvof);
TRACE("InPlaceVisibleOnFocus: %d\n", ipvof);
g_pTip->put_PreferredInPlaceDirection(InPlaceDirection_Top);
InPlaceDirection direction;
g_pTip->get_PreferredInPlaceDirection(&direction);
TRACE("PreferredInPlaceDirection: %d\n", direction);
}
}
else
{
TRACE("Failed to create ITextInputPanel object.\n");
}
}
PanelInputArea 列挙型で指定される既定の入力領域を取得または設定します。(Put)
| Area | PanelInputArea | in | 入力パネルの既定の入力領域を指定する。 |
解説(Remarks)
システムの既定値は PanelInputArea_Auto ですが、パスワードフィールドではシステムの既定値は PanelInputArea_Keyboard です。既定の入力領域を設定すると、あらゆる場合にシステムの既定値が上書きされます。ただし、現在の認識エンジンがそのモードをサポートしていない、または現在の入力言語に対応する認識エンジンが存在しないために入力領域を利用できない場合は除きます。
例
この C++ の例では、ITextInputPanel オブジェクト g_pTip を作成し、ITextInputPanel::AttachedEditWindow Property プロパティを設定することで、InkEdit コントロール IDC_EDIT3 のウィンドウハンドルにアタッチします。さらに、ITextInputPanel::DefaultInputArea Property を設定してから取得します。
if (SUCCEEDED(CoInitialize(NULL)))
{
if (SUCCEEDED(CoCreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC, IID_ITextInputPanel, (VOID**)&g_pTip)))
{
if (SUCCEEDED(g_pTip->put_AttachedEditWindow(GetDlgItem(IDC_EDIT3)->m_hWnd)))
{
g_pTip->put_DefaultInPlaceState(InPlaceState_Expanded);
InPlaceState ips;
g_pTip->get_DefaultInPlaceState(&ips);
TRACE("DefaultInplaceState: %d\n", ips);
g_pTip->put_DefaultInputArea(PanelInputArea_CharacterPad);
PanelInputArea pia;
g_pTip->get_DefaultInputArea(&pia);
TRACE("DefaultInputArea: %d\n", pia);
g_pTip->put_ExpandPostInsertionCorrection(FALSE);
BOOL epic;
g_pTip->get_ExpandPostInsertionCorrection(&epic);
TRACE("ExpandPostInsertionCorrection: %d\n", epic);
g_pTip->put_InPlaceVisibleOnFocus(TRUE);
BOOL ipvof;
g_pTip->get_InPlaceVisibleOnFocus(&ipvof);
TRACE("InPlaceVisibleOnFocus: %d\n", ipvof);
g_pTip->put_PreferredInPlaceDirection(InPlaceDirection_Top);
InPlaceDirection direction;
g_pTip->get_PreferredInPlaceDirection(&direction);
TRACE("PreferredInPlaceDirection: %d\n", direction);
}
}
else
{
TRACE("Failed to create ITextInputPanel object.\n");
}
}
PanelInputArea 列挙型で指定される現在の入力領域を取得します。
| Area | PanelInputArea* | out | 入力パネルで現在表示されている入力領域を受け取る出力ポインタである。 |
解説(Remarks)
ユーザーが明示的に入力領域を切り替えた場合、現在の入力領域は既定の入力領域と異なります。また、現在の認識エンジンがそのモードをサポートしていない、または現在の入力言語に対応する認識エンジンが存在しないために既定の入力領域を利用できない場合も異なります。Tablet PC 入力パネルが閉じられるか非表示になると、現在の入力領域は既定の入力領域と同じ値にリセットされます。ただし、既定の状態が Auto の場合はリセットされず、最後に表示されていた入力領域を表します。
例
この C++ の例では、Edit コントロール IDC_EDIT3 の EN_SETFOCUS イベントハンドラーを実装します。まず、ITextInputPanel オブジェクト g_pTip が作成済みかどうかを確認します。存在する場合は、TRACE マクロを使用して、いくつかの ITextInputPanel Interface プロパティの値をデバッグ出力に報告します。
void CCOMTIPDlg::OnEnSetFocusEdit3()
{
if (NULL != g_pTip)
{
CorrectionMode mode;
if (SUCCEEDED(g_pTip->get_CurrentCorrectionMode(&mode)))
{
TRACE("CurrentCorrectionMode: %d\n", mode);
}
InPlaceState state;
if (SUCCEEDED(g_pTip->get_CurrentInPlaceState(&state)))
{
TRACE("CurrentInPlaceState: %d\n", state);
}
PanelInputArea area;
if (SUCCEEDED(g_pTip->get_CurrentInputArea(&area)))
{
TRACE("CurrentInputArea: %d\n", area);
}
InteractionMode iMode;
if (SUCCEEDED(g_pTip->get_CurrentInteractionMode(&iMode)))
{
TRACE("CurrentInteractionMode: %d\n", iMode);
}
RECT rect;
if (SUCCEEDED(g_pTip->get_InPlaceBoundingRectangle(&rect)))
{
TRACE("InPlaceBoundingRectangle.top: %d\n", rect.top);
TRACE("InPlaceBoundingRectangle.left: %d\n", rect.left);
TRACE("InPlaceBoundingRectangle.bottom: %d\n", rect.bottom);
TRACE("InPlaceBoundingRectangle.right: %d\n", rect.right);
}
int nHeight;
if (SUCCEEDED(g_pTip->get_PopDownCorrectionHeight(&nHeight)))
{
TRACE("PopDownCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->get_PopUpCorrectionHeight(&nHeight)))
{
TRACE("PopUpCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->SetInPlacePosition(300, 300, CorrectionPosition_Bottom)))
{
TRACE("Call to SetInPlacePosition() succeeded.\n");
}
else
{
TRACE("Call to SetInPlacePosition() failed.\n");
}
}
else
{
TRACE("ITextInputPanel object is NULL.\n");
}
}
CorrectionMode 列挙型で指定される、現在の修正コームのモードを取得します。
| Mode | CorrectionMode* | out | 入力パネルの現在の訂正(修正)モードを受け取る出力ポインタである。 |
解説(Remarks)
例
この C++ の例では、Edit コントロール IDC_EDIT3 の EN_SETFOCUS イベントハンドラーを実装します。まず、ITextInputPanel オブジェクト g_pTip が作成済みかどうかを確認します。存在する場合は、TRACE マクロを使用して、いくつかの ITextInputPanel Interface プロパティの値をデバッグ出力に報告します。
void CCOMTIPDlg::OnEnSetFocusEdit3()
{
if (NULL != g_pTip)
{
CorrectionMode mode;
if (SUCCEEDED(g_pTip->get_CurrentCorrectionMode(&mode)))
{
TRACE("CurrentCorrectionMode: %d\n", mode);
}
InPlaceState state;
if (SUCCEEDED(g_pTip->get_CurrentInPlaceState(&state)))
{
TRACE("CurrentInPlaceState: %d\n", state);
}
PanelInputArea area;
if (SUCCEEDED(g_pTip->get_CurrentInputArea(&area)))
{
TRACE("CurrentInputArea: %d\n", area);
}
InteractionMode iMode;
if (SUCCEEDED(g_pTip->get_CurrentInteractionMode(&iMode)))
{
TRACE("CurrentInteractionMode: %d\n", iMode);
}
RECT rect;
if (SUCCEEDED(g_pTip->get_InPlaceBoundingRectangle(&rect)))
{
TRACE("InPlaceBoundingRectangle.top: %d\n", rect.top);
TRACE("InPlaceBoundingRectangle.left: %d\n", rect.left);
TRACE("InPlaceBoundingRectangle.bottom: %d\n", rect.bottom);
TRACE("InPlaceBoundingRectangle.right: %d\n", rect.right);
}
int nHeight;
if (SUCCEEDED(g_pTip->get_PopDownCorrectionHeight(&nHeight)))
{
TRACE("PopDownCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->get_PopUpCorrectionHeight(&nHeight)))
{
TRACE("PopUpCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->SetInPlacePosition(300, 300, CorrectionPosition_Bottom)))
{
TRACE("Call to SetInPlacePosition() succeeded.\n");
}
else
{
TRACE("Call to SetInPlacePosition() failed.\n");
}
}
else
{
TRACE("ITextInputPanel object is NULL.\n");
}
}
テキスト入力フィールドに対するインプレース入力パネルの推奨方向を取得または設定します。(Get)
| Direction | InPlaceDirection* | out | インプレース入力パネルを表示する優先方向を受け取る出力ポインタである。 |
解説(Remarks)
アプリケーションは、インプレース入力パネルを既定でテキスト入力フィールドの上下どちらに表示するかを指定できます。そのためには、ITextInputPanel::PreferredInPlaceDirection Property に InPlaceDirection_Bottom または InPlaceDirection_Top を設定します。ITextInputPanel::PreferredInPlaceDirection Property はあくまで優先設定です。これは、入力パネルを画面内に収めるために必要な場合、インプレース入力パネルがアプリケーションの設定した優先設定を上書きするためです。システムの既定では、可能な場合はテキストフィールドの下に、それ以外の場合は上にインプレース入力パネルを配置します。PreferredInPlaceDirection に InPlaceDirection_Auto を設定すると、システムの既定に戻ります。
例
この C++ の例では、ITextInputPanel オブジェクト g_pTip を作成し、ITextInputPanel::AttachedEditWindow Property プロパティを設定することで、InkEdit コントロール IDC_EDIT3 のウィンドウハンドルにアタッチします。さらに、ITextInputPanel::PreferredInPlaceDirection Property を設定してから取得します。
if (SUCCEEDED(CoInitialize(NULL)))
{
if (SUCCEEDED(CoCreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC, IID_ITextInputPanel, (VOID**)&g_pTip)))
{
if (SUCCEEDED(g_pTip->put_AttachedEditWindow(GetDlgItem(IDC_EDIT3)->m_hWnd)))
{
g_pTip->put_DefaultInPlaceState(InPlaceState_Expanded);
InPlaceState ips;
g_pTip->get_DefaultInPlaceState(&ips);
TRACE("DefaultInplaceState: %d\n", ips);
g_pTip->put_DefaultInputArea(PanelInputArea_CharacterPad);
PanelInputArea pia;
g_pTip->get_DefaultInputArea(&pia);
TRACE("DefaultInputArea: %d\n", pia);
g_pTip->put_ExpandPostInsertionCorrection(FALSE);
BOOL epic;
g_pTip->get_ExpandPostInsertionCorrection(&epic);
TRACE("ExpandPostInsertionCorrection: %d\n", epic);
g_pTip->put_InPlaceVisibleOnFocus(TRUE);
BOOL ipvof;
g_pTip->get_InPlaceVisibleOnFocus(&ipvof);
TRACE("InPlaceVisibleOnFocus: %d\n", ipvof);
g_pTip->put_PreferredInPlaceDirection(InPlaceDirection_Top);
InPlaceDirection direction;
g_pTip->get_PreferredInPlaceDirection(&direction);
TRACE("PreferredInPlaceDirection: %d\n", direction);
}
}
else
{
TRACE("Failed to create ITextInputPanel object.\n");
}
}
テキスト入力フィールドに対するインプレース入力パネルの推奨方向を取得または設定します。(Put)
| Direction | InPlaceDirection | in | インプレース入力パネルを表示する優先方向を指定する。 |
解説(Remarks)
アプリケーションは、インプレース入力パネルを既定でテキスト入力フィールドの上下どちらに表示するかを指定できます。そのためには、ITextInputPanel::PreferredInPlaceDirection Property に InPlaceDirection_Bottom または InPlaceDirection_Top を設定します。ITextInputPanel::PreferredInPlaceDirection Property はあくまで優先設定です。これは、入力パネルを画面内に収めるために必要な場合、インプレース入力パネルがアプリケーションの設定した優先設定を上書きするためです。システムの既定では、可能な場合はテキストフィールドの下に、それ以外の場合は上にインプレース入力パネルを配置します。PreferredInPlaceDirection に InPlaceDirection_Auto を設定すると、システムの既定に戻ります。
例
この C++ の例では、ITextInputPanel オブジェクト g_pTip を作成し、ITextInputPanel::AttachedEditWindow Property プロパティを設定することで、InkEdit コントロール IDC_EDIT3 のウィンドウハンドルにアタッチします。さらに、ITextInputPanel::PreferredInPlaceDirection Property を設定してから取得します。
if (SUCCEEDED(CoInitialize(NULL)))
{
if (SUCCEEDED(CoCreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC, IID_ITextInputPanel, (VOID**)&g_pTip)))
{
if (SUCCEEDED(g_pTip->put_AttachedEditWindow(GetDlgItem(IDC_EDIT3)->m_hWnd)))
{
g_pTip->put_DefaultInPlaceState(InPlaceState_Expanded);
InPlaceState ips;
g_pTip->get_DefaultInPlaceState(&ips);
TRACE("DefaultInplaceState: %d\n", ips);
g_pTip->put_DefaultInputArea(PanelInputArea_CharacterPad);
PanelInputArea pia;
g_pTip->get_DefaultInputArea(&pia);
TRACE("DefaultInputArea: %d\n", pia);
g_pTip->put_ExpandPostInsertionCorrection(FALSE);
BOOL epic;
g_pTip->get_ExpandPostInsertionCorrection(&epic);
TRACE("ExpandPostInsertionCorrection: %d\n", epic);
g_pTip->put_InPlaceVisibleOnFocus(TRUE);
BOOL ipvof;
g_pTip->get_InPlaceVisibleOnFocus(&ipvof);
TRACE("InPlaceVisibleOnFocus: %d\n", ipvof);
g_pTip->put_PreferredInPlaceDirection(InPlaceDirection_Top);
InPlaceDirection direction;
g_pTip->get_PreferredInPlaceDirection(&direction);
TRACE("PreferredInPlaceDirection: %d\n", direction);
}
}
else
{
TRACE("Failed to create ITextInputPanel object.\n");
}
}
Tablet PC 入力パネルの修正コームを自動的に展開するかどうかを示す値を取得または設定します。(Get)
| Expand | BOOL* | out | 挿入後の訂正領域を展開するかどうかを受け取る出力ポインタである。TRUE で展開する。 |
解説(Remarks)
例
この C++ の例では、ITextInputPanel オブジェクト g_pTip を作成し、ITextInputPanel::AttachedEditWindow Property プロパティを設定することで、InkEdit コントロール IDC_EDIT3 のウィンドウハンドルにアタッチします。さらに、ITextInputPanel::ExpandPostInsertionCorrection Property を設定してから取得します。
if (SUCCEEDED(CoInitialize(NULL)))
{
if (SUCCEEDED(CoCreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC, IID_ITextInputPanel, (VOID**)&g_pTip)))
{
if (SUCCEEDED(g_pTip->put_AttachedEditWindow(GetDlgItem(IDC_EDIT3)->m_hWnd)))
{
g_pTip->put_DefaultInPlaceState(InPlaceState_Expanded);
InPlaceState ips;
g_pTip->get_DefaultInPlaceState(&ips);
TRACE("DefaultInplaceState: %d\n", ips);
g_pTip->put_DefaultInputArea(PanelInputArea_CharacterPad);
PanelInputArea pia;
g_pTip->get_DefaultInputArea(&pia);
TRACE("DefaultInputArea: %d\n", pia);
g_pTip->put_ExpandPostInsertionCorrection(FALSE);
BOOL epic;
g_pTip->get_ExpandPostInsertionCorrection(&epic);
TRACE("ExpandPostInsertionCorrection: %d\n", epic);
g_pTip->put_InPlaceVisibleOnFocus(TRUE);
BOOL ipvof;
g_pTip->get_InPlaceVisibleOnFocus(&ipvof);
TRACE("InPlaceVisibleOnFocus: %d\n", ipvof);
g_pTip->put_PreferredInPlaceDirection(InPlaceDirection_Top);
InPlaceDirection direction;
g_pTip->get_PreferredInPlaceDirection(&direction);
TRACE("PreferredInPlaceDirection: %d\n", direction);
}
}
else
{
TRACE("Failed to create ITextInputPanel object.\n");
}
}
Tablet PC 入力パネルの修正コームを自動的に展開するかどうかを示す値を取得または設定します。(Put)
| Expand | BOOL | in | 挿入後の訂正領域を展開するかどうかを指定する。TRUE で展開する。 |
解説(Remarks)
例
この C++ の例では、ITextInputPanel オブジェクト g_pTip を作成し、ITextInputPanel::AttachedEditWindow Property プロパティを設定することで、InkEdit コントロール IDC_EDIT3 のウィンドウハンドルにアタッチします。さらに、ITextInputPanel::ExpandPostInsertionCorrection Property を設定してから取得します。
if (SUCCEEDED(CoInitialize(NULL)))
{
if (SUCCEEDED(CoCreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC, IID_ITextInputPanel, (VOID**)&g_pTip)))
{
if (SUCCEEDED(g_pTip->put_AttachedEditWindow(GetDlgItem(IDC_EDIT3)->m_hWnd)))
{
g_pTip->put_DefaultInPlaceState(InPlaceState_Expanded);
InPlaceState ips;
g_pTip->get_DefaultInPlaceState(&ips);
TRACE("DefaultInplaceState: %d\n", ips);
g_pTip->put_DefaultInputArea(PanelInputArea_CharacterPad);
PanelInputArea pia;
g_pTip->get_DefaultInputArea(&pia);
TRACE("DefaultInputArea: %d\n", pia);
g_pTip->put_ExpandPostInsertionCorrection(FALSE);
BOOL epic;
g_pTip->get_ExpandPostInsertionCorrection(&epic);
TRACE("ExpandPostInsertionCorrection: %d\n", epic);
g_pTip->put_InPlaceVisibleOnFocus(TRUE);
BOOL ipvof;
g_pTip->get_InPlaceVisibleOnFocus(&ipvof);
TRACE("InPlaceVisibleOnFocus: %d\n", ipvof);
g_pTip->put_PreferredInPlaceDirection(InPlaceDirection_Top);
InPlaceDirection direction;
g_pTip->get_PreferredInPlaceDirection(&direction);
TRACE("PreferredInPlaceDirection: %d\n", direction);
}
}
else
{
TRACE("Failed to create ITextInputPanel object.\n");
}
}
アタッチされているウィンドウがフォーカスを受け取ったときに、Tablet PC 入力パネルを自動的に表示するかどうかを示す値を取得または設定します。(Get)
| Visible | BOOL* | out | フォーカス取得時にインプレース入力パネルを自動表示するかどうかを受け取る出力ポインタである。 |
解説(Remarks)
コントロールに対して ITextInputPanel::InPlaceVisibleOnFocus Property が TRUE に設定されている場合、そのコントロールがフォーカスを得たときに、その操作が許可されていれば、Tablet PC 入力パネルは既定の InPlaceState Enumeration の状態で自動的に表示されます。
ITextInputPanel::InPlaceVisibleOnFocus Property を FALSE に設定すると、インプレース入力パネルと入力パネルアイコンが一切表示されないようにできます。TRUE に設定すると、ユーザーまたはグループポリシーによって無効化されていない限り、可能な場合に表示するというシステムの既定に戻ります。このオプションは、入力パネルの代わりに独自のテキスト入力手段を備えるアプリケーションで役立ちます。
既定値は TRUE です。
例
この C++ の例では、ITextInputPanel オブジェクト g_pTip を作成し、ITextInputPanel::AttachedEditWindow Property プロパティを設定することで、InkEdit コントロール IDC_EDIT3 のウィンドウハンドルにアタッチします。さらに、 ITextInputPanel::InPlaceVisibleOnFocus Property を設定してから取得します。
if (SUCCEEDED(CoInitialize(NULL)))
{
if (SUCCEEDED(CoCreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC, IID_ITextInputPanel, (VOID**)&g_pTip)))
{
if (SUCCEEDED(g_pTip->put_AttachedEditWindow(GetDlgItem(IDC_EDIT3)->m_hWnd)))
{
g_pTip->put_DefaultInPlaceState(InPlaceState_Expanded);
InPlaceState ips;
g_pTip->get_DefaultInPlaceState(&ips);
TRACE("DefaultInplaceState: %d\n", ips);
g_pTip->put_DefaultInputArea(PanelInputArea_CharacterPad);
PanelInputArea pia;
g_pTip->get_DefaultInputArea(&pia);
TRACE("DefaultInputArea: %d\n", pia);
g_pTip->put_ExpandPostInsertionCorrection(FALSE);
BOOL epic;
g_pTip->get_ExpandPostInsertionCorrection(&epic);
TRACE("ExpandPostInsertionCorrection: %d\n", epic);
g_pTip->put_InPlaceVisibleOnFocus(TRUE);
BOOL ipvof;
g_pTip->get_InPlaceVisibleOnFocus(&ipvof);
TRACE("InPlaceVisibleOnFocus: %d\n", ipvof);
g_pTip->put_PreferredInPlaceDirection(InPlaceDirection_Top);
InPlaceDirection direction;
g_pTip->get_PreferredInPlaceDirection(&direction);
TRACE("PreferredInPlaceDirection: %d\n", direction);
}
}
else
{
TRACE("Failed to create ITextInputPanel object.\n");
}
}
アタッチされているウィンドウがフォーカスを受け取ったときに、Tablet PC 入力パネルを自動的に表示するかどうかを示す値を取得または設定します。(Put)
| Visible | BOOL | in | フォーカス取得時にインプレース入力パネルを自動表示するかどうかを指定する。 |
解説(Remarks)
コントロールに対して ITextInputPanel::InPlaceVisibleOnFocus Property が TRUE に設定されている場合、そのコントロールがフォーカスを得たときに、その操作が許可されていれば、Tablet PC 入力パネルは既定の InPlaceState Enumeration の状態で自動的に表示されます。
ITextInputPanel::InPlaceVisibleOnFocus Property を FALSE に設定すると、インプレース入力パネルと入力パネルアイコンが一切表示されないようにできます。TRUE に設定すると、ユーザーまたはグループポリシーによって無効化されていない限り、可能な場合に表示するというシステムの既定に戻ります。このオプションは、入力パネルの代わりに独自のテキスト入力手段を備えるアプリケーションで役立ちます。
既定値は TRUE です。
例
この C++ の例では、ITextInputPanel オブジェクト g_pTip を作成し、ITextInputPanel::AttachedEditWindow Property プロパティを設定することで、InkEdit コントロール IDC_EDIT3 のウィンドウハンドルにアタッチします。さらに、 ITextInputPanel::InPlaceVisibleOnFocus Property を設定してから取得します。
if (SUCCEEDED(CoInitialize(NULL)))
{
if (SUCCEEDED(CoCreateInstance(CLSID_TextInputPanel, NULL, CLSCTX_INPROC, IID_ITextInputPanel, (VOID**)&g_pTip)))
{
if (SUCCEEDED(g_pTip->put_AttachedEditWindow(GetDlgItem(IDC_EDIT3)->m_hWnd)))
{
g_pTip->put_DefaultInPlaceState(InPlaceState_Expanded);
InPlaceState ips;
g_pTip->get_DefaultInPlaceState(&ips);
TRACE("DefaultInplaceState: %d\n", ips);
g_pTip->put_DefaultInputArea(PanelInputArea_CharacterPad);
PanelInputArea pia;
g_pTip->get_DefaultInputArea(&pia);
TRACE("DefaultInputArea: %d\n", pia);
g_pTip->put_ExpandPostInsertionCorrection(FALSE);
BOOL epic;
g_pTip->get_ExpandPostInsertionCorrection(&epic);
TRACE("ExpandPostInsertionCorrection: %d\n", epic);
g_pTip->put_InPlaceVisibleOnFocus(TRUE);
BOOL ipvof;
g_pTip->get_InPlaceVisibleOnFocus(&ipvof);
TRACE("InPlaceVisibleOnFocus: %d\n", ipvof);
g_pTip->put_PreferredInPlaceDirection(InPlaceDirection_Top);
InPlaceDirection direction;
g_pTip->get_PreferredInPlaceDirection(&direction);
TRACE("PreferredInPlaceDirection: %d\n", direction);
}
}
else
{
TRACE("Failed to create ITextInputPanel object.\n");
}
}
Tablet PC 入力パネルの境界矩形を取得します。
| BoundingRectangle | RECT* | out | インプレース入力パネルの境界矩形(画面座標)を受け取る出力ポインタである。 |
解説(Remarks)
手書きパッドまたは文字パッドがアクティブな場合、インプレース入力パネルの境界矩形には [挿入] ボタンの高さが含まれます。境界矩形に修正コームの高さは含まれません。インプレース入力パネルが自動的に拡大すると、ITextInputPanelEventSink::InPlaceSizeChanging Method/ITextInputPanelEventSink::InPlaceSizeChanged Method のイベントの組が発生し、このプロパティの値は追加された書き込み領域または書き込み行を含むように更新されます。
例
この C++ の例では、Edit コントロール IDC_EDIT3 の EN_SETFOCUS イベントハンドラーを実装します。まず、ITextInputPanel オブジェクト g_pTip が作成済みかどうかを確認します。存在する場合は、TRACE マクロを使用して、いくつかの ITextInputPanel Interface プロパティの値をデバッグ出力に報告します。
void CCOMTIPDlg::OnEnSetFocusEdit3()
{
if (NULL != g_pTip)
{
CorrectionMode mode;
if (SUCCEEDED(g_pTip->get_CurrentCorrectionMode(&mode)))
{
TRACE("CurrentCorrectionMode: %d\n", mode);
}
InPlaceState state;
if (SUCCEEDED(g_pTip->get_CurrentInPlaceState(&state)))
{
TRACE("CurrentInPlaceState: %d\n", state);
}
PanelInputArea area;
if (SUCCEEDED(g_pTip->get_CurrentInputArea(&area)))
{
TRACE("CurrentInputArea: %d\n", area);
}
InteractionMode iMode;
if (SUCCEEDED(g_pTip->get_CurrentInteractionMode(&iMode)))
{
TRACE("CurrentInteractionMode: %d\n", iMode);
}
RECT rect;
if (SUCCEEDED(g_pTip->get_InPlaceBoundingRectangle(&rect)))
{
TRACE("InPlaceBoundingRectangle.top: %d\n", rect.top);
TRACE("InPlaceBoundingRectangle.left: %d\n", rect.left);
TRACE("InPlaceBoundingRectangle.bottom: %d\n", rect.bottom);
TRACE("InPlaceBoundingRectangle.right: %d\n", rect.right);
}
int nHeight;
if (SUCCEEDED(g_pTip->get_PopDownCorrectionHeight(&nHeight)))
{
TRACE("PopDownCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->get_PopUpCorrectionHeight(&nHeight)))
{
TRACE("PopUpCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->SetInPlacePosition(300, 300, CorrectionPosition_Bottom)))
{
TRACE("Call to SetInPlacePosition() succeeded.\n");
}
else
{
TRACE("Call to SetInPlacePosition() failed.\n");
}
}
else
{
TRACE("ITextInputPanel object is NULL.\n");
}
}
挿入後修正コームが入力パネルの上に配置されるときの高さを取得します。
| Height | INT* | out | 上方向にポップアップする訂正領域の高さ(ピクセル単位)を受け取る出力ポインタである。 |
解説(Remarks)
例
この C++ の例では、Edit コントロール IDC_EDIT3 の EN_SETFOCUS イベントハンドラーを実装します。まず、ITextInputPanel オブジェクト g_pTip が作成済みかどうかを確認します。存在する場合は、TRACE マクロを使用して、いくつかの ITextInputPanel Interface プロパティの値をデバッグ出力に報告します。
void CCOMTIPDlg::OnEnSetFocusEdit3()
{
if (NULL != g_pTip)
{
CorrectionMode mode;
if (SUCCEEDED(g_pTip->get_CurrentCorrectionMode(&mode)))
{
TRACE("CurrentCorrectionMode: %d\n", mode);
}
InPlaceState state;
if (SUCCEEDED(g_pTip->get_CurrentInPlaceState(&state)))
{
TRACE("CurrentInPlaceState: %d\n", state);
}
PanelInputArea area;
if (SUCCEEDED(g_pTip->get_CurrentInputArea(&area)))
{
TRACE("CurrentInputArea: %d\n", area);
}
InteractionMode iMode;
if (SUCCEEDED(g_pTip->get_CurrentInteractionMode(&iMode)))
{
TRACE("CurrentInteractionMode: %d\n", iMode);
}
RECT rect;
if (SUCCEEDED(g_pTip->get_InPlaceBoundingRectangle(&rect)))
{
TRACE("InPlaceBoundingRectangle.top: %d\n", rect.top);
TRACE("InPlaceBoundingRectangle.left: %d\n", rect.left);
TRACE("InPlaceBoundingRectangle.bottom: %d\n", rect.bottom);
TRACE("InPlaceBoundingRectangle.right: %d\n", rect.right);
}
int nHeight;
if (SUCCEEDED(g_pTip->get_PopDownCorrectionHeight(&nHeight)))
{
TRACE("PopDownCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->get_PopUpCorrectionHeight(&nHeight)))
{
TRACE("PopUpCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->SetInPlacePosition(300, 300, CorrectionPosition_Bottom)))
{
TRACE("Call to SetInPlacePosition() succeeded.\n");
}
else
{
TRACE("Call to SetInPlacePosition() failed.\n");
}
}
else
{
TRACE("ITextInputPanel object is NULL.\n");
}
}
挿入後修正コームが入力パネルの下に配置されるときの高さを取得します。
| Height | INT* | out | 下方向にポップダウンする訂正領域の高さ(ピクセル単位)を受け取る出力ポインタである。 |
解説(Remarks)
例
この C++ の例では、Edit コントロール IDC_EDIT3 の EN_SETFOCUS イベントハンドラーを実装します。まず、ITextInputPanel オブジェクト g_pTip が作成済みかどうかを確認します。存在する場合は、TRACE マクロを使用して、いくつかの ITextInputPanel Interface プロパティの値をデバッグ出力に報告します。
void CCOMTIPDlg::OnEnSetFocusEdit3()
{
if (NULL != g_pTip)
{
CorrectionMode mode;
if (SUCCEEDED(g_pTip->get_CurrentCorrectionMode(&mode)))
{
TRACE("CurrentCorrectionMode: %d\n", mode);
}
InPlaceState state;
if (SUCCEEDED(g_pTip->get_CurrentInPlaceState(&state)))
{
TRACE("CurrentInPlaceState: %d\n", state);
}
PanelInputArea area;
if (SUCCEEDED(g_pTip->get_CurrentInputArea(&area)))
{
TRACE("CurrentInputArea: %d\n", area);
}
InteractionMode iMode;
if (SUCCEEDED(g_pTip->get_CurrentInteractionMode(&iMode)))
{
TRACE("CurrentInteractionMode: %d\n", iMode);
}
RECT rect;
if (SUCCEEDED(g_pTip->get_InPlaceBoundingRectangle(&rect)))
{
TRACE("InPlaceBoundingRectangle.top: %d\n", rect.top);
TRACE("InPlaceBoundingRectangle.left: %d\n", rect.left);
TRACE("InPlaceBoundingRectangle.bottom: %d\n", rect.bottom);
TRACE("InPlaceBoundingRectangle.right: %d\n", rect.right);
}
int nHeight;
if (SUCCEEDED(g_pTip->get_PopDownCorrectionHeight(&nHeight)))
{
TRACE("PopDownCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->get_PopUpCorrectionHeight(&nHeight)))
{
TRACE("PopUpCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->SetInPlacePosition(300, 300, CorrectionPosition_Bottom)))
{
TRACE("Call to SetInPlacePosition() succeeded.\n");
}
else
{
TRACE("Call to SetInPlacePosition() failed.\n");
}
}
else
{
TRACE("ITextInputPanel object is NULL.\n");
}
}
収集したインクを認識エンジンに送信し、認識結果をポストします。
戻り値
このメソッドは、次のいずれかの値を返します。
| 戻り値 | 説明 |
|---|---|
| 成功しました。 | |
| パラメーターまたはプロパティの型が想定外です。 | |
| 不明なエラーが発生しました。 |
解説(Remarks)
認識結果は、ITextInputPanel オブジェクトがアタッチされているコントロールに送信されます。
Tablet PC 入力パネルを表示または非表示にします。
| Visible | BOOL | in | 入力パネルを表示する場合は TRUE、非表示にする場合は FALSE を指定します。 |
戻り値
入力パネルを表示できる場合、このメソッドは S_OK を返します。それ以外の場合は E_FAIL を返します。ITextInputPanel::SetInPlaceVisibility Method が入力パネルに影響を与えられる場合と与えられない場合の詳細については、「解説」を参照してください。
| 戻り値 | 説明 |
|---|---|
| 成功しました。 | |
| 不明なエラーが発生しました。 |
解説(Remarks)
入力パネルは、ITextInputPanel::CurrentInPlaceState Property プロパティで指定された状態で表示されます。
Visible パラメーターに TRUE を指定して ITextInputPanel::SetInPlaceVisibility Method を呼び出しても、入力パネルが既に表示されている場合は失敗します。
ユーザーが入力パネルのオプションダイアログでインプレースモードを無効にしている場合、ITextInputPanel::SetInPlaceVisibility Method の呼び出しは失敗します。
表示状態が変化した時点で入力パネルに残っているインクは、自動的に挿入されます。
このメソッドは ITextInputPanel::InPlaceVisibleOnFocus Property の値を変更しません。次にフォーカスが変化すると、動作は ITextInputPanel::InPlaceVisibleOnFocus Property で指定された動作に戻ります。
ITextInputPanel::SetInPlaceVisibility Method は同期呼び出しです。呼び出しが戻る前に入力パネルの表示状態が変更されます。
例
この C++ の例では、Edit コントロール IDC_EDIT1 の EN_SETFOCUS イベントハンドラーを実装します。まず、ITextInputPanel オブジェクト g_pTip が作成済みかどうかを確認します。存在する場合は、Visible パラメーターに false を指定して ITextInputPanel::SetInPlaceVisibility Method を呼び出し、入力パネルが表示されないようにします。
void CCOMTIPDlg::OnEnSetfocusEdit1()
{
if (NULL != g_pTip)
{
if (SUCCEEDED(g_pTip->SetInPlaceVisibility(false)))
{
TRACE("Successfully hid the Input Panel.\n");
}
}
}
Tablet PC 入力パネルの位置を画面座標で明示的に指定します。
| xPosition | INT | in | 修正コームが表示されていない状態での、入力パネルの左上隅の水平方向 (x) 座標。 |
| yPosition | INT | in | 修正コームが表示されていない状態での、入力パネルの左上隅の垂直方向 (y) 座標。 |
| position | CorrectionPosition | in | 挿入後修正コームがポップアップする方向。CorrectionPosition 列挙型で定義されます。 |
戻り値
入力パネルが開いていて (ドッキングまたはフローティング) 移動できない場合は false を返します。それ以外の場合は true を返します。
| 戻り値 | 説明 |
|---|---|
| 成功しました。 | |
| 不明なエラーが発生しました。 |
解説(Remarks)
入力パネルを配置できる位置に制限はありません。入力パネルが画面外に出ないようにするのは、アプリケーション開発者の責任です。この目的には、ITextInputPanel::InPlaceBoundingRectangle Property、ITextInputPanel::PopUpCorrectionHeight Property、ITextInputPanel::PopDownCorrectionHeight Property と ITextInputPanelEventSink::InPlaceSizeChanging Method を使用できます。
このメソッドは同期的です。メソッドが戻る前に配置が行われます。
例
この C++ の例では、Edit コントロール IDC_EDIT3 の EN_SETFOCUS イベントハンドラーを実装します。まず、ITextInputPanel オブジェクト g_pTip が作成済みかどうかを確認します。存在する場合は、TRACE マクロを使用して、いくつかの ITextInputPanel Interface プロパティの値をデバッグ出力に報告します。さらに、ITextInputPanel::SetInPlacePosition Method を呼び出して入力パネルの位置を設定します。
void CCOMTIPDlg::OnEnSetFocusEdit3()
{
if (NULL != g_pTip)
{
CorrectionMode mode;
if (SUCCEEDED(g_pTip->get_CurrentCorrectionMode(&mode)))
{
TRACE("CurrentCorrectionMode: %d\n", mode);
}
InPlaceState state;
if (SUCCEEDED(g_pTip->get_CurrentInPlaceState(&state)))
{
TRACE("CurrentInPlaceState: %d\n", state);
}
PanelInputArea area;
if (SUCCEEDED(g_pTip->get_CurrentInputArea(&area)))
{
TRACE("CurrentInputArea: %d\n", area);
}
InteractionMode iMode;
if (SUCCEEDED(g_pTip->get_CurrentInteractionMode(&iMode)))
{
TRACE("CurrentInteractionMode: %d\n", iMode);
}
RECT rect;
if (SUCCEEDED(g_pTip->get_InPlaceBoundingRectangle(&rect)))
{
TRACE("InPlaceBoundingRectangle.top: %d\n", rect.top);
TRACE("InPlaceBoundingRectangle.left: %d\n", rect.left);
TRACE("InPlaceBoundingRectangle.bottom: %d\n", rect.bottom);
TRACE("InPlaceBoundingRectangle.right: %d\n", rect.right);
}
int nHeight;
if (SUCCEEDED(g_pTip->get_PopDownCorrectionHeight(&nHeight)))
{
TRACE("PopDownCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->get_PopUpCorrectionHeight(&nHeight)))
{
TRACE("PopUpCorrectionHeight: %d\n", nHeight);
}
if (SUCCEEDED(g_pTip->SetInPlacePosition(300, 300, CorrectionPosition_Bottom)))
{
TRACE("Call to SetInPlacePosition() succeeded.\n");
}
else
{
TRACE("Call to SetInPlacePosition() failed.\n");
}
}
else
{
TRACE("ITextInputPanel object is NULL.\n");
}
}
Tablet PC 入力パネルのホバーターゲットの位置を画面座標で明示的に指定します。
| xPosition | INT | in | 修正コームが表示されていない状態での、ホバーターゲットの左上隅の水平方向 (x) 座標。 |
| yPosition | INT | in | 修正コームが表示されていない状態での、ホバーターゲットの左上隅の垂直方向 (y) 座標。 |
戻り値
解説(Remarks)
ホバーターゲットを配置できる位置に制限はありません。ホバーターゲットが画面内に収まるようにするのは、アプリケーションの責任です。
SetInPlaceHoverTargetPosition メソッドは同期的です。メソッドが戻る前に配置が行われます。
例
この C++ の例では、Edit コントロール IDC_EDIT2 の EN_SETFOCUS イベントハンドラーを実装します。まず、ITextInputPanel オブジェクト g_pTip が作成済みかどうかを確認します。存在する場合は、ITextInputPanel::SetInPlaceHoverTargetPosition Method を呼び出して入力パネルのホバーターゲットの位置を設定します。その後、TRACE マクロを使用して、呼び出しが成功したかどうかをデバッグ出力に報告します。
void CCOMTIPDlg::OnEnSetfocusEdit2()
{
if (NULL != g_pTip)
{
if (SUCCEEDED(g_pTip->SetInPlaceHoverTargetPosition(300, 300)))
{
TRACE("Call to SetInPlaceHoverTargetPosition() succeeded.\n");
}
else
{
TRACE("Call to SetInPlaceHoverTargetPosition() failed.\n");
}
}
else
{
TRACE("ITextInputPanel object is NULL.\n");
}
}
Tablet PC 入力パネルと、指定されたシンクオブジェクトとの間にアドバイザリ接続を確立します。
| EventSink | ITextInputPanelEventSink* | inoptional | 入力パネルからイベント通知を受け取るシンクオブジェクトへの参照。 |
| EventMask | DWORD | in | 対象とするイベントを示す EventMask Enumeration のビット単位の値。 |
戻り値
ITextInputPanel::Advise Method によって以前に確立されたアドバイザリ接続を終了します。
| EventSink | ITextInputPanelEventSink* | inoptional | 現在、入力パネルからイベント通知を受け取っているシンクオブジェクトへの参照。 |
戻り値
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
HSP用 COM定義
#usecom / #comfunc によるHSPのCOM呼び出し定義。数字は vtbl インデックス(0始まり)。クラスIDが無い場合 #usecom の末尾は "{}"、ある場合は "{CLSID}"。
#define global IID_ITextInputPanel "{6B6A65A5-6AF3-46C2-B6EA-56CD1F80DF71}" #usecom global ITextInputPanel IID_ITextInputPanel "{F9B189D7-228B-4F2B-8650-B97F59E02C8C}" #comfunc global ITextInputPanel_get_AttachedEditWindow 3 sptr #comfunc global ITextInputPanel_put_AttachedEditWindow 4 sptr #comfunc global ITextInputPanel_get_CurrentInteractionMode 5 var #comfunc global ITextInputPanel_get_DefaultInPlaceState 6 var #comfunc global ITextInputPanel_put_DefaultInPlaceState 7 int #comfunc global ITextInputPanel_get_CurrentInPlaceState 8 var #comfunc global ITextInputPanel_get_DefaultInputArea 9 var #comfunc global ITextInputPanel_put_DefaultInputArea 10 int #comfunc global ITextInputPanel_get_CurrentInputArea 11 var #comfunc global ITextInputPanel_get_CurrentCorrectionMode 12 var #comfunc global ITextInputPanel_get_PreferredInPlaceDirection 13 var #comfunc global ITextInputPanel_put_PreferredInPlaceDirection 14 int #comfunc global ITextInputPanel_get_ExpandPostInsertionCorrection 15 var #comfunc global ITextInputPanel_put_ExpandPostInsertionCorrection 16 int #comfunc global ITextInputPanel_get_InPlaceVisibleOnFocus 17 var #comfunc global ITextInputPanel_put_InPlaceVisibleOnFocus 18 int #comfunc global ITextInputPanel_get_InPlaceBoundingRectangle 19 var #comfunc global ITextInputPanel_get_PopUpCorrectionHeight 20 var #comfunc global ITextInputPanel_get_PopDownCorrectionHeight 21 var #comfunc global ITextInputPanel_CommitPendingInput 22 #comfunc global ITextInputPanel_SetInPlaceVisibility 23 int #comfunc global ITextInputPanel_SetInPlacePosition 24 int,int,int #comfunc global ITextInputPanel_SetInPlaceHoverTargetPosition 25 int,int #comfunc global ITextInputPanel_Advise 26 sptr,int #comfunc global ITextInputPanel_Unadvise 27 sptr ; ※数字は vtbl インデックス(0始まり)。0/1/2 は IUnknown(QueryInterface/AddRef/Release)。 ; ※#usecom 末尾は CoCreateInstance 用のクラスID(コクラスCLSID, SDKから自動取得)。 ; ※出力/バッファ引数は var(変数直渡し)。varptr 方式にも切替可。 ; ※ハンドル/void*等の不透明ポインタは IronHSP では intptr 指定が可能。#define global IID_ITextInputPanel "{6B6A65A5-6AF3-46C2-B6EA-56CD1F80DF71}" #usecom global ITextInputPanel IID_ITextInputPanel "{F9B189D7-228B-4F2B-8650-B97F59E02C8C}" #comfunc global ITextInputPanel_get_AttachedEditWindow 3 sptr #comfunc global ITextInputPanel_put_AttachedEditWindow 4 sptr #comfunc global ITextInputPanel_get_CurrentInteractionMode 5 sptr #comfunc global ITextInputPanel_get_DefaultInPlaceState 6 sptr #comfunc global ITextInputPanel_put_DefaultInPlaceState 7 int #comfunc global ITextInputPanel_get_CurrentInPlaceState 8 sptr #comfunc global ITextInputPanel_get_DefaultInputArea 9 sptr #comfunc global ITextInputPanel_put_DefaultInputArea 10 int #comfunc global ITextInputPanel_get_CurrentInputArea 11 sptr #comfunc global ITextInputPanel_get_CurrentCorrectionMode 12 sptr #comfunc global ITextInputPanel_get_PreferredInPlaceDirection 13 sptr #comfunc global ITextInputPanel_put_PreferredInPlaceDirection 14 int #comfunc global ITextInputPanel_get_ExpandPostInsertionCorrection 15 sptr #comfunc global ITextInputPanel_put_ExpandPostInsertionCorrection 16 int #comfunc global ITextInputPanel_get_InPlaceVisibleOnFocus 17 sptr #comfunc global ITextInputPanel_put_InPlaceVisibleOnFocus 18 int #comfunc global ITextInputPanel_get_InPlaceBoundingRectangle 19 sptr #comfunc global ITextInputPanel_get_PopUpCorrectionHeight 20 sptr #comfunc global ITextInputPanel_get_PopDownCorrectionHeight 21 sptr #comfunc global ITextInputPanel_CommitPendingInput 22 #comfunc global ITextInputPanel_SetInPlaceVisibility 23 int #comfunc global ITextInputPanel_SetInPlacePosition 24 int,int,int #comfunc global ITextInputPanel_SetInPlaceHoverTargetPosition 25 int,int #comfunc global ITextInputPanel_Advise 26 sptr,int #comfunc global ITextInputPanel_Unadvise 27 sptr ; ※数字は vtbl インデックス(0始まり)。0/1/2 は IUnknown(QueryInterface/AddRef/Release)。 ; ※#usecom 末尾は CoCreateInstance 用のクラスID(コクラスCLSID, SDKから自動取得)。 ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。 ; ※ハンドル/void*等の不透明ポインタは IronHSP では intptr 指定が可能。