View Issue Details

IDProjectCategoryView StatusLast Update
0027976LazarusPatchpublic2015-05-25 14:12
ReporterDo-wan KimAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Platformx86OSWindowsOS Version7
Product Version1.5 (SVN)Product Build48874 
Target Version1.6Fixed in Version1.5 (SVN) 
Summary0027976: Enable grid editor at IME composition in Windows.
DescriptionIf CJK IME working in grid control, first key hit with IME composition don't show editor and shows composition window outside grid control or application.

Steps To Reproduce1. IME input with non-English input.
2. focus on grid.
3. input charater and IME is in composition mode. Grid control doesn't show editor until completed first IME composition.
Additional InformationIt solves by grid control's first IME composition message to cell editor And shows IME composition in cell editor.

Tagsgrid, IME
Fixed in Revision49163
LazTarget1.6
WidgetsetWin32/Win64
Attached Files
  • grids.pas_ime_editor.patch (1,963 bytes)
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 48874)
    +++ lcl/grids.pas	(working copy)
    @@ -36,7 +36,11 @@
       Types, Classes, SysUtils, Math, Maps, LCLStrConsts, LCLProc, LCLType, LCLIntf,
       FileUtil, FPCanvas, Controls, GraphType, Graphics, Forms, DynamicArray,
       LMessages, StdCtrls, LResources, MaskEdit, Buttons, Clipbrd, Themes,
    -  LazUTF8, LazUtf8Classes, Laz2_XMLCfg, LCSVUtils; // <-- replaces XMLConf (part of FPC libs)
    +  LazUTF8, LazUtf8Classes, Laz2_XMLCfg, LCSVUtils
    +{$ifdef WINDOWS}
    +  ,messages
    +{$endif}
    +  ; // <-- replaces XMLConf (part of FPC libs)
     
     const
       //GRIDFILEVERSION = 1; // Original
    @@ -1209,6 +1213,11 @@
         property SortOrder: TSortOrder read FSortOrder write FSortOrder;
         property SortColumn: Integer read FSortColumn;
         property TabStop default true;
    +{$ifdef WINDOWS}
    +  protected
    +    procedure IMEStartComposition(var Msg:TMessage); message WM_IME_STARTCOMPOSITION;
    +    procedure IMEComposition(var Msg:TMessage); message WM_IME_COMPOSITION;
    +{$endif}
       end;
     
       TGetEditEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Value: string) of object;
    @@ -9101,6 +9110,32 @@
       {$ENDIF}
     end;
     
    +{$ifdef WINDOWS}
    +procedure TCustomGrid.IMEStartComposition(var Msg: TMessage);
    +begin
    +  // enable editor
    +  SelectEditor;
    +  EditorShow(True);
    +  if Editor<>nil then
    +    Msg.Result:=SendMessage(Editor.Handle,Msg.msg,Msg.wParam,Msg.lParam);
    +end;
    +
    +procedure TCustomGrid.IMEComposition(var Msg: TMessage);
    +var
    +  wc : pWideChar;
    +  s : string;
    +begin
    +  wc := @Msg.wParamlo;
    +  s := Ansistring(WideCharToString(wc));
    +  // check valid mbcs
    +  if (Length(s)>0) and (s[1]<>'?') then
    +    Msg.wParamlo:=swap(pword(@s[1])^);
    +  // send first mbcs to editor
    +  if Editor<>nil then
    +    Msg.Result:=SendMessage(Editor.Handle,Msg.msg,Msg.wParam,Msg.lParam);
    +end;
    +{$endif}
    +
     procedure TCustomGrid.Clear;
     var
       OldR,OldC: Integer;
    
  • grids.pas_ime_editor_1.patch (1,968 bytes)
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 48874)
    +++ lcl/grids.pas	(working copy)
    @@ -36,7 +36,11 @@
       Types, Classes, SysUtils, Math, Maps, LCLStrConsts, LCLProc, LCLType, LCLIntf,
       FileUtil, FPCanvas, Controls, GraphType, Graphics, Forms, DynamicArray,
       LMessages, StdCtrls, LResources, MaskEdit, Buttons, Clipbrd, Themes,
    -  LazUTF8, LazUtf8Classes, Laz2_XMLCfg, LCSVUtils; // <-- replaces XMLConf (part of FPC libs)
    +  LazUTF8, LazUtf8Classes, Laz2_XMLCfg, LCSVUtils
    +{$ifdef WINDOWS}
    +  ,messages
    +{$endif}
    +  ; // <-- replaces XMLConf (part of FPC libs)
     
     const
       //GRIDFILEVERSION = 1; // Original
    @@ -1209,6 +1213,11 @@
         property SortOrder: TSortOrder read FSortOrder write FSortOrder;
         property SortColumn: Integer read FSortColumn;
         property TabStop default true;
    +{$ifdef WINDOWS}
    +  protected
    +    procedure IMEStartComposition(var Msg:TMessage); message WM_IME_STARTCOMPOSITION;
    +    procedure IMEComposition(var Msg:TMessage); message WM_IME_COMPOSITION;
    +{$endif}
       end;
     
       TGetEditEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Value: string) of object;
    @@ -9101,6 +9110,32 @@
       {$ENDIF}
     end;
     
    +{$ifdef WINDOWS}
    +procedure TCustomGrid.IMEStartComposition(var Msg: TMessage);
    +begin
    +  // enable editor
    +  SelectEditor;
    +  EditorShow(True);
    +  if Editor<>nil then
    +    Msg.Result:=SendMessage(Editor.Handle,Msg.msg,Msg.wParam,Msg.lParam);
    +end;
    +
    +procedure TCustomGrid.IMEComposition(var Msg: TMessage);
    +var
    +  wc : pWideChar;
    +  s : string;
    +begin
    +  wc := @Msg.wParamlo;
    +  s := Ansistring(WideCharLenToString(wc,1));
    +  // check valid mbcs
    +  if (Length(s)>0) and (s[1]<>'?') then
    +    Msg.wParamlo:=swap(pword(@s[1])^);
    +  // send first mbcs to editor
    +  if Editor<>nil then
    +    Msg.Result:=SendMessage(Editor.Handle,Msg.msg,Msg.wParam,Msg.lParam);
    +end;
    +{$endif}
    +
     procedure TCustomGrid.Clear;
     var
       OldR,OldC: Integer;
    

Activities

Do-wan Kim

2015-04-27 05:55

reporter  

grids.pas_ime_editor.patch (1,963 bytes)
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 48874)
+++ lcl/grids.pas	(working copy)
@@ -36,7 +36,11 @@
   Types, Classes, SysUtils, Math, Maps, LCLStrConsts, LCLProc, LCLType, LCLIntf,
   FileUtil, FPCanvas, Controls, GraphType, Graphics, Forms, DynamicArray,
   LMessages, StdCtrls, LResources, MaskEdit, Buttons, Clipbrd, Themes,
-  LazUTF8, LazUtf8Classes, Laz2_XMLCfg, LCSVUtils; // <-- replaces XMLConf (part of FPC libs)
+  LazUTF8, LazUtf8Classes, Laz2_XMLCfg, LCSVUtils
+{$ifdef WINDOWS}
+  ,messages
+{$endif}
+  ; // <-- replaces XMLConf (part of FPC libs)
 
 const
   //GRIDFILEVERSION = 1; // Original
@@ -1209,6 +1213,11 @@
     property SortOrder: TSortOrder read FSortOrder write FSortOrder;
     property SortColumn: Integer read FSortColumn;
     property TabStop default true;
+{$ifdef WINDOWS}
+  protected
+    procedure IMEStartComposition(var Msg:TMessage); message WM_IME_STARTCOMPOSITION;
+    procedure IMEComposition(var Msg:TMessage); message WM_IME_COMPOSITION;
+{$endif}
   end;
 
   TGetEditEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Value: string) of object;
@@ -9101,6 +9110,32 @@
   {$ENDIF}
 end;
 
+{$ifdef WINDOWS}
+procedure TCustomGrid.IMEStartComposition(var Msg: TMessage);
+begin
+  // enable editor
+  SelectEditor;
+  EditorShow(True);
+  if Editor<>nil then
+    Msg.Result:=SendMessage(Editor.Handle,Msg.msg,Msg.wParam,Msg.lParam);
+end;
+
+procedure TCustomGrid.IMEComposition(var Msg: TMessage);
+var
+  wc : pWideChar;
+  s : string;
+begin
+  wc := @Msg.wParamlo;
+  s := Ansistring(WideCharToString(wc));
+  // check valid mbcs
+  if (Length(s)>0) and (s[1]<>'?') then
+    Msg.wParamlo:=swap(pword(@s[1])^);
+  // send first mbcs to editor
+  if Editor<>nil then
+    Msg.Result:=SendMessage(Editor.Handle,Msg.msg,Msg.wParam,Msg.lParam);
+end;
+{$endif}
+
 procedure TCustomGrid.Clear;
 var
   OldR,OldC: Integer;

Do-wan Kim

2015-05-06 04:15

reporter  

grids.pas_ime_editor_1.patch (1,968 bytes)
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 48874)
+++ lcl/grids.pas	(working copy)
@@ -36,7 +36,11 @@
   Types, Classes, SysUtils, Math, Maps, LCLStrConsts, LCLProc, LCLType, LCLIntf,
   FileUtil, FPCanvas, Controls, GraphType, Graphics, Forms, DynamicArray,
   LMessages, StdCtrls, LResources, MaskEdit, Buttons, Clipbrd, Themes,
-  LazUTF8, LazUtf8Classes, Laz2_XMLCfg, LCSVUtils; // <-- replaces XMLConf (part of FPC libs)
+  LazUTF8, LazUtf8Classes, Laz2_XMLCfg, LCSVUtils
+{$ifdef WINDOWS}
+  ,messages
+{$endif}
+  ; // <-- replaces XMLConf (part of FPC libs)
 
 const
   //GRIDFILEVERSION = 1; // Original
@@ -1209,6 +1213,11 @@
     property SortOrder: TSortOrder read FSortOrder write FSortOrder;
     property SortColumn: Integer read FSortColumn;
     property TabStop default true;
+{$ifdef WINDOWS}
+  protected
+    procedure IMEStartComposition(var Msg:TMessage); message WM_IME_STARTCOMPOSITION;
+    procedure IMEComposition(var Msg:TMessage); message WM_IME_COMPOSITION;
+{$endif}
   end;
 
   TGetEditEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Value: string) of object;
@@ -9101,6 +9110,32 @@
   {$ENDIF}
 end;
 
+{$ifdef WINDOWS}
+procedure TCustomGrid.IMEStartComposition(var Msg: TMessage);
+begin
+  // enable editor
+  SelectEditor;
+  EditorShow(True);
+  if Editor<>nil then
+    Msg.Result:=SendMessage(Editor.Handle,Msg.msg,Msg.wParam,Msg.lParam);
+end;
+
+procedure TCustomGrid.IMEComposition(var Msg: TMessage);
+var
+  wc : pWideChar;
+  s : string;
+begin
+  wc := @Msg.wParamlo;
+  s := Ansistring(WideCharLenToString(wc,1));
+  // check valid mbcs
+  if (Length(s)>0) and (s[1]<>'?') then
+    Msg.wParamlo:=swap(pword(@s[1])^);
+  // send first mbcs to editor
+  if Editor<>nil then
+    Msg.Result:=SendMessage(Editor.Handle,Msg.msg,Msg.wParam,Msg.lParam);
+end;
+{$endif}
+
 procedure TCustomGrid.Clear;
 var
   OldR,OldC: Integer;

Do-wan Kim

2015-05-06 04:17

reporter   ~0083493

New patch use "WideCharLenToString(wc,1)" for converting unicode to mbcs.

Jesus Reyes

2015-05-25 07:20

developer   ~0083988

Applied thanks.

Do-wan Kim

2015-05-25 14:12

reporter   ~0083991

Thank you :)

Issue History

Date Modified Username Field Change
2015-04-27 05:55 Do-wan Kim New Issue
2015-04-27 05:55 Do-wan Kim File Added: grids.pas_ime_editor.patch
2015-04-27 06:17 Do-wan Kim Tag Attached: grid
2015-04-27 06:17 Do-wan Kim Tag Attached: IME
2015-04-30 07:09 Jesus Reyes Assigned To => Jesus Reyes
2015-04-30 07:09 Jesus Reyes Status new => assigned
2015-05-06 04:15 Do-wan Kim File Added: grids.pas_ime_editor_1.patch
2015-05-06 04:17 Do-wan Kim Note Added: 0083493
2015-05-25 07:20 Jesus Reyes Fixed in Revision => 49163
2015-05-25 07:20 Jesus Reyes LazTarget => 1.6
2015-05-25 07:20 Jesus Reyes Note Added: 0083988
2015-05-25 07:20 Jesus Reyes Status assigned => resolved
2015-05-25 07:20 Jesus Reyes Fixed in Version => 1.5 (SVN)
2015-05-25 07:20 Jesus Reyes Resolution open => fixed
2015-05-25 07:20 Jesus Reyes Target Version => 1.6
2015-05-25 14:12 Do-wan Kim Note Added: 0083991
2015-05-25 14:12 Do-wan Kim Status resolved => closed