Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



How to set up the text view

The following code constructs a text view, first allocating and constructing all its parameters.

The view rectangle is the rectangle in which all text, cursors and labels will be displayed. It resides within the view window and can be smaller than it.

TRect iViewRect; // rectangle in which to view text
CTextLayout* iLayout; // text layout
CTextView* iTextView; // text view
CRichText* iRichText; // rich text document
// prerequisites for view - viewing rectangle
iViewRect=Rect(); // Construct view rectangle
// layout
iLayout=CTextLayout::NewL(iRichText,iViewRect.Width()); 
        // construct layout, giving width of view rectangle
// context and device
CWindowGc& gc=SystemGc(); // get graphics context
CBitmapDevice* device=(CBitmapDevice*) (gc.Device()); // device
// text view
iTextView=CTextView::NewL(iLayout, iViewRect,
        device,
        device,
        &Window(),
        &iCoeEnv->RootWin(), // window group, needed for cursor
        &iCoeEnv->WsSession()
        ); // new view