Results 1 to 4 of 4

Thread: Alternate to Context Menu

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Location
    Michigan
    Posts
    7

    Question Alternate to Context Menu

    Anybody have some quick simple solution for using a form in place of a context menu. I have subclassed a TreeView control to be able to use the PopupMenu command, but I want to be able to allow actual text input in the 'context menu'.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You can use an InputBox for entry? If not then it's just a matter of showing another form vbModal and moving it to the current X,Y postion.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Location
    Michigan
    Posts
    7
    Ok, I was just starting to play with that...
    Thanks

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    If that doesn't work here is the custom form bit:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Type POINTAPI
    4.     X As Long
    5.     Y As Long
    6. End Type
    7.  
    8. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    9.  
    10.  
    11. Private Sub Form_Load()
    12.     Dim nodX As Node
    13.    
    14.     Set nodX = TreeView1.Nodes.Add(, , , "Node1")
    15.     Set nodX = TreeView1.Nodes.Add(, , , "Node2")
    16.     Set nodX = TreeView1.Nodes.Add(, , , "Node3")
    17.     Set nodX = TreeView1.Nodes.Add(, , , "Node4")
    18. End Sub
    19.  
    20. Private Sub TreeView1_DblClick()
    21.    If Not TreeView1.SelectedItem Is Nothing Then
    22.         Dim pt As POINTAPI
    23.         GetCursorPos pt
    24.         Load Form2
    25.         Form2.Move pt.X * Screen.TwipsPerPixelX, pt.Y * Screen.TwipsPerPixelY
    26.         Form2.Show vbModal, Me
    27.     End If
    28. End Sub

    You don't need the GetCursorPos API call if you use a TreeView event to get the X and Y.

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