×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    19

    Question Creating a view with 2 text editors

    I would like to create a view with two text editors. The first one should have only a one line, and the second should have multiple lines. The layout should be vertical, and I would like to use nice background (from theme or so), and draw a border or a separator for these editors.

    What is the best way to implement this kind of scenario? Could I re-use the control from Notes application or is that embedded in such a way that I couldn't add a extra one-line editor?

    For now I have implemented two CEikEdwin controls which are layed out by the container. However, I have a few problems. I am not able to draw a border with TGulBorder (as described in Wiki), I don't know how to set height for 1 row edwin without hard coding pixel value or where should I read fonts or colors to achieve similar look as built-in apps.

    Any pointers are appreciated. Thank you in advance.

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    19

    Re: Creating a view with 2 text editors

    Oh, I've battled with this quite a bit... my extra editor is two lines high, but I guess it's the same principle. What I do is actually force the font and line gap on both editors.

    I start with CEikonEnv::DenseFont, and use its FontSpecInTwips for TCharFormat and FontLineGap for CParaFormat (combined with CParaFormat::ELineSpacingExactlyInPixels). This forces the line height in pixels to a value I know.
    The editor also has borders around the text itself; I calculated the total height of those borders using editor->Rect().Height() - editor->TextView()->ViewRect().Height() after construction...
    Then, the total height of the editor is (total_borders_height) + (line_count * line_height). line_count in my case is 2. I've tested it with other line_count values, as well as different devices and screen layouts (e.g. on N95) and it worked fine.
    HTH,
    If you have questions go ahead, I know this isn't so clear...
    Uriah

  3. #3
    Registered User
    Join Date
    Feb 2007
    Posts
    27

    Re: Creating a view with 2 text editors

    HtmlControl meets your need.

    Take a look,
    http://code.google.com/p/htmlcontrol...n/wiki/Form_ss

  4. #4
    Registered User
    Join Date
    Feb 2009
    Posts
    19

    Re: Creating a view with 2 text editors

    Thanks for the tips.

    I ended up using 2 CEikEdwins. I layed them out with AknLayoutUtils::LayoutEdwin. Background problems I fixed by enabling skin support for the container. I also Added pointer handling to container to change focus if non-focused edwin was tapped.

    Here is some code I used.

    Skin support in void Draw(const TRect&)
    Code:
    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    MAknsControlContext* context = AknsDrawUtils::ControlContext(this);
    AknsDrawUtils::Background(skin, context, this, gc, aRect);
    Layout in void LayoutControls()
    Code:
    AknLayoutUtils::LayoutEdwin(iTitleEditor,
    	titleRect,
    	EAknLogicalFontPrimaryFont,
    	0,
    	0,
    	0,
    	font->FontMaxHeight(),
    	titleRect.Width(),
    	ELayoutAlignLeft,
    	lines,
    	0,
    	EAknsCIQsnTextColorsCG13);
    Pointer event handling in void HandlePointerEventL(const TPointerEvent&)
    Code:
    if (iTitleEditor->Rect().Contains(aPointerEvent.iPosition))
    	{
    	iTitleEditor->SetFocus(ETrue);
    	iTextEditor->SetFocus(EFalse);
    	iFocusControl = iTitleEditor;
    	iTitleEditor->HandlePointerEventL(aPointerEvent);
    	}
    else if (iTextEditor->Rect().Contains(aPointerEvent.iPosition))
    	{
    	iTextEditor->SetFocus(ETrue);
    	iTitleEditor->SetFocus(EFalse);
    	iFocusControl = iTextEditor;
    	iTextEditor->HandlePointerEventL(aPointerEvent);
    	}

Similar Threads

  1. Problem creating FEP-aware text control
    By mike.b in forum Symbian User Interface
    Replies: 7
    Last Post: 2010-11-22, 10:17
  2. Creating CEikBitmapButton with Text
    By anoopd in forum Symbian User Interface
    Replies: 5
    Last Post: 2009-02-04, 09:12
  3. Replies: 4
    Last Post: 2007-08-31, 07:32
  4. Creating Text file
    By Gill in forum Symbian User Interface
    Replies: 10
    Last Post: 2007-03-08, 06:46
  5. Replies: 0
    Last Post: 2004-10-07, 08:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •