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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop up Menus

Status
Not open for further replies.

jbrowne

Programmer
Feb 1, 2000
182
IE
Hi,

I want to create a pop up menu dynamically depending on what the user clicks on a grid. My question is as follows, can I code the contents of a pop up menu (driven from a right click event) at run time depending on what row of a grid the user selects. In other words can I pass variables to the caption property of a pop up menu and then fire the code behind the listindex of the item on the menu that the user selects?

Thanks in advance
John B
 
The PopUpMenu method can do it provided it is provided with a Menu object. While you can always create a hidden Menu using the Menu Editor, it seems to me to be neater if one can create an independent Menu object at run-time. If that is possible I don't know how to do it.
 
xbafge,
Can you elaborate more please on your answer - I don't quite follow what you are getting at.

Thanks
JB
 
Make invisible mnuMyMenu menu with at least one visible mnuMySubMenu submenu. Put a flex grid with several columns and several rows and copy the code:

Private Sub MSFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)

mnuMySubMenu.Caption = "Row " & CStr(MSFlexGrid1.MouseRow) & " Col " & CStr(MSFlexGrid1.MouseCol)
PopupMenu mnuMyMenu
End Sub

You will get the idea.

Good luck

VladK
 
Yes. Presumably that mnuMyMenu was created using the Menu Editor; if it could be created using code, the solution would be more elegant.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top