problem with background when changing view.

Login to reply to this topic.
Sun, 2008-04-13 15:03
Joined: 2007-11-27
Forum posts: 5

Hi,
I have a view with a listbox.I have to switch from this view to anathor view which displays plain text.I am able to switch and display.My problem is,this has a white background over which I am displaying text.I have Draw() function like this.

void CMyViewContainer::Draw( const TRect& aRect ) const
{
CWindowGc& gc = SystemGc();
gc.Clear();
}

I know Clear(); is causing white background.but if I remove this,listbox items from my previous view also get displayed in my current view.I need default theme background over which my text should be displayed.Do I need to deactivate the previous view before switching.Is there any API which can set the theme's default background.Please help,I am not good at UI.Thanx in advance.


Mon, 2008-04-14 09:52
Joined: 2008-01-16
Forum posts: 146
Re: problem with background when changing view.

Hi dattanand,

Check have you enable screen Background in AppUI.
and use this draw function

void CMyViewContainer::Draw( const TRect& aRect ) const
{
CWindowGc& gc = SystemGc();
gc.Clear();
AknsDrawUtils::Background(AknsUtils::SkinInstance(),AknsDrawUtils::ControlContext(this), this, gc, aRect);
}

Hope this code will be helpful for you....


Thanks & Regards,
Md.Khalid Ahmad

Mon, 2008-04-14 13:14
Joined: 2007-11-27
Forum posts: 5
Re: problem with background when changing view.

what do u mean by enabling backgroung in AppUI.I am confused,Is it related to BaseConstructL()?

Mon, 2008-04-14 16:14
Joined: 2007-11-27
Forum posts: 5
Problem with screen size.

I was able to display background.but the background was not drawn on the whole window,some upper portion ans lower portion of the screen(where softkey labels are displayed) was undrawn.I found a quick fix for that.

void CMy ViewContainer::ConstructL( const TRect& aRect )
{
// Creates window.
CreateWindowL();
//SetExtentToWholeScreen();
TInt aWidth = 240;
TInt aHeight = 300;
SetExtent(TPoint(0,0),TSize::TSize(aWidth,aHeight));
.....................
.....................
}

But I have hardcoded the screen size.Is there any API which gives the size of the screen?

Tue, 2008-04-15 05:20
Joined: 2008-01-16
Forum posts: 146
Re: problem with background when changing view.

Hi
AknsDrawUtils::Background(AknsUtils::SkinInstance(),AknsDrawUtils::ControlContext(this), this, gc, aRect);

try this

TRect appRect = iappui->ApplicationRect()
AknsDrawUtils::Background(AknsUtils::SkinInstance(),AknsDrawUtils::ControlContext(this), this, gc, appRect);

Hope you don't need to use hard coded value.

and my first thing was related to BaseConstructL(); you understood right.


Thanks & Regards,
Md.Khalid Ahmad

  • Login to reply to this topic.