Problem: Firemonkey The original selected text after Edit & Memo Chinese input on Windows & MacOS Platform
Applicable version: Delphi 10.1.2 & 10.2.1
Post-correction effect:
Fix code:
Please place FMX. Edit.Style.pas Copy to your project directory, and then modify the following code:
proceduretstylededit.imestateupdated;varCombinedtext:string;beginCombinedtext:=Ftextservice.combinedtext; Ftextlayout.text:=Combinedtext; Setcaretposition (getorigincaretposition); Model.settextwithoutvalidation (Combinedtext); ifFprompt <>Nil Thenfprompt.visible:=Combinedtext.isempty;{+++>}{$IF Defined (IOS) or Defined (ANDROID)} //Add this line, correct the Chinese input will cancel the original selected text of the BUG by Aone (2017.11.17) ifModel.sellength >0 Then beginmodel.disablenotify; Trymodel.sellength:=0; finallymodel.enablenotify; End; Updateselectionpointpositions; End;{+++>}{$ENDIF} //Add this line, correct the Chinese input will cancel the original selected text of the BUG by Aone (2017.11.17)linkobserversvaluemodified (self.observers); dochangetracking; dotyping;End;
Please place FMX. Memo.Style.pas Copy to your project directory, and then modify the following code:
proceduretstyledmemo.imestateupdated;... Slightly... SelectionChanged:= fselectedor(Fselstart <> Lcaret)or(Fselend <>Lcaret); CaretPosition:=Lcaret;{+++>}{$IF Defined (IOS) or Defined (ANDROID)} //Add this line, correct the Chinese input will cancel the original selected text of the BUG by Aone (2017.11.17)Fselstart: =Lcaret; Fselected:=False; Fselend:=Fselstart; Updateselectioninmodel;{+++>}{$ENDIF} //Add this line, correct the Chinese input will cancel the original selected text of the BUG by Aone (2017.11.17) ifSelectionChanged Thenupdateselectionpointpositions; ifTextChanged Thenlinkobserversvaluemodified (self.observers); End;End;
Amended Firemonkey Windows & MacOS Platform Edit & Memo Chinese input will cancel the original selection of the text after the BUG