본문 바로가기
Delphi 문제점 Tip

EH 그리드에서 한글문제 해결

by MonoSoft 2022. 4. 28.
728x90
반응형

EH 그리드에서 한글문제 해결

 

// interface use 절에 imm을 추가합니다.

uses imm;

// 그리드클래스의 protected 절에 다음과 같이 이벤트추가 합니다.

    procedure WMIme_Composition(var msg:TMessage); message WM_IME_COMPOSITION;

implementation

// 이벤트구현

procedure TMyStringGrid.WMIme_Composition(var msg: TMessage);

var

   imc: HImc;

  buff: array [0..3] of Char;

  len: integer;

begin

  if (msg.lParam and GCS_COMPSTR) <> 0 then

  begin

    imc := ImmGetContext(Handle);

    len := ImmGetCompositionString(imc, GCS_COMPSTR, nil, 0);

    ImmGetCompositionString(imc, GCS_COMPSTR, @buff, len);

    if CanEditModify and (len > 0) then

    begin

      ShowEditor;

      if InplaceEditor <> nil then

      with InplaceEditor do

      begin

        ImmSetCompositionString(imc, SCS_SETSTR, @buff, len, nil, 0);

        SetWindowText(handle,pchar(text));

      end;

   end;

   ImmReleaseContext(Handle, imc);

  end;

end;

그리드에서 한글첫문자가 조합중 안나올경우 사용하세요...

 

 

728x90
반응형

댓글