void EditContext_SelectionUpdating(CoreTextEditContext sender, CoreTextSelectionUpdatingEventArgs args) { // Set the new selection to the value specified by the system. CoreTextRange range = args.Selection; // Update the selection of the edit context. There is no need to notify the system // because the system itself changed the selection. SetSelection(range); }
/* * テキストの選択位置の変化を通知してきた。 */ private void EditContext_SelectionUpdating(CoreTextEditContext sender, CoreTextSelectionUpdatingEventArgs ev) { Debug.WriteLine("<<--- SelectionUpdating: cancel:{0} result:{1} ({2},{3})", ev.IsCanceled, ev.Result, ev.Selection.StartCaretPosition, ev.Selection.EndCaretPosition ); // アプリ内で持っているテキストの選択位置を更新します。 SelOrigin = ev.Selection.StartCaretPosition; SelCurrent = ev.Selection.EndCaretPosition; }
void EditContext_SelectionUpdating(CoreTextEditContext sender, CoreTextSelectionUpdatingEventArgs args) { // Set the new selection to the value specified by the system. CoreTextRange range = args.Selection; // Update the selection of the edit context. There is no need to notify the system // because the system itself changed the selection. SetSelection(range); //var compStr = _inputBuffer; //compStr = compStr.Insert(_selection.StartCaretPosition, "|"); //Debug.WriteLine("composition text: {0}, cursor pos: {1}", (object)compStr, _selection.StartCaretPosition); OnTextComposition(_inputBuffer, _selection.StartCaretPosition); }
/* * テキストの選択位置の変化を通知してきた。 */ private void EditContext_SelectionUpdating(CoreTextEditContext sender, CoreTextSelectionUpdatingEventArgs ev) { Debug.WriteLine("<<--- SelectionUpdating: cancel:{0} result:{1} ({2},{3})", ev.IsCanceled, ev.Result, ev.Selection.StartCaretPosition, ev.Selection.EndCaretPosition ); // カーソルがあると文字の操作に邪魔なので、いったん取り除きます。 RemoveCursor(); // アプリ内で持っているテキストの選択位置を更新します。 Selection = ev.Selection; // カーソルを挿入します。 InsertCursor(); }