Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TMainMenu with RightClick

Status
Not open for further replies.

Roderich

Programmer
Sep 11, 2001
58
DE
hi,

does anybody know about a MainMenu component (maybe TMainMenu descendant ?) which is able to react to mouse rightclicks ?
Normal TMenuItem.OnClick is a NotifyEvent (leftclick only). What I need is something similar to Windows start menu where the user can right-click and e.g. select "Delete" or "Rename".

wbr
Roderich

 
Does TPopupMenu meet your requirements?

You can find it on the standard palette next to TMainMenu.

Andrew
Hampshire, UK
 
No, this is not what I need.

I need reaction when the user right-clicks on any MenuItem inside of a MainMenu or PopupMenu. This should be something like a OnMouseUp (which is protected in TMenuItem).

How it is now with my Delphi 5:
- right-click on a MainMenu item doesn't call OnClick at all
- right-click on a PopupMenu item behaves the same as a left-click -> OnClick is executed

How I need it:
- right-click on a MainMenu triggers a different event than left-click (or at least gives me a shift state for the rbutton)
- same for PopupMenu

I could re-invent the wheel by creating my own Menus.pas and there make MouseUp visible in TMenuItem. But this is not nice (think of changing Delphi version).

Thank you anyway towerbase. Maybe you know of any good VCL page in the web ? I checked out Torry's and Delphi Superpage but did not find something.

wbr
Roderich
 
Doesn't the component you want to be able to right-click on have a property called something along the lines of 'Popup Menu'? Most of them do.
 
Thanks to all for your replies !

@KempCGDR: I want to right-click on the menu item itself, like on a Windows start menu item.

@whosrdaddy: sounds good, but we just have Delphi 5... :-/

I know tried something with a mouse hook, seems to work not so bad.

wbr
Roderich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top