Backgroun skin in 3rd edition

Login to reply to this topic.
Mon, 2007-04-02 10:02
Joined: 2006-03-06
Forum posts: 106
hi,

i am working on symbian os 9.1
i want to add my own skin in background.
i have studied and implement the tutorial provided by eric.
i am able to add my own skin but skin is not coming on whole screen . Lower portion of the screen remains white. Also svg icons added to the listbox are not displayed properly(a white boundary created around each icon ).
you can have a look at the attatched image for more clear view.

code i implement is written below:

In header file
Code:
CAknsBasicBackgroundControlContext*  iBackGround;

In .cpp file
in constructL function
Code:
TRect rect = CEikonEnv::Static()->EikAppUi()->ApplicationRect();
TAknsItemID skinItemId;
skinItemId.iMinor =EAknsMinorQsnBgAreaStatus;
skinItemId.iMajor = EAknsMajorSkin ;
    iBackGround = CAknsBasicBackgroundControlContext::NewL( skinItemId , rect, ETrue );
MAknsSkinInstance* aknsSkinInstance = AknsUtils::SkinInstance();
CAknsItemDef *bgItemDef = AknsUtils::CreateBitmapItemDefL(skinItemId, myUi.GetMbmPathL( CMyUi::EMbmSkin ),EMbmFonobackupBack_screen);
    aknsSkinInstance->SetLocalItemDefL( bgItemDef );

TAknsItemID skinItemId2;
skinItemId2.iMinor =   EAknsMinorQsnBgAreaMainListGene;

skinItemId2.iMajor = EAknsMajorSkin ;
    MAknsSkinInstance* aknsSkinInstance2 = AknsUtils::SkinInstance();
CAknsItemDef *bgItemDef2 = AknsUtils::CreateBitmapItemDefL(skinItemId2, myUi.GetMbmPathL( CMyUi::EMbmSkin ),EMbmFonobackupRegistrationimage);
    aknsSkinInstance2->SetLocalItemDefL( bgItemDef2 );

In draw function
Code:
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
      TBool aa = AknsDrawUtils::Background( skin, cc, this, gc, aRect );

In sizechanged function
Code:
if(iBackGround)
{
  iBackGround->SetRect(Rect());
             if ( &Window() )
             {
                  iBackGround->SetParentPos( PositionRelativeToScreen() );
             }
}

In MopSupplyObject function
Code:
if(aId.iUid == MAknsControlContext::ETypeId && iBackGround)
  {
        return MAknsControlContext::SupplyMopObject( aId, iBackGround);
      }

       return CCoeControl::MopSupplyObject( aId );

if my question is not cleaner then let me know.

regards
Himanshu
AttachmentSize
screen.JPG18.9 KB

Wed, 2007-04-04 06:14
Joined: 2006-03-06
Forum posts: 106
Re: Backgroun skin in 3rd edition
hi
there is no one in the forum who can help me out.

regards
Himanshu
Wed, 2007-04-04 16:41
Forum Nokia Champion
Joined: 2004-05-26
Forum posts: 732
Re: Backgroun skin in 3rd edition
Thu, 2007-04-05 10:13
Joined: 2006-03-06
Forum posts: 106
Re: Backgroun skin in 3rd edition
hi vin2talks,

thanks for replying.
actually i don't want to hide cba area. i just want to display my own skin on full screen excluding cba. i have also set the background skin rect as you can see in size changed function.

regards
Himanshu
Tue, 2007-04-10 10:47
Joined: 2006-03-06
Forum posts: 106
Re: Backgroun skin in 3rd edition
hi,

Pls help me.
i have made an observation that if i remove listbox from my view than skin comes on whole screen. This means that i am facing problem because of listbox.
Although i insert the statement
Code:
iMainViewListBox->ItemDrawer()->ColumnData()->SetSkinEnabledL(ETrue);
 but of no use. I am using CAknDoubleLargeStyleListBox listbox.
please help me in this regard.

regards
Himanshu
Thu, 2007-04-12 11:48
Joined: 2006-03-06
Forum posts: 106
Re: Backgroun skin in 3rd edition
hi,
there is no body in the forum who can help me???

regards
Himanshu
Thu, 2007-04-12 12:45
Joined: 2007-03-14
Forum posts: 3
Re: Backgroun skin in 3rd edition
Quote from: hag_01cs25
hi,

Pls help me.
i have made an observation that if i remove listbox from my view than skin comes on whole screen. This means that i am facing problem because of listbox.
Although i insert the statement
Code:
iMainViewListBox->ItemDrawer()->ColumnData()->SetSkinEnabledL(ETrue);
 but of no use. I am using CAknDoubleLargeStyleListBox listbox.
please help me in this regard.

regards
Himanshu

Code:
CAknsListBoxBackgroundControlContext* context = static_cast<CAknsListBoxBackgroundControlContext*>(iListBox->ItemDrawer()->ColumnData()->SkinBackgroundContext());


TRect lbrect=aRect;
context->SetRect(lbrect);
context->SetBitmap(iBackgroundId);


(use your id!)

Code:
if (iBgContext) {
iBgContext->SetRect(Rect());
if ( &Window() ) {
iBgContext->SetParentPos( PositionRelativeToScreen() );
}
}

to get a different rect you can use
Code:
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EApplicationWindow, appRect);
you can also add application rect to other rect

I used all this code inside SizeChanged() method, also I set listbox rect, so there are no problem even when I switch from landscape to portrait

also bg context instanciated this way
Code:
iBgContext = CAknsBasicBackgroundControlContext::NewL( iBackgroundId,aRect,ETrue);

(with relative setted to true)

Hope that this help,
Daniele
Sat, 2007-06-02 18:17
Joined: 2007-04-17
Forum posts: 2
Re: Backgroun skin in 3rd edition
Can we set skin for CEikTextListBox? I use CEikTextListBox in my container, which has a transparent skin, but it doesn't show the text of the listbox.
Sat, 2007-12-29 07:05
Joined: 2007-07-24
Forum posts: 55
Backgroun skin in 3rd edition

HI friends,
I have used whatever u posted for listbox with background image in 3rd edition.but the application getting closed in
this line
aknsSkinInstance->SetLocalItemDefL( bgItemDef );
Here exception generated.
so please tell me how can i do it.
Regards
mitu

Fri, 2008-02-08 08:55
Joined: 2008-02-05
Forum posts: 1
Re: Backgroun skin in 3rd edition

you have also to change the listbox background context rect

on listbox contrusction

iListBox->ItemDrawer()->ColumnData()->SetSkinEnabledL(ETrue);
CAknsListBoxBackgroundControlContext* context =
static_cast(iListBox->ItemDrawer()->ColumnData()->SkinBackgroundContext());
TRect bgRect = aRect; //aRect - listbox rect
bgRect.iTl.iY -= 20; //for example i editing this rect
context->SetRect(bgRect); //change the rect of context

  • Login to reply to this topic.