splash screen in my application .. Problem
| Tue, 2005-06-07 12:21 | |
|
HI
I want a splash screen in my application I have a markable list box in my application and i want a splash before it . Friends tell me how to do it ... I have gone through the sample example " splash " in this form but got now sucess ............. THE OUTPUT IS A BLACK SCREEN ONLY AND LIST VIEW IS CREATED BEFORE THE SPLASH SCREEN AND AFTER IT SPLASH SCREEN "black screen " remain there I am using following code . ........................................ THIS IS THE CONTAINER ........................................ / INCLUDE FILES #include "List_lContainer.h" #include "eiktxlbm.h" #include <aknselectionlist.h> #include <gulicon.h> //for icons #include <AknIconArray.h> //icon array #include <List_l.rsg> #include <listImages.mbg> #include <msgbiouids.h> #include <msvuids.h> #include <msvids.h> #include <badesca.h> #include <eiklabel.h> // for example label control #include <fbs.h> #include <AknsDrawUtils.h>// skin #include <AknsBasicBackgroundControlContext.h> //skin #include <aknwaitdialog.h> _LIT(KIconFile, "z:\\system\\apps\\LIST_L\\listImages.mbm"); // ================= MEMBER FUNCTIONS ======================= // --------------------------------------------------------- // CList_lContainer::ConstructL(const TRect& aRect) // EPOC two phased constructor // --------------------------------------------------------- // void CList_lContainer::ConstructL(const TRect& aRect) { CreateWindowL(); // CPeriodic iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityStandard); // SETS TICK TO 5000 MICROSECDS SetTimerTick(5000); StartTimer(); SetRect(aRect); CreateMyList(aRect); ActivateL(); } // Destructor CList_lContainer::~CList_lContainer() { StopTimer(); delete iPeriodicTimer; iPeriodicTimer = NULL; if(list) { delete list; list=NULL; } } //=============================================================== // this function creates my list ___ the markable list /// U GUYS NEED NOT TO WARRY ABOUT THIS FUNC //=============================================================== void CList_lContainer::CreateMyList(const TRect& aRect) { TInt iCount =2; _LIT(KListItemFormat, "%d\t%S\t%S\t"); // listbox instanceCAknFormDoubleGraphicStyleListBox list = new (ELeave)CAknDoubleNumberStyleListBox(); // construct listbox list->ConstructL(this,EAknListBoxLoopScrolling | EAknListBoxMultiselectionList| EAknListBoxMarkableList ); // set container control list->SetContainerWindowL(*this); // add scrollbars to listbox list->CreateScrollBarFrameL(ETrue); list->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto ); TInt index; CArrayPtr<CGulIcon>* iconList = new (ELeave) CAknIconArray(iCount); // push to stack CleanupStack::PushL(iconList); list->ItemDrawer()->ColumnData()->SetIconArray( iconList ); for(index=0;index<iCount;index++) { iconList->AppendL( iEikonEnv->CreateIconL( KIconFile, EMbmListimages2listboximage) ); } /**/ // set icons array to list CleanupStack::Pop(); // iconList // construct listbox item array CDesCArray *itemList = new (ELeave) CDesCArrayFlat(iCount); TBuf<80> item; TBuf<20> number; TBuf<256> Data; // first listbox item, graphic salt, heading "head1" for(index=0;index<iCount;index++) { //_LIT(KIconFile1, "c:\\HttpAppImages.mbm"); number=_L(""); Data=_L("Phone Book"); item.Format(KListItemFormat,index+1,&Data,&number /*index*/ ); //item.Copy(number); itemList->AppendL(item); number=_L(""); Data=_L("Messages"); index++; item.Format(KListItemFormat, index+1,&Data,&number /*index,*/); //item.Copy(number); itemList->AppendL(item); } // set items and ownership list->Model()->SetItemTextArray(itemList); list->Model()->SetOwnershipType(ELbmOwnsItemArray); list->HandleItemAdditionL(); list->SetRect(Rect()); } // // this function is used for returning the value of selected item /// U GUYS NEED NOT TO WARRY ABOUT THIS FUNC // TInt CList_lContainer::SelectedItems() { if(list) { CTextListBoxModel * model = list->Model(); if(model->NumberOfItems()>0) { const CListBoxView::CSelectionIndexArray* selectionIndices =list->SelectionIndexes(); TInt num_sel = selectionIndices->Count(); if (num_sel ==1 ) { TInt selected = selectionIndices->At(0); return selected ; } else { if(num_sel==2) { return num_sel; } else return -1; //selectionIndices->At(1); } } } } // --------------------------------------------------------- // CList_lContainer::SizeChanged() // Called by framework when the view size is changed // --------------------------------------------------------- // void CList_lContainer::SizeChanged() { // TODO: Add here control resize code etc. if(list) list->SetRect(Rect()); } // --------------------------------------------------------- // CList_lContainer::CountComponentControls() const // --------------------------------------------------------- // TInt CList_lContainer::CountComponentControls() const { if(list) return 1; return 0;; // return nbr of controls inside this container } // --------------------------------------------------------- // CList_lContainer::ComponentControl(TInt aIndex) const // --------------------------------------------------------- // CCoeControl* CList_lContainer::ComponentControl(TInt aIndex) const { switch ( aIndex ) { case 0: return list; default: return NULL; }; } // --------------------------------------------------------- // CList_lContainer::Draw(const TRect& aRect) const // --------------------------------------------------------- // void CList_lContainer::Draw(const TRect& aRect) const { CWindowGc& gc = SystemGc(); // TODO: Add your drawing code here // example code... // draw background gc.Clear(Rect()); MAknsSkinInstance* skin = AknsUtils::SkinInstance(); MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); AknsDrawUtils::Background( skin, cc, this, gc, aRect ); } //=========================================================== void CList_lContainer::HandleMarkCommandL(TInt aCommand) { if(list) { AknSelectionService::HandleMarkableListProcessCommandL(aCommand,list); } } //======================================= //this is used to move up and down //======================================== TKeyResponse CList_lContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) { if(list) return list->OfferKeyEventL( aKeyEvent, aType); return EKeyWasNotConsumed ; } // --------------------------------------------------------- // CList_lContainer::HandleControlEventL( // CCoeControl* aControl,TCoeEvent aEventType) // --------------------------------------------------------- // void CList_lContainer::HandleControlEventL( CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) { // TODO: Add your control event handler code here } // --------------------------------------------------------- // CList_lContainer::MopSupplyObject() // Pass skin information if needed. // --------------------------------------------------------- // TTypeUid::Ptr CList_lContainer::MopSupplyObject(TTypeUid aId) { return CCoeControl::MopSupplyObject( aId ); } //========================================= // HERE I AM DRAWING THE BLACK SCREEN AS SPLASH //========================================= void CList_lContainer::DrawSplash(const TRect& /*aRect*/) const { CWindowGc& gc = SystemGc(); TRect rect = Rect(); // // Draw Black background // gc.SetPenStyle(CGraphicsContext::ENullPen); gc.SetBrushStyle(CGraphicsContext::ESolidBrush); gc.SetBrushColor(KRgbBlack); gc.DrawRect(rect); } TInt CList_lContainer::Period(TAny* aPtr) { ((CList_lContainer*)aPtr)->DoPeriod(); return FALSE ; } void CList_lContainer::DoPeriod() { // Update the screen CWindowGc& gc = SystemGc(); gc.Activate(*DrawableWindow()); DrawSplash(Rect()); gc.Deactivate(); } TBool CList_lContainer::Tick() { return ETrue ; } void CList_lContainer::StartTimer() { if (!iPeriodicTimer->IsActive()) { iPeriodicTimer->Start(iTick,iTick,TCallBack(CList_lContainer::Period,this)); } } void CList_lContainer::StopTimer() { if (iPeriodicTimer->IsActive()) { iPeriodicTimer->Cancel(); } } void CList_lContainer::SetTimerTick(TTimeIntervalMicroSeconds32 aTick) { iTick=aTick; } // End of File |
|






Forum posts: 1379
Window().Invalidate();
ActivateGc();
Window().BeginRedraw();
DrawSplash(Rect());
Window().EndRedraw();
DeactivateGc();
didster
Forum posts: 39
I tryied it this way but its not working for me ...
can u be a bit more spacific or have some alternative way to make a splash screen on an Markable list view
Any buddy else have any pointer for this problem
any suggestion will be of greate help
Veeraj Thaploo