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:
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?
Don't forget to use SetMopParent
2004-07-22, 15:09#2
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.
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.
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.
I have the following code:
iEditor = new (ELeave) CEikRichTextEditor();
TResourceReader reader;
iCoeEnv->CreateResourceReaderLC(reader, R_TEXT_EDITOR);
iEditor->ConstructFromResourceL(reader);
CleanupStack::PopAndDestroy();