diff -r 4816d766a08a -r f345bda72bc4 Symbian3/PDK/Source/GUID-55165C57-0F32-5363-A2EC-E37B5B36B6E1.dita --- a/Symbian3/PDK/Source/GUID-55165C57-0F32-5363-A2EC-E37B5B36B6E1.dita Tue Mar 30 11:42:04 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-55165C57-0F32-5363-A2EC-E37B5B36B6E1.dita Tue Mar 30 11:56:28 2010 +0100 @@ -1,31 +1,31 @@ - - - - - -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() + + + + + +How to set up the text view

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

  • Before constructing the CTextView text view object, first construct a TRect view rectangle, then the CTextLayout layout object to be used by the view.

    Call the CCoeControl::Rect() function to construct the view rectangle.

  • The following must also be provided:

    • A graphics device map for mapping between the physical co-ordinates of the screen or page being drawn to (measured in twips) and the device specific co-ordinates (measured in pixels). Use the CCoeControl::SystemGc() function to get the graphics context

    • a window group for the text view. If a window group is not provided, no cursors can be displayed in the document.

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
\ No newline at end of file