Help!the use of CQikScrollableContainer for scrol
| Thu, 2005-03-03 10:06 | |
|
My view is derived from CCoeControland Mcoeview,but the visible part of the screen couldn't show all infomation.I reviewed the SDK document and found class CQikScrollableContainer maybe resolve my problem.In the View,some code below:
void myview::construct(); { scrollPage = new (ELeave) CQikScrollableContainer; scrollPage->SetContainerWindowL(*this); scrollPage->ConstructL(EFalse); scrollPage->SetRect(TRect (0, 0, 130, 120)); CEikScrollBarFrame* frame = scrollPage->ScrollBarFrame(); frame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOn, CEikScrollBarFrame::EOn ); frame->SetScrollBarControlType( CEikScrollBar::EHorizontal, EQikCtArrowHeadPageScrollBar ); frame->SetScrollBarManagement( CEikScrollBar::EHorizontal, CEikScrollBarFrame::EFloating ); TSize minPageSize = scrollPage->MinimumPageSize(); scrollPage->SetPageSize(minPageSize); } scrollPage is defined in .h file,but in my view nothing appear~~~~~ What is missing in my program ? Any more detailed infomation needed ? Thanks, sincerely! [/b] Code:
|
|






Forum posts: 53
it's not easy to understand exactly what's going wrong without see other parts of the code.
anyway there are a few general notes that's so easy to forget (I know by experience).
(1) return number and pointers of the subcontrols
Never forget to implement:
TInt myview::CountComponentControls() const
CCoeControl* myview::ComponentControl(TInt aIndex) const
(2) Set visibility.
void myview::construct();
{
>construct your controls)
SetComponentsToInheritVisibility();
}
all sub components will inherit the view's visibility.
(3) size of the scrollPage.
From the code you posted I don't see that you added any controls into the scrollpage.
If the scrollpage is empty scrollPage->MinimumPageSize() will return a zero TSize.
Thus for your code the size of the scroll page will be set to 0 and never updated.
You can use your code
scrollPage->SetPageSize(minPageSize);
If you want to set the size at construction time, calculate the available "space" for your scrollpage and set its size according to it.
(4) Update scrollbars
If dynamically add/remove controls from the scrollpage, it will be useful to use the following code:
scrollPage->UpdateScrollBarsL();