CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: menu

  1. #1
    Join Date
    Mar 2001
    Posts
    29

    menu

    I would like to create a pop-up menu when a user clicks the right mouse button on a cell in a flexgrid.

    Any suggestions?

    Thanks,
    Batsheva


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: menu

    Option Explicit
    use menu editor to add menus to your form. Set main(top) menu visible = false
    leave submenu visible true.
    Here I have a 3x2 flexgrid
    a main menu called mnupop
    a submenu called mnupopme
    when I click last flexgrid cell, the mnupop appear
    Beware: it appears also when I click on fixed cell at its left...
    Private Sub MSFlexGrid1_Click()
    With MSFlexGrid1
    If .Row = 2 And .Col = 1 Then
    PopupMenu mnupop
    End If
    End With
    End Sub


    Special thanks to Lothar "the Great" Haensler, Tom Archer, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Mar 2001
    Posts
    29

    Re: menu

    Do you know how I check to see if it is a right mouse click?

    Thanks!


  4. #4
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: menu

    If you need to know what button it is, use the MouseDown Event. Then, you get a parameter Button, and you can check

    If Button=vbRightButton then
    ...
    endif


  5. #5
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: menu

    Sorry, Shree. Although you're right, it is better to use the mouseUp event or it will not be triggered correctly showing a menu...

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured