Type | Description | |||
Start as Long | A long expression that indicates the starting of the context | |||
Context as String | A string expression that defines the context. |
The OnContext event notifies your application that user invokes the control's context window. By default, the control displays the context window if the user presses the CTRL + SPACE combination. Use the ContextKey property to define the key combination that's used to display the control's context window. The version 1.0.3.4 introduces the OnContext event that's fired if the control is not read only, and the user opens the control's context menu ( pressing the CTRL + SPACE key combination ). The OnContext event passes the context string and the position where the context begins. Use the OnContext event to notify your application that the user asks for a context. For instance, during the OnContext event you can add a collection of the items, based on the context you have, using the Add method of the Context object. Use the CaretPos and CaretLine properties to determine the position of the cursor inside the text. Use the TextLine property to retrieve line at the cursor.
Syntax for OnContext event, /NET version, on:
private void OnContext(object sender,int Start,string Context) { } Private Sub OnContext(ByVal sender As System.Object,ByVal Start As Integer,ByVal Context As String) Handles OnContext End Sub |
private void OnContext(object sender, AxEXEDITLib._IEditEvents_OnContextEvent e) { } void OnOnContext(long Start,LPCTSTR Context) { } void __fastcall OnContext(TObject *Sender,long Start,BSTR Context) { } procedure OnContext(ASender: TObject; Start : Integer;Context : WideString); begin end; procedure OnContext(sender: System.Object; e: AxEXEDITLib._IEditEvents_OnContextEvent); begin end; begin event OnContext(long Start,string Context) end event OnContext Private Sub OnContext(ByVal sender As System.Object, ByVal e As AxEXEDITLib._IEditEvents_OnContextEvent) Handles OnContext End Sub Private Sub OnContext(ByVal Start As Long,ByVal Context As String) End Sub Private Sub OnContext(ByVal Start As Long,ByVal Context As String) End Sub LPARAMETERS Start,Context PROCEDURE OnOnContext(oEdit,Start,Context) RETURN |
<SCRIPT EVENT="OnContext(Start,Context)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function OnContext(Start,Context) End Function </SCRIPT> Procedure OnComOnContext Integer llStart String llContext Forward Send OnComOnContext llStart llContext End_Procedure METHOD OCX_OnContext(Start,Context) CLASS MainDialog RETURN NIL void onEvent_OnContext(int _Start,str _Context) { } function OnContext as v (Start as N,Context as C) end function function nativeObject_OnContext(Start,Context) return |
The following VB sample displays the current line when the OnContext event occurs:
Private Sub Edit1_OnContext(ByVal Start As Long, ByVal Context As String) With Edit1 Debug.Print "Current line: " & .TextLine(.CaretLine) End With End Sub
The following C++ sample displays the current line when the OnContext event occurs:
void OnOnContextEdit1(long Start, LPCTSTR Context) { OutputDebugString( m_edit.GetTextLine( m_edit.GetCaretLine() ) ); }
The following VB.NET sample displays the current line when the OnContext event occurs:
Private Sub AxEdit1_OnContext(ByVal sender As Object, ByVal e As AxEXEDITLib._IEditEvents_OnContextEvent) Handles AxEdit1.OnContext With AxEdit1 Debug.WriteLine(.get_TextLine(.CaretLine)) End With End Sub
The following C# sample displays the current line when the OnContext event occurs:
private void axEdit1_OnContext(object sender, AxEXEDITLib._IEditEvents_OnContextEvent e) { System.Diagnostics.Debug.WriteLine(axEdit1.get_TextLine(axEdit1.CaretLine)); }
The following VFP sample displays the current line when the OnContext event occurs:
*** ActiveX Control Event *** LPARAMETERS start, context with thisform.Edit1 wait window nowait .TextLine(.CaretLine) endwith