How to set the cursor

The code in this section sets the line cursor margin and line and text cursor visibility. In order to display the text cursor, a window group must have been set when the text view was constructed. Alternatively, one may be set by calling CTextView::SetDisplayContextL(). Before a line cursor can be displayed, the line cursor margin width must be set and a bitmap line cursor must be specified.

The following code sets the line cursor margin width to 20 pixels and the label margin width to zero.

  • After the margin width is set, call CTextView::DrawL() to ensure the line cursor will be visible.

  • Load in the bitmap used to represent the line cursor.

  • Call CTextView::SetCursorVisibilityL() to select both cursors for display.

        // zero label margin, 20 pixel line cursor margin
iTextView->DrawL(iViewRect); // required to update the view 
// Set bitmap to represent line cursor. First load it in.
iBitmap=new(ELeave) CFbsBitmap();