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

FreePascal Q&A
[133] Re:마우스 좌우버튼 구분하여 더블클릭 이벤트 감지하는 방법?
MarunGuy [marunguy] 7778 읽음    2013-08-12 19:49
라자루스 포럼에 질문을 올렸더니 다음과 같은 답변들이 올라오네요.
http://forum.lazarus.freepascal.org/index.php/topic,21736.0.html

라자루스 버그로 보인다고 하고 델파이는 동작이 다르다네요.
It seems that the TShiftState parameter is incorrectly built in Lazarus 
(and it's not specific to the TTrayIcon component); 
it's different in Delphi.


그리고, 아래처럼 하면 될거라고,, 장성호님 답변과 비슷한 내용입니다.
...
implementation

{$R *.lfm}
{ TForm1 }

var
  LastButton: TMouseButton;

procedure TForm1.TrayIcon1DblClick(Sender: TObject);
begin
  if LastButton=mbLeft then
    ShowMessage('Double Left Click')
  else
    if LastButton=mbRight then
      ShowMessage('Double Rigth Click');
end;

procedure TForm1.TrayIcon1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  LastButton:=Button;
end;


...

MarunGuy 님이 쓰신 글 :
: 안녕하세요.
:
: 마우스 좌우버튼을 구분하여 더블클릭 이벤트를 감지하려고 하는데 잘 안됩니다.
: 환경은 윈도7 64비트, CodeTyphon 4.41 32비트 입니다.
:
: OnDblClick 이벤트를 사용하면 되는데 좌우 버튼을 구별할 수 없네요.
:
procedure TFormMain.TrayIconMainDblClick(Sender: TObject);
: begin
:   ShowMessage('double click'); // 좌우 버튼을 구별할 수 없음..
: end; 

:
: OnMouseUp 이벤트를 이용해볼려고 했는데 생각처럼 안되네요.
:
procedure TFormMain.TrayIconMainMouseUp(Sender: TObject; Button: TMouseButton;
:   Shift: TShiftState; X, Y: Integer);
: begin
:   if mbRight = Button then
:     ShowMessage('right click')
:   else if (mbLeft = Button) and (ssDouble in Shift) then
:   begin
:     ShowMessage('left double click');
:   end;
: end;

:
: 그냥 if ssDouble in Shift then 해도 이벤트가 발생하지 않습니다.
: LCL 도움말에서도 ssDouble 이 마우스 더블클릭이 맞는데 말이죠. 흠.
:
type TShiftStateEnum = (
:   ssShift,	// Shift key pressed
:   ssAlt,	// Alt key pressed
:   ssCtrl,	// Ctrl key pressed
:   ssLeft,	// Left mouse button pressed.
:   ssRight,	// Right mouse button pressed.
:   ssMiddle,	// Middle mouse button pressed.
:   ssDouble,	// Double mouse click.
:   ssMeta,	// Meta key pressed.
:   ssSuper,	// Super key pressed.
:   ssHyper,	// Hyper key pressed.
:   ssAltGr,	// Alt-GR key pressed.
:   ssCaps,	// Caps lock key pressed
:   ssNum,	// Num lock key pressed
:   ssScroll,	// Scroll lock key pressed
:   ssTriple,	// Triple mouse click
:   ssQuad,	// Quadruple mouse click
:   ssExtra1,	// Extra key 1
:   ssExtra2	// Extra key 2
: );

:

+ -

관련 글 리스트
123 마우스 좌우버튼 구분하여 더블클릭 이벤트 감지하는 방법? MarunGuy 3575 2013/08/08
133     Re:마우스 좌우버튼 구분하여 더블클릭 이벤트 감지하는 방법? MarunGuy 7778 2013/08/12
131     Re:마우스 좌우버튼 구분하여 더블클릭 이벤트 감지하는 방법? MarunGuy 7887 2013/08/10
130     Re:마우스 좌우버튼 구분하여 더블클릭 이벤트 감지하는 방법? civilian 7025 2013/08/09
132         Re:Re:마우스 좌우버튼 구분하여 더블클릭 이벤트 감지하는 방법? MarunGuy 7297 2013/08/10
124     Re:마우스 좌우버튼 구분하여 더블클릭 이벤트 감지하는 방법? 장성호 3553 2013/08/09
125         Re:Re:마우스 좌우버튼 구분하여 더블클릭 이벤트 감지하는 방법? MarunGuy 4365 2013/08/09
127             Re:Re:Re:마우스 좌우버튼 구분하여 더블클릭 이벤트 감지하는 방법? 장성호 12313 2013/08/09
128                 Re:Re:Re:Re:마우스 좌우버튼 구분하여 더블클릭 이벤트 감지하는 방법? MarunGuy 7691 2013/08/09
129                     Re:Re:Re:Re:Re:마우스 좌우버튼 구분하여 더블클릭 이벤트 감지하는 방법? 장성호 7403 2013/08/09
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.