×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    4

    Return of the non-appearing scroll bar

    Like some people before me, I can't get the scroll bars to appear. What I am trying is to create scroll bars for CEikGlobalTextEditor using code like this:

    iInfo = new (ELeave) CEikGlobalTextEditor;

    iInfo->SetAknEditorFlags(EAknEditorFlagEnableScrollBars);
    iInfo->ConstructL(this,
    0,
    0,
    CEikEdwin::ENoAutoSelection |
    CEikEdwin::EResizable |
    CEikEdwin::EAvkonEditor |
    CEikEdwin::EEdwinAlternativeWrapping,
    EGulFontControlAll,
    EGulAllFonts);

    iInfo->SetReadOnly(ETrue);

    iSBFrame = iInfo->CreateScrollBarFrameL();
    iSBFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
    CEikScrollBarFrame::EOn);
    iSBFrame->SetTypeOfVScrollBar(CEikScrollBarFrame::EArrowHead);
    iSBFrame->DrawScrollBarsNow();

    TBool vex = iSBFrame->ScrollBarExists(CEikScrollBar::EVertical);

    The last call call returns 0, which suggests that the scroll bar does not exist at all. iInfo->UpdateScrollBarsL() after the text has been set does not do anything. Have I forgotten something?

  2. #2
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Braunschweig, Germany
    Posts
    345

    Don't forget to use SetMopParent

    Maybe it helps to call SetMopParent for your text editor like it did in the other cases. Your code should look something like this:

    iInfo = new (ELeave) CEikGlobalTextEditor;
    ...
    iInfo.SetMopParent(this);
    ...
    iInfo.ConstructL(...)

    Regards,
    Bernd

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    4
    Doesn't work.

    EDIT: CEikGlobalEditor's ConstructL also takes parent as a parameter (which was already set to this), so the SetMopParent apparently does not do anything. Now I wonder what the MopParent should really point to.
    Last edited by joutsa; 2004-07-22 at 17:30.

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    4

    More confusion

    Okay, I have now stepped through iInfo->UpdateScrollBarsL() to see what happens (if anything should happen). It seems to calculate if the scrollbar should be shown and then size (relic from Psion, I guess) and location for the scroller thumb. Then it attempts to draw the scrollbar, which does not either draw anything or produce anything that would resemble an error. Despite this, ScrollBarExists() returns false.

  5. #5
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Braunschweig, Germany
    Posts
    345
    One problem with scrollbars on the S60 platform is that the area where the scrollbars are drawn belongs to the topmost control. With SetMopParent you have to establish the path so that the element who wants to draw the scrollbar can get to the topmost Control.

    In other words, each control has to call SetMopParent on all the other controls it contains. This has to start with the view class or the AppUi class. The important thing is to call SetMopParent *before* ConstructL.

    If one element in does not call SetMopParent for its component, the editor has no way to get to the control which own the scrollbar area and cannot draw one.

    Regards,
    Bernd

  6. #6
    Registered User
    Join Date
    Jul 2004
    Posts
    4
    Now the view's MopParent is set to AppUI and both controls in the view have MopParent set to the view.

    Not really surprisingly, the scroll bars do not appear, nor does anything that could be interpreted as error message.

    Edit: Read through one working example of scrollbars. SetMopParent is never called there. Even more confusing.
    Last edited by joutsa; 2004-07-23 at 16:05.

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    25
    I have the following code:
    iEditor = new (ELeave) CEikRichTextEditor();
    TResourceReader reader;
    iCoeEnv->CreateResourceReaderLC(reader, R_TEXT_EDITOR);
    iEditor->ConstructFromResourceL(reader);
    CleanupStack::PopAndDestroy();

    iEditor->SetContainerWindowL(*this);
    iEditor->CreatePreAllocatedScrollBarFrameL()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto,
    CEikScrollBarFrame::EAuto);


    And whenever new text has been added to the editor:
    iEditor->HandleTextChangedL();



    -Anders

  8. #8
    Registered User
    Join Date
    Sep 2004
    Posts
    20

    Re: Return of the non-appearing scroll bar

    Hi Anorland, I tried your method for the display of a scroll bar, it's clearly the same code so I don't understand. have you miss something.

    tnx

Posting Permissions

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