|
|
User login
Feeds |
scroll bar in listbox
|
|||||
| Thu, 2005-08-04 05:52 | |
|
Hi,
I am new to Symbian development. I am trying to create a listbox with a vertical scroll bar. I have created the listbox and the focus can be changed with the movement of keys. But the scroll bar is not visible. I am calling SetScrollBarVisibilityL with vertical scroll bar visibility as EAuto. Even EOn doesnt make it visible. Here is my container: // HelloWorldBasicContainer.cpp // Class implemented CHelloWorldBasicContainer #include <aknlists.h> #include <akntabgrp.h> #include <coemain.h> #include "HelloWorldBasicContainer.h" CHelloWorldBasicContainer* CHelloWorldBasicContainer::NewL(const TRect& aRect) { CHelloWorldBasicContainer* self = CHelloWorldBasicContainer::NewLC(aRect); CleanupStack::Pop(self); return self; } CHelloWorldBasicContainer* CHelloWorldBasicContainer::NewLC(const TRect& aRect) { CHelloWorldBasicContainer* self = new (ELeave) CHelloWorldBasicContainer; CleanupStack::PushL(self); self->ConstructL(aRect); return self; } // ---------------------------------------------------------------------------- // void CHelloWorldBasicContainer::CHelloWorldBasicContainer() // Class constructor. // ---------------------------------------------------------------------------- // CHelloWorldBasicContainer::CHelloWorldBasicContainer() { } // ---------------------------------------------------------------------------- // void CHelloWorldBasicContainer::~CHelloWorldBasicContainer() // Virtual destructor. // ---------------------------------------------------------------------------- // CHelloWorldBasicContainer::~CHelloWorldBasicContainer() { delete iListBox; } // ---------------------------------------------------------------------------- // void CHelloWorldBasicContainer::ConstructL(const TRect aRect) // Second phase construction. // ---------------------------------------------------------------------------- // void CHelloWorldBasicContainer::ConstructL(const TRect aRect) { CreateWindowL(); CreateListL(); SetRect(aRect); ActivateL(); } // ---------------------------------------------------------------------------- // TInt CHelloWorldBasicContainer::CountComponentControls() const // Gets the number of controls contained in a compound control. // ---------------------------------------------------------------------------- // TInt CHelloWorldBasicContainer::CountComponentControls() const { return 1; } // ---------------------------------------------------------------------------- // CCoeControl* CHelloWorldBasicContainer::ComponentControl(TInt /* aIndex */) const // Gets the specified component of a compound control. // ---------------------------------------------------------------------------- // CCoeControl* CHelloWorldBasicContainer::ComponentControl(TInt /* aIndex */) const { return iListBox; } // ---------------------------------------------------------------------------- // void CHelloWorldBasicContainer::Draw( const TRect& aRect ) const // Fills the window's rectangle. // ---------------------------------------------------------------------------- // void CHelloWorldBasicContainer::Draw(const TRect& aRect)const { CWindowGc& gc = SystemGc(); Â Â gc.SetPenStyle(CGraphicsContext::ENullPen); Â Â gc.SetBrushColor(KRgbWhite); Â Â gc.SetBrushStyle(CGraphicsContext::ESolidBrush); Â Â gc.DrawRect(aRect); } // ---------------------------------------------------------------------------- // void CHelloWorldBasicContainer::HandleListBoxEventL( CEikListBox*, //Â TListBoxEvent ) // Handles listbox event. // ---------------------------------------------------------------------------- void CHelloWorldBasicContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/, TListBoxEvent aEventType) { // if(aEventType == MEikListBoxObserver::EEventEnterKeyPressed) // iEikonEnv->InfoMsg(_L("Not Implemented")); } // ---------------------------------------------------------------------------- // void CHelloWorldBasicContainer::CreateListL() // Creates the list box. // ---------------------------------------------------------------------------- void CHelloWorldBasicContainer::CreateListL() { iListBox = new (ELeave) CAknSingleStyleListBox(); iListBox->SetContainerWindowL(*this); TResourceReader reader; Â Â iEikonEnv->CreateResourceReaderLC(reader, R_MYLISTBOX_SINGLE_1); Â Â iListBox->SetListBoxObserver(this); iListBox->ConstructFromResourceL(reader); Â Â iListBox->CreateScrollBarFrameL( ETrue ); Â Â iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( Â Â Â Â Â Â CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto ); CleanupStack::PopAndDestroy(); SizeChanged(); } // --------------------------------------------------------- // void CHelloWorldBasicContainer::SizeChanged() // Called by framework when the view size is changed // --------------------------------------------------------- // void CHelloWorldBasicContainer::SizeChanged() Â Â { Â Â // TODO: Add here control resize code etc. Â Â iListBox->SetExtent(TPoint(0,0), iListBox->MinimumSize()); Â Â } // ---------------------------------------------------------------------------- // TKeyResponse CHelloWorldBasicContainer::OfferKeyEventL( const TKeyEvent&, //Â TEventCode ) // Handles the key events. // ---------------------------------------------------------------------------- // TKeyResponse CHelloWorldBasicContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) { return iListBox->OfferKeyEventL(aKeyEvent, aType); } I am not able to understand whats going wrong. Please help. |
|
Forum posts: 45
iListBox->SetMopParent(this);
Same thing when creating the container.
Forum posts: 32
But this time, i can not see my listbox and i can get my scrollbar.
It is really strange.
I add SetMopParent(), but the situation did not change!
Any more advice.