Bug表现:
用XE3 FireMonkey写的带有输入框(TEdit、TMemo等等)的程序,在64位系统下运行并且调用32位输入法的时候,均无法输入任何中文信息,而原生的64位输入法就没问题。
我测试了XE3 Update1、Update2都有这个Bug。
调试了半个小时,发现问题出在FMX.Platform.Win.pas这个函数:WMImeComposition
函数最后有这样几行
//Pressed ESC if (AForm.Focused <> nil) and Supports(AForm.Focused, ITextServiceControl, TSObj) then TTextServiceWin(TSObj.GetTextService).InternalBreakIMEInput; Result := DefWindowProc(Wnd, uMsg, wParam, lParam);
调试时发现,32位输入法在输入中文之后触发这个函数调用,到这里wParam和lParam都是0,这时候就会执行上述代码。从代码注释看,本意是按ESC才会到这里来。但是经我实际测试,其实你就算把ESC按到爆也是不会触发这段代码的。
所以,修正办法很简单,只要注释掉这两行就行了:
if (AForm.Focused <> nil) and Supports(AForm.Focused, ITextServiceControl, TSObj) then TTextServiceWin(TSObj.GetTextService).InternalBreakIMEInput;
地址:http://bbs.2ccc.com/topic.asp?topicid=423002
作者:souledge