Search
Active

18
Sign in to vote
0
Sign in to vote
Sign in
to vote
Type: Bug
ID: 332165
Opened: 3/8/2008 2:28:43 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
WPF でのテキスト入力は TSF ( Text Services Framework ) 経由で行われます。
IME を利用して日本語を入力する際には、 変換候補を変えるごとに、 テキストボックスで TextChanged イベントが発生します。 テキストボックスは、 TextChanged イベントで Maxlength のチェックをします。
つまり、 IME での変換中であっても、 Maxlength のチェックが行われます。 そのため、 たとえば Maxlength = 3 に設定したテキストボックスに、 「日本語」 (3文字) と入力することができません。

また、 IME の候補ウィンドウが出た状態で、 変換候補を次々と変えていく途中で、 Maxlength を超える長さの候補文字列が選択状態になると、 IME の候補ウィンドウを閉じることができなくなったり、 逆に、 選択状態になった瞬間に閉じてしまったりします。

この挙動のため、 テキストボックスの Maxlength プロパティは、 事実上、 利用できなくなっています。 ( 数字のみの入力であっても、 IME を ON にしたまま変換して数字を出す、 というユーザもいらっしゃいます。 )

関連情報: MSDN フォーラム
・ TextBox.MaxLengthプロパティの設定でおかしくなる。
http://forums.microsoft.com/msdn-ja/ShowPost.aspx?PostID=964243&SiteID=7
・ IME で文字列を確定させたことが分からない (Re: TextBoxで入力にフィルターをしたい。)
http://forums.microsoft.com/msdn-ja/ShowPost.aspx?PostID=659810&SiteID=7
Details (expand)
製品言語
日本語
バージョン
.NET Framework 3.0
オペレーティング システム
Vista
オペレーティング システム言語
日本語
再現の手順
1. Visual Studio 2008 (RTM) を使用して、 WPF のプロジェクトを作成します。
2. WPF のデザイナ画面で、 テキストボックスを一つ配置し、 Maxlength プロパティに 3 を設定します。
3. ビルドして、 実行します。
4. 次の操作を行います。
CASE: A
1) テキストボックスにフォーカスを当て、 入力状態にします。
2) IME を ON にします。
3) キー入力: NIHONGO
CASE: B
1) テキストボックスにフォーカスを当て、 入力状態にします。
2) IME を ON にします。
3) キー入力: 123
4) 変換キーを (IME 2007 の場合) 2回押して、 変換候補ウィンドウを表示させます。
※ このとき、 候補 "一二三" (3文字) よりも、 候補 "百二十三" (4文字) が上にあることが条件です。 そうなっていないときは、 何回か学習させて表示順を変えてください。
5) 候補 "一二三" (3文字) を選択するために、 下向き矢印キーを何回か押します。 ( その途中で、 候補 "百二十三" (4文字) を選択した状態を経過します。 )
6) 候補 "一二三" (3文字) を選択している状態で、 変換を確定するために、 Enter キーを押します。
実際の結果
CASE: A
3) キーを NIHONG まで打ったところで、 IME が OFF になり、 テキストボックスの文字列は "にほn" になる。
CASE: B
6) Enter キーを押しても、 IME の候補ウィンドウが閉じない。
OR
5) 候補 "百二十三" (4文字) が選択された状態になると、 IME の候補ウィンドウが閉じてしまう。
※ どちらも、 Office 2007 の IME を使用。
※ 必ず 5) か 6) かのどちらかになるようです。 もうしわけないのですが、 どういう条件で変わるかの切り分けはできていません。
期待した結果
CASE: A
3) キーを NIHONGO まで打ったところで、 テキストボックスの文字列が "にほんご" になっている。 その後、 何回か変換キーを押すと "日本語" になるので、 Enter キーで確定させる。
CASE: B
6) テキストボックスの文字列が "一二三" (3文字) になっている。
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 3/12/2008 at 1:10 AM
フィードバックをお送りいただきまして、ありがとうございます。いただいた報告内容に基づき、現在問題を調査中です。しばらくお待ちください。

Visual Studio Product Team

Problem Description:
In WPF, text input is via TSF ( Text Services Framework ).
When entering Japanese using IME, TextChanged event occurs every time change the conversion candidate.
TextBox checkes Maxlength in TextChanged event.
This means that Maxlength can be checked during converting in the IME.
For example, a Textbox whose Maxlength = 3 can not be entered "日本語"(3characters).

While IME window displays the conversion candidate, once a candidate which has longer string than Maxlength is
selected the IME conversion candidate window can not be closed or closes forcibly.

Repro Steps:
1.Create a WPF project in Visual Studio 2008 (RTM)
2.In design view, place a textbox and set its Maxlength property =3.
3.Build
4.Do the following:

CASE: A
1)Focus on the TextBox.
2)Set the IME on.
3)Enter "NIHONGO"

CASE: B
1)Focus on the TextBox.
2)Set the IME on.
3)Enter "123"
4)Press the modifier key(IME 2007) twice, the conversion candidate window is displayed.
*Note: the candidate "百二十三"(4characters) has to be above the candidate "一二三"(3characters),
if it is not, you have to change the order.
5)Press the down arrow key to select the candidate "一二三"(3characters).
(passing through "百二十三" )
6)Press the Enter key, selecting "一二三".

Actual Results:
CASE: A
3)The IME turns off at "NIHONG", the string in the textbox is "にほn".
CASE:B
6)Although pressing the Enter key, the conversion candidate window remains open .
OR
5)When the candidate "百二十三" is selected, IME candidate window closes automatically.
*Both cases occur in Office 2007 IME.
*Either 5) or 6) surely occurs. I am afraid that I am not sure what condition leads this.

Expected Results:
CASE: A
3)Type "NIHONGO", then the string in the TextBox "にほんご"(hiragana).
Press the modifier key several times, then select "日本語"(kanji) and press the Enter.
CASE: B
6)The string in the TextBox is "一二三".
Posted by Microsoft on 3/13/2008 at 1:10 AM
Thanks for your feedback.

We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution.
These specialized experts will follow-up with your issue.

Thank you,
Visual Studio Product Team
Posted by Microsoft on 3/13/2008 at 6:23 PM

フィードバックありがとうございます。
こちらの件はVisual Studio 開発チーム内の該当部門にエスカレーションし、引き続き直接の開発担当者が対応いたします。    

Visual Studio Product Team
Posted by biac on 9/29/2008 at 1:39 AM
.NET Framework 3.5 SP1 / Visual Studio 2008 SP1 が出荷されました。 しかしながら、 この現象については、 変化が無いようです。
なにか進展はありませんか?

また、 回避策は無いでしょうか? もし、 解決の予定も立っていず、 回避策も無いのであっても、 公式見解として KB に現象を載せていただけるとありがたいです。
※ 日本では、 Microsoft の公式のドキュメントに書かれていないかぎり、 開発者の説明を信用しないという風習があります。 ( そのような職場では、 いくら実証コードを書いて証明してもだめなのです。 その実証コードを検証できるスキルが、 管理者側にありませんので。 場合によっては、 その開発者の能力が低いと判定されてしまうことさえあります。 )

なお、 日本の業務アプリケーションでよく求められる仕様は、 つぎのようなものです。
* IME を使っていないとき: キー入力中に MaxLength に達した場合は、 次のキー入力を無効とし警告をだす。
* IME を使っているとき: IME で変換している間は、 MaxLength を越えても良い (というよりも、 越えられないと変換できないことがある)。 IME で変換を 「確定」 させた瞬間に、 MaxLength を超えていた場合は、 越えている部分を切り捨て ( 入力から取り除くとともに、 表示もしない )、 警告を出す。

TSF では、 IME で変換を 「確定」 したかどうかをアプリケーションで検出する手段も無いようですから、 けっきょくはこの仕様を実現することはできないでしょう。
この仕様は WPF では実装できない、 ということを MS の見解として表明していただきたいのです。 そうでないと、 これから WPF の業務アプリケーションに取り組む日本の開発者の全ては、 「不可能への挑戦」 を何度でも繰り返しやらされることになるでしょう。
Posted by Microsoft on 10/5/2008 at 11:13 PM

.NET Framework 3.5 SP1 and Visual Studio 2008 SP1 have been released. However, it seems no changes about this issue.
Is there any progress?

Or is there any workaround for this?
If there were neither solution plans nor workaound, putting this issue as Microsoft's official version on the KB would be grateful.

* This is customary for Japan. Developers' explanation cannot be accepted unless it is stated on the Microsoft's officical document.(In this situation, proven codes are useless because management staff do not have skills to verify the codes. So the developer's skill may be evaluated as being low in some cases.)
The followings are the necessary specification for Japanese business applications.
* When NOT using an IME: while entering keys when the MaxLength has been reached the next key pressing has to be invalid appearing the warning message.
* When using an IME: while converting the IME can be ignored (otherwise some are greater than MaxLength before converting). At the moment of the conversion is committed in IME, the exceeding MaxLength parts are truncated(truncate from the entering and no display), and display the warning.

In TSF, there is no way to detect “commit” or not using applications so this specification will be impossible to carry out.
I need the Microsoft official statement which states this specification cannot be implemented in WPF otherwise all Japanese developers working with WPF
in business applications have to challenge to “impossibilities” frequently.
Posted by Microsoft on 11/18/2008 at 12:42 PM
Dear Customer
We are currently working on a fixing this issue in our next release.
Posted by Microsoft on 11/19/2008 at 12:30 AM

こんにちは
この件は次のバージョンに向けて現在こちらで修正に取り組んでおります。
よろしくお願いします。
Posted by biac on 11/19/2008 at 7:37 AM
ありがとうございます。
次リリースを、 つまり .NET Framework 4.0 のことだと思いますが、 期待して待ちます。
Posted by Microsoft on 11/20/2008 at 1:25 AM
Thank you for your message.
"next release" - I think that means .NET Framework 4.0,
I look forward to having it.