Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Trapping "Mouse Right Button Key" Posted by Chaitanya_Pune on 26 Aug 2005 at 6:13 AM
Hello Friends,
I am using TVSE KeyBoard with Windows supporting keys. Like "Windows" key. I want to trap "Mouse Right Botton Key" ; Which is located between "windows" key and "Ctrl" key ; not "Rigth Mouse Click" . Strictly not.

After trapping that key I want to popup a menu where the cursor is positioned.
I have used following code:
_______________________________________________________________________
procedure TfrmComp.PlannerCalendar1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
Var
structMSG : MSG;
begin
{ GetMessage(structMSG,self.Handle,0,0);
if structMSG.message = WM_RBUTTONDOWN then
BcBarPopupMenu1.Popup(structMSG.pt.x,structMSG.pt.y);}
end;
________________________________________________________________________

Problem is that it traps every key of the keboard.

Can any one help????????

Regards
Chaitanya.
Report
Re: Trapping "Mouse Right Button Key" Posted by NCS_One on 26 Aug 2005 at 8:00 AM
: Hello Friends,
: I am using TVSE KeyBoard with Windows supporting keys. Like "Windows" key. I want to trap "Mouse Right Botton Key" ; Which is located between "windows" key and "Ctrl" key ; not "Rigth Mouse Click" . Strictly not.
:
: After trapping that key I want to popup a menu where the cursor is positioned.
: I have used following code:
: _______________________________________________________________________
: procedure TfrmComp.PlannerCalendar1KeyDown(Sender: TObject; var Key: Word;
: Shift: TShiftState);
: Var
: structMSG : MSG;
: begin
: { GetMessage(structMSG,self.Handle,0,0);
: if structMSG.message = WM_RBUTTONDOWN then
: BcBarPopupMenu1.Popup(structMSG.pt.x,structMSG.pt.y);}
: end;
: ________________________________________________________________________
:
: Problem is that it traps every key of the keboard.
:
: Can any one help????????
:
: Regards
: Chaitanya.
:

Hi

Try this :
procedure TfrmComp.PlannerCalendar1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
Var
   MousePos : TPoint;
begin
     if Key = 93 then
     Begin
          GetCursorPos(MousePos);
          BcBarPopupMenu1.Popup(MousePos.X,MousePos.Y);
     End;
end;

Hope it helps.
Report
Re: Trapping "Mouse Right Button Key" Posted by Chaitanya_Pune on 29 Aug 2005 at 5:27 AM
: : Hello Friends,
: : I am using TVSE KeyBoard with Windows supporting keys. Like "Windows" key. I want to trap "Mouse Right Botton Key" ; Which is located between "windows" key and "Ctrl" key ; not "Rigth Mouse Click" . Strictly not.
: :
: : After trapping that key I want to popup a menu where the cursor is positioned.
: : I have used following code:
: : _______________________________________________________________________
: : procedure TfrmComp.PlannerCalendar1KeyDown(Sender: TObject; var Key: Word;
: : Shift: TShiftState);
: : Var
: : structMSG : MSG;
: : begin
: : { GetMessage(structMSG,self.Handle,0,0);
: : if structMSG.message = WM_RBUTTONDOWN then
: : BcBarPopupMenu1.Popup(structMSG.pt.x,structMSG.pt.y);}
: : end;
: : ________________________________________________________________________
: :
: : Problem is that it traps every key of the keboard.
: :
: : Can any one help????????
: :
: : Regards
: : Chaitanya.
: :
:
: Hi
:
: Try this :
:
: procedure TfrmComp.PlannerCalendar1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
: Var
:    MousePos : TPoint;
: begin
:      if Key = 93 then
:      Begin
:           GetCursorPos(MousePos);
:           BcBarPopupMenu1.Popup(MousePos.X,MousePos.Y);
:      End;
: end;
: 

: Hope it helps.
:
----------------------------------------------------------------------- I have tried this one also. But the problem is that menu popups up even I place the mouse out of the confined PlaneerCalendar area which should not happen. Further I also tried to Clip the mouse but I can't do it ; as neither PlannerCalendar nor the form has Right and Bottom Property (like Left and Top).

By the way thanks very much for your kind suggession.
Can you help me anymore?

Report
Re: Trapping "Mouse Right Button Key" Posted by zibadian on 29 Aug 2005 at 9:44 AM
: : : Hello Friends,
: : : I am using TVSE KeyBoard with Windows supporting keys. Like "Windows" key. I want to trap "Mouse Right Botton Key" ; Which is located between "windows" key and "Ctrl" key ; not "Rigth Mouse Click" . Strictly not.
: : :
: : : After trapping that key I want to popup a menu where the cursor is positioned.
: : : I have used following code:
: : : _______________________________________________________________________
: : : procedure TfrmComp.PlannerCalendar1KeyDown(Sender: TObject; var Key: Word;
: : : Shift: TShiftState);
: : : Var
: : : structMSG : MSG;
: : : begin
: : : { GetMessage(structMSG,self.Handle,0,0);
: : : if structMSG.message = WM_RBUTTONDOWN then
: : : BcBarPopupMenu1.Popup(structMSG.pt.x,structMSG.pt.y);}
: : : end;
: : : ________________________________________________________________________
: : :
: : : Problem is that it traps every key of the keboard.
: : :
: : : Can any one help????????
: : :
: : : Regards
: : : Chaitanya.
: : :
: :
: : Hi
: :
: : Try this :
: :
: : procedure TfrmComp.PlannerCalendar1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
: : Var
: :    MousePos : TPoint;
: : begin
: :      if Key = 93 then
: :      Begin
: :           GetCursorPos(MousePos);
: :           BcBarPopupMenu1.Popup(MousePos.X,MousePos.Y);
: :      End;
: : end;
: : 

: : Hope it helps.
: :
: ----------------------------------------------------------------------- I have tried this one also. But the problem is that menu popups up even I place the mouse out of the confined PlaneerCalendar area which should not happen. Further I also tried to Clip the mouse but I can't do it ; as neither PlannerCalendar nor the form has Right and Bottom Property (like Left and Top).
:
: By the way thanks very much for your kind suggession.
: Can you help me anymore?
:
:
You can easily calculate the Right and Bottom location by adding the Top and Height together; and the Left and Width.
Report
Re: Trapping "Mouse Right Button Key" Posted by NCS_One on 30 Aug 2005 at 8:13 AM
: : : : Hello Friends,
: : : : I am using TVSE KeyBoard with Windows supporting keys. Like "Windows" key. I want to trap "Mouse Right Botton Key" ; Which is located between "windows" key and "Ctrl" key ; not "Rigth Mouse Click" . Strictly not.
: : : :
: : : : After trapping that key I want to popup a menu where the cursor is positioned.
: : : : I have used following code:
: : : : _______________________________________________________________________
: : : : procedure TfrmComp.PlannerCalendar1KeyDown(Sender: TObject; var Key: Word;
: : : : Shift: TShiftState);
: : : : Var
: : : : structMSG : MSG;
: : : : begin
: : : : { GetMessage(structMSG,self.Handle,0,0);
: : : : if structMSG.message = WM_RBUTTONDOWN then
: : : : BcBarPopupMenu1.Popup(structMSG.pt.x,structMSG.pt.y);}
: : : : end;
: : : : ________________________________________________________________________
: : : :
: : : : Problem is that it traps every key of the keboard.
: : : :
: : : : Can any one help????????
: : : :
: : : : Regards
: : : : Chaitanya.
: : : :
: : :
: : : Hi
: : :
: : : Try this :
: : :
: : : procedure TfrmComp.PlannerCalendar1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
: : : Var
: : :    MousePos : TPoint;
: : : begin
: : :      if Key = 93 then
: : :      Begin
: : :           GetCursorPos(MousePos);
: : :           BcBarPopupMenu1.Popup(MousePos.X,MousePos.Y);
: : :      End;
: : : end;
: : : 

: : : Hope it helps.
: : :
: : ----------------------------------------------------------------------- I have tried this one also. But the problem is that menu popups up even I place the mouse out of the confined PlaneerCalendar area which should not happen. Further I also tried to Clip the mouse but I can't do it ; as neither PlannerCalendar nor the form has Right and Bottom Property (like Left and Top).
: :
: : By the way thanks very much for your kind suggession.
: : Can you help me anymore?
: :
: :
: You can easily calculate the Right and Bottom location by adding the Top and Height together; and the Left and Width.
:

Hi

You can do it easily as zibadian says, but if the keydow is in
the PlannerCalendar how does it works if you do a keydown in other
place ???
What is the PlannerCalendar ???



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.