SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
The right mouse button is released or Shift-F10 is pressed requesting a context menu.
VB.NET | Private Sub object_ContextMenuEvent(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.ContextMenuEvent |
VB | Private Sub object_ContextMenu(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As OLE_XPOS_PIXELS, ByVal y As OLE_YPOS_PIXELS) |
C#.NET | void object_ContextMenuEvent(object sender, EventArgumentType e); |
VC++ | void OnContextMenuobject(short Button, short Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y); |
C | HRESULT OnContextMenuobject(short Button, short Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y); |
object
Button
The button that is pressed during the event (see SftTreeButtonConstants). The button argument is a bit field with bits corresponding to the left button, right button and middle button. These bits correspond to the values shown below. Only one of the bits is set, indicating the button that caused the event.
Button | Value | Description |
---|---|---|
constSftTreeLeftButton | 1 | The left mouse button was pressed. |
constSftTreeRightButton | 2 | The right mouse button was pressed. |
constSftTreeMiddleButton | 4 | The middle mouse button was pressed. |
Shift
The state of the SHIFT, CONTROL and ALT keys during the event (see SftTreeKeyConstants). A bit is set if the key is down. The Shift argument is a bit field with bits corresponding to the SHIFT, CONTROL and ALT keys. The Shift variable indicates the state of these keys. Some, all, or none of the bits can be set, indicating which of the keys are pressed.
Shift | Value | Description |
---|---|---|
constSftTreeShiftMask | 1 | The SHIFT key was pressed. |
constSftTreeCtrlMask | 2 | The CONTROL key was pressed. |
constSftTreeAltMask | 4 | The ALT key was pressed. |
x
The x coordinate of the mouse cursor when the button was pressed. If x and y are -1, the user pressed Shift-F10.
y
The y coordinate of the mouse cursor when the button was pressed. If x and y are -1, the user pressed Shift-F10.
The ContextMenu event occurs when the right mouse button is released or Shift-F10 is pressed requesting a context menu.
An application can display a context menu in response to this event. Before displaying the popup menu, the CancelMode method must be called.
Private Sub menuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuItem3.Click MessageBox.Show("This sample doesn't implement any actions for the item menu. Try the column headers instead.") End Sub Private Sub menuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuItem4.Click MessageBox.Show("This sample doesn't implement any actions for the item menu. Try the column headers instead.") End Sub Private Sub AxSftTree1_ContextMenuEvent(ByVal sender As Object, ByVal e As AxSftTreeLib75._DSftTreeEvents_ContextMenuEvent) Handles AxSftTree1.ContextMenuEvent Dim P As Point P = AxSftTree1.PointToScreen(New Point(e.x, e.y)) ' Determine click context menu for header or item Dim L As Integer, T As Integer, H As Integer, W As Integer AxSftTree1.Headers.GetPositionPix(L, T, W, H) If e.x >= L And e.x < L + W And e.y >= T And e.y <= T + H Then
End If MenuForm.ShowAll.Enabled = Count < 3 SftTree1.CancelMode PopupMenu MenuForm.HeaderPopup End Sub Private Sub SftTree1_ContextMenu(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) ' Determine click context menu for header or item Dim l As Single, t As Single, h As Single, w As Single SftTree1.Headers.GetPosition l, t, w, h If X >= l And X < l + w And Y >= t And Y <= t + h Then HeaderMenu Exit Sub
private void menuItem3_Click(object sender, System.EventArgs e) { MessageBox.Show("This sample doesn't implement any actions for the item menu. Try the column headers instead."); } private void menuItem4_Click(object sender, System.EventArgs e) { MessageBox.Show("This sample doesn't implement any actions for the item menu. Try the column headers instead."); } private void axSftTree1_ContextMenuEvent(object sender, AxSftTreeLib75._DSftTreeEvents_ContextMenuEvent e) { Point point = axSftTree1.PointToScreen(new Point(e.x, e.y)); // Determine click context menu for header or item int l, t, h, w; axSftTree1.Headers.GetPositionPix(out l, out t, out w, out h); if (e.x >= l && e.x < l + w && e.y >= t && e.y <= t + h) {
m_vTree->Column[colIndex]->WidthPix = 0; else m_vTree->Column[colIndex]->MakeOptimal(); m_vTree->Items->RecalcHorizontalExtent(); } BEGIN_EVENTSINK_MAP(CBookTableDlg, CDialog) //{{AFX_EVENTSINK_MAP(CBookTableDlg) ON_EVENT(CBookTableDlg, IDC_SFTTREE1, 35 /* ContextMenu */, OnContextMenuSftTree1, VTS_I2 VTS_I2 VTS_I4 VTS_I4) ON_EVENT(CBookTableDlg, IDC_SFTTREE1, 4 /* ItemClick */, OnItemClickSftTree1, VTS_I4 VTS_I2 VTS_I2 VTS_I2 VTS_I2) ON_EVENT(CBookTableDlg, IDC_SFTTREE1, 5 /* ItemDblClick */, OnItemDblClickSftTree1, VTS_I4 VTS_I2 VTS_I2 VTS_I2 VTS_I2) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP()
See Also SftTree Object | Object Hierarchy