Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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

  • NCS_OneNCS_One Posts: 170Member
    : 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.
  • Chaitanya_PuneChaitanya_Pune Posts: 87Member
    : : 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?

  • zibadianzibadian Posts: 6,349Member
    : : : 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.
  • NCS_OneNCS_One Posts: 170Member
    : : : : 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.