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.

      
       
      
      iTextView->SetMarginWidths(0,20);
        // 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();
iBitmap->Load(_L("\\data\\CURSORS.MBM"));
iTextView->SetLineCursorBitmap(iBitmap);
iTextView->SetCursorVisibilityL(TCursor::EFBothCursors);