I try to solve problem asian word inputing in synedit control, but there is a lot of problem.
Most of them caused by 'key-press-evnent' handler.
I have use UIM input method module in linux mint 17 64bit.
synedit with candidate window will not work, key press raised in widget.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, SynEdit, Forms, Controls, Graphics, Dialogs,
StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Memo1: TMemo;
SynEdit1: TSynEdit;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
uses glib2, gdk2, gtk2, Gtk2Globals, pango;
{$R *.lfm}
var
ntext:PGtkIMContext;
ipos:Integer;
preeditstr:string;
procedure preeditstart(context:PGtkIMContext; Data:Pointer); cdecl;
begin
Inc(ipos);
Form1.Memo1.Lines.Add(IntToStr(ipos)+' preedit-start');
end;
procedure preeditchanged(context:PGtkIMContext; Data:Pointer); cdecl;
var
str:Pgchar;
pangoattr:PPangoAttrList;
pos:pgint;
begin
Form1.Memo1.Lines.Add(IntToStr(ipos)+' preedit-changed');
gtk_im_context_get_preedit_string(context,@str,pangoattr,nil);
preeditstr:=str;
g_free(str);
pango_attr_list_unref(pangoattr);
Form1.Memo1.Lines.Add(IntToStr(ipos)+' '+preeditstr);
im_context_string:=preeditstr;
end;
procedure preeditend(context:PGtkIMContext; Data:Pointer); cdecl;
begin
Form1.Memo1.Lines.Add(IntToStr(ipos)+' preedit-end');
preeditstr:='';
end;
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
gtk_im_context_reset(im_context);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ipos:=0;
g_signal_connect(G_OBJECT(im_context),'preedit-start',G_CALLBACK(@preeditstart),nil);
g_signal_connect(G_OBJECT(im_context),'preedit-changed',G_CALLBACK(@preeditchanged),nil);
g_signal_connect(G_OBJECT(im_context),'preedit-end',G_CALLBACK(@preeditend),nil);
end;
end.
with above source, composition string out successfully in synedit.
What is the best way of skipping candidate window key(hanja candidate window) code in synedit control's widget?