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'.
Printable View
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'.
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.
Ok, I was just starting to play with that...
Thanks
If that doesn't work here is the custom form bit:
VB Code:
Option Explicit Private Type POINTAPI X As Long Y As Long End Type Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Sub Form_Load() Dim nodX As Node Set nodX = TreeView1.Nodes.Add(, , , "Node1") Set nodX = TreeView1.Nodes.Add(, , , "Node2") Set nodX = TreeView1.Nodes.Add(, , , "Node3") Set nodX = TreeView1.Nodes.Add(, , , "Node4") End Sub Private Sub TreeView1_DblClick() If Not TreeView1.SelectedItem Is Nothing Then Dim pt As POINTAPI GetCursorPos pt Load Form2 Form2.Move pt.X * Screen.TwipsPerPixelX, pt.Y * Screen.TwipsPerPixelY Form2.Show vbModal, Me End If End Sub
You don't need the GetCursorPos API call if you use a TreeView event to get the X and Y.