C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[28267] Re:ActiveX Form에서 Tab 키 처리 문제
smleelms [smleelms] 1955 읽음    2003-12-18 21:36
http://groups.google.com/groups?hl=ko&lr=&ie=UTF-8&oe=UTF-8&selm=8uq0btk51smg07ihjlv7ubolvcd4mvtjsm%404ax.com&rnum=2

Michael Lim wrote:

>I put the TMemo control on the ActiveX form. And called this ocx in the IE5.
>By the way, this ocx didn't recognize the back space key and arrow keys.
>When I press the backspace key, IE5 move backward url...
>What can I do?

Dear Michael,

recently I have found your same problem with a TCustomControl
inherited control (P.S: TMemo is also a descendent of TCustomControl).
After many days of pure desperation I have found a Microsoft Document
in MSDN Library - October 2000, in which the author explain the cause
of my problems. The original document is wrote with MFC structure in
mind and so I have extract and adapted that infos in following note:


SYMPTOMS:

- When a Visual Basic Form or IEx page contains the Builder C++
ActiveX control derived from a VCL TCustomControl class, and the
control has focus, the ARROW keys (and others navigation keys)
are not recognized.

CAUSE:

- This behavior is the result of ARROW keys being accelerator keys.
Accelerator keys are handled in the main message loop of the
containing application before the window procedure of the control
is called. As a result, the ActiveX control is not aware that the
ARROW keys have been pressed. Other accelerator keys include the TAB,
END, and HOME keys.

RESOLUTION:

- The problem can be resolved by adding the following code to Builder
C++ ActiveX Control Wizzard code generated and precisely in the
CoClass of VCL control.

< -- snip from "MemoImpl1.h -- >

class ATL_NO_VTABLE TMemoXImpl : VCLCONTROL_IMPL
(
  TMemoXImpl,
  MemoX,
  TMemo,
  IMemoX,
  DIID_IMemoXEvents
)
{
  void __fastcall ChangeEvent(TObject *Sender);
  void __fastcall ClickEvent(TObject *Sender);
  void __fastcall DblClickEvent(TObject *Sender);
  void __fastcall KeyPressEvent(TObject *Sender, char &Key);
public:

  // manually added for VB & IEx navigation key compatibility
  BOOL PreTranslateAccelerator(LPMSG pMsg, HRESULT &hRet)
  {
     switch (pMsg->message)
     {
       case WM_KEYDOWN:
       case WM_KEYUP:

       switch (pMsg->wParam)
       {
         // !!!!! insert here your required navigation keys !!!!
         case VK_UP:
         case VK_DOWN:
         case VK_LEFT:
         case VK_RIGHT:
         case VK_HOME:
         case VK_END:
         case VK_TAB:

         SendMessage
         (
           pMsg->hwnd,
           pMsg->message,
           pMsg->wParam,
           pMsg->lParam
         );
       return TRUE;
       }
     }

     return FALSE;
  }

  void InitializeControl()
  {
    m_VclCtl->OnChange = ChangeEvent;
    m_VclCtl->OnClick = ClickEvent;
    m_VclCtl->OnDblClick = DblClickEvent;
    m_VclCtl->OnKeyPress = KeyPressEvent;
  }

< -- end snip from "MemoImpl1.h -- >

저는 일단 이 코드로 해결이 되네요.. 참고하시구요.....
(금방 기본적으로 Tab 키랑, Arrow 키등만 확인했는데, 설마 나중에 다른 문제가 생기지는 않겠죠.. )
또 다른 내용들도 있더군요.. 그런데 저한테는 너무 어려워서리.. ^^;;;

http://groups.google.com/groups?q=ActiveX+Lost+Key+group:borland.public.cppbuilder.*&hl=ko&lr=&ie=UTF-8&oe=UTF-8&group=borland.public.cppbuilder.*&selm=94nlr9%24or116%40bornews.inprise.com&rnum=1

http://groups.google.com/groups?q=ActiveX+Lost+Key+group:borland.public.cppbuilder.*&hl=ko&lr=&ie=UTF-8&oe=UTF-8&group=borland.public.cppbuilder.*&selm=3ad337eb_2%40dnews&rnum=3

+ -

관련 글 리스트
28232 ActiveX Form에서 Tab 키 처리 문제 성팔이 1177 2003/12/17
28267     Re:ActiveX Form에서 Tab 키 처리 문제 smleelms 1955 2003/12/18
34159         Re:Re:ActiveX Form에서 Tab 키 처리 문제 smleelms 1038 2003/12/18
28268         Re:감사합니다. 성팔이 894 2003/12/18
34158             Re:Re:감사합니다. smleelms 916 2003/12/18
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.