0

I have a Delphi 6 application that has a TJvListView control. I have a popup menu tied to that control via the control's PopupMenu property. What I would like to do is show a different popup menu based on which column the user had the mouse over when they right clicked, with the additional option to not show a popup menu at all if the current column does not need one. How can I do this?

Thanks to this detailed sample by Remy Lebeau on in-place editing in a TListView I know what row and column the mouse is over except for one wrinkle. The mouse down event where I determine the current row and column occurs after the popup menu is exited.

I now need to know two things. First, how can I get some event to fire before the popup menu shows after a right mouse click so I can record the current list view row and column and suppress the popup menu if I want to, and second, how I can show a different popup based on the current column. I am hoping to avoid having to write a bunch of mini-forms instead of using the TListView PopupMenu property and supporting code. Is there a simple solution, perhaps some fancy footwork in a sub-class I should create around TJvListView?

Community
  • 1
  • 1
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227
  • 4
    See http://stackoverflow.com/questions/11259099/how-to-set-popup-menu-for-listview-header-bar-together-with-items-popup-menu and the event you're looking for is the same 'OnContextPopup'. – Sertac Akyuz Nov 21 '12 at 00:50

1 Answers1

0

You could perform the detection in mousemove instead of mousedown/Click and change the popupmenu depending. You also could remove any popupmenu and call the wished via p.pupup in mousedown as you desire.

bummi
  • 27,123
  • 14
  • 62
  • 101