×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    156

    How to create a text object ?

    I want to use the method CEikEdwin::TextLength ( )

    In the SDK help ,it is:
    IMPORT_C TInt CEikEdwin::TextLength ( ) const

    Gets the number of characters in the Edwin control.
    Returns:
    the number of characters in the Edwin
    Remarks:
    A text object must exist prior to this call

    But I don't know how to create a text object , which method should I use?

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: How to create a text object ?

    have you just tried on using it with fully constructed Edwin (or derived class), most likely Edwin constructs the text object when you call its construct functions.

    yucca

  3. #3
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    156

    Re: How to create a text object ?

    yes, I have put some character into the Edwin , but when I use the TextLength(), it crash :(

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: How to create a text object ?

    hmm, interesting. Maybe you could then try a workaround solutions, something like this:

    TInt TestLength = iMyEdwin->Text()->DocumentLength();

    yucca

  5. #5
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    156

    Re: How to create a text object ?

    Thank you !I will have a try.

  6. #6
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    156

    Re: How to create a text object ?

    My application crash too though I used the code:
    TInt TestLength = iMyEdwin->Text()->DocumentLength();
    instead of TextLength() to get the text length, why?

  7. #7
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: How to create a text object ?

    Ok then, what is the error code shown during the crash ?
    Which line is causing it ?

    And how do you construct your editor ?

    yucca

  8. #8
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    156

    Re: How to create a text object ?

    my text editor construct:
    in ConstrucL()
    {
    TResourceReader reader;
    iCoeEnv->CreateResourceReaderLC(reader, TESTVIEWAPP_VIEW);
    iEdwin = new (ELeave) CEikEdwin;
    iEdwin->CreatePreAllocatedScrollBarFrameL();
    iEdwin->SetContainerWindowL(*this);
    iEdwin->ConstructFromResourceL(reader);
    iEdwin->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
    iEdwin->ScrollBarFrame()->SetTypeOfVScrollBar(CEikScrollBarFrame::EArrowHead);
    iEdwin->ScrollBarFrame()->DrawScrollBarsNow();
    CleanupStack::PopAndDestroy(); // Resource reader
    iEdwin->SetExtent(TPoint(EDWIN_STARTPOINT_X,EDWIN_STARTPOINT_Y), TSize(EDWIN_SIZE_WIDTH,EDWIN_SIZE_HEIGHT));
    }
    And my new method:
    void CMyView::AppendTextL(const TDesC &aText)
    {
    TInt len = iEdwin->TextLength();
    iEdwin->InsertDeleteCharsL(len, aText, TCursorSelection(0, 0));
    iEdwin->SetCursorPosL(len+aText.Length(), EFalse);

    }
    I set the break point at InsertDeleteCharsL(),there are a messagebox"The thread has existed"

  9. #9
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: How to create a text object ?

    hmm, I think I have never used that inserting function. Uusually I define separate RichText object and use that5 for inserting stuff into the edwin. Anyway, maybe you could use the plaintext object from edwin directly to add text into it, by doing something like this:

    iMyEdwin->Text()->InsertL(iMyEdwin->Text()->DocumentLength(),aText);

    yucca

  10. #10
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    156

    Re: How to create a text object ?

    Thank you!symbianyucca, you are No1! Your method works. :)

Similar Threads

  1. How to create a Ticker (scrolling text) ??
    By TeachMe in forum Symbian
    Replies: 1
    Last Post: 2006-05-18, 13:51
  2. Can I create Text box from canvas
    By bvsbh in forum Mobile Java General
    Replies: 6
    Last Post: 2005-12-21, 16:43
  3. How to create a simple text editor
    By serenade in forum Symbian User Interface
    Replies: 8
    Last Post: 2004-02-28, 13:24
  4. Clearing Label Text
    By tejinderka in forum Symbian
    Replies: 3
    Last Post: 2003-09-19, 10:53

Posting Permissions

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