Forum Discussion
Dmitry_Nikolaev
14 years agoStaff
Hi Ricardo,
It would be perfect if you described exactly how the menu control is bound to objects in your application so we can think about supporting this in the future.
In the meantime, you can use a custom script for selecting an item from the context menu:
...
'Clicks the '|Solution (stripMenu)|stripMenu|Basic' item of the 'ProjectOverviewTreeView' tree with the right mouse button.
Call Aliases.nxtSTUDIO.DefaultWorkbench1.ToolStripContainer.ToolStripContentPanel.Panel.DockPanel.DockWindow2.DockPane.PadContentWrapper.Panel.ProjectOverviewTreeView.ClickItemR("|Solution (stripMenu)|stripMenu|Basic")
'Clicks at point (26, 17) of the 'ContextMenuStrip' object.
Call ClickMenuItem(Aliases.nxtSTUDIO.ContextMenuStrip, "Rename")
...
Function ClickMenuItem(menu, path)
Dim i, items, item, found, x, y, point
items = Split(path, "|")
' Find the menu item to click
found = False
For i = 0 To menu.Items.Count - 1
Set item = menu.Items.Item(i)
If item.Text.OleValue = items(0) Then
found = true
Exit For
End If
Next
If Not found Then
Log.Error "The '" & items(0) & "' menu item is not found"
ClickMenuItem = False
Exit Function
End If
' Calculate the menu item's screen coordinates and click
Set point = menu.PointToScreen(item.Bounds.Location)
x = point.X + item.Bounds.Width / 2
y = point.Y + item.Bounds.Height / 2
Call Sys.Desktop.MouseDown(VK_LBUTTON, x, y)
Call Sys.Desktop.MouseUp(VK_LBUTTON, x, y)
Delay 250
' Proceed to the next item in the path
If UBound(items) > 0 Then
ReDim newPath(UBound(items) - 1)
For i = 0 To UBound(newPath)
newPath(i) = items(i + 1)
Next
If Not ClickMenuItem(item.DropDown, Join(newPath, "|")) Then
ClickMenuItem = False
Exit Function
End If
End If
ClickMenuItem = True
End Function
Related Content
- 10 months agolodecesa
- 5 years agosithgecko
- 4 years agosparrowenclave
Recent Discussions
- 6 hours agoSvetaG