Trapping "Mouse Right Button Key"

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.

Comments

  • : 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 :
    [code]
    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;
    [/code]
    Hope it helps.
  • : : 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 :
    : [code]
    : 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;
    : [/code]
    : 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?

  • : : : 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 :
    : : [code]
    : : 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;
    : : [/code]
    : : 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.
  • : : : : 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 :
    : : : [code]
    : : : 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;
    : : : [/code]
    : : : 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 ???
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories