property Edit.BookmarksList as Variant
Specifies the list of bookmarks..

 TypeDescription 
   Variant An array of long values that specifies the list of bookmarks in the list.  

Use the BookmarkList property to access all bookmarks in the control. Use the Bookmark property to bookmark a specified line. Use the BookmarkWidth property to display the control's bookmark border. The BookmarkChange event is fired when user adds or removes bookmarks to the control. Use the BookmarkImage property to change the icon being displayed as a bookmark. 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 bookmarks the first, third and fifth line in the control:

With Edit1
    
        .BookmarkWidth = -1
        .LineNumberWidth = -1
        
        Dim list(3) As Long
        list(0) = 1
        list(1) = 3
        list(2) = 5
        .BookmarksList = list
        
End With

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-2016 Exontrol.COM, Software. All rights reserved.