event BookmarkChange (Index as Long)
Occurs when the user adds or removes bookmarks.

 TypeDescription 
   Index as Long A long expression that indicates the line being changed.  

The BokmarkChange event notifies your application that user changes the line's bookmark. The BookmarkWidth property specifies whether the bookmarks header is visible or hidden. The Bookmark property specifies whether a line has a bookmark. The BookmarksList property specifies the lines with bookmarks. Use the TextLine property to retrieve a line by its index. Use the NextBookmark method to move the cursor to the next bookmark. Use the PrevBookmark method to move the cursor to the prior bookmark.

The following VB sample displays the lines with bookmarks:

Private Sub Edit1_BookmarkChange(ByVal Index As Long)
    With Edit1
        Dim i As Long, b As Variant
        b = .BookmarksList
        For i = LBound(b) To UBound(b)
            Debug.Print .TextLine(b(i))
        Next
    End With
End Sub

The following C++ sample displays the lines with bookmarks:

void OnBookmarkChangeEdit1(long Index) 
{
	COleVariant vtBookmarks = m_edit.GetBookmarksList();
	SAFEARRAY* pBookmarks = V_ARRAY( &vtBookmarks );
	long nDim = 0;
	for ( long i = pBookmarks->rgsabound[nDim].lLbound; i < (long)pBookmarks->rgsabound[nDim].cElements; i++ )
	{
		long nLine = 0;
		SafeArrayGetElement( pBookmarks, &i, &nLine );
		OutputDebugString( m_edit.GetTextLine( nLine ) );
	}
}

The following VB.NET sample displays the lines with bookmarks:

Private Sub AxEdit1_BookmarkChange(ByVal sender As Object, ByVal e As AxEXEDITLib._IEditEvents_BookmarkChangeEvent) Handles AxEdit1.BookmarkChange
    With AxEdit1
        Dim i As Integer, b As Integer() = .BookmarksList
        For Each i In b
            Debug.WriteLine(.get_TextLine(i))
        Next
    End With
End Sub

or

Private Sub AxEdit1_BookmarkChange(ByVal sender As Object, ByVal e As AxEXEDITLib._IEditEvents_BookmarkChangeEvent) Handles AxEdit1.BookmarkChange
    With AxEdit1
        Dim i As Long, b As Object
        b = .BookmarksList
        For i = LBound(b) To UBound(b)
            Debug.WriteLine(.get_TextLine(b(i)))
        Next
    End With
End Sub

The following C# sample displays the lines with bookmarks:

private void axEdit1_BookmarkChange(object sender, AxEXEDITLib._IEditEvents_BookmarkChangeEvent e)
{
	int[] b = axEdit1.BookmarksList as int[];
	foreach (int i in b)
		System.Diagnostics.Debug.WriteLine(axEdit1.get_TextLine(i));
}

The following VFP sample displays the lines with bookmarks:

*** ActiveX Control Event ***
LPARAMETERS index

with thisform.Edit1
	local b, i
	b = .BookmarksList
	for i = 1 to alen(b)
		wait window .TextLine(b[i])
	next
endwith

 


Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.