Discussion Board

Results 1 to 15 of 15
  1. #1
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Germany, Stuttgart
    Posts
    241

    ListBox skin shifted

    Hi,

    i have a full screen skinned application using controls in a containers.
    A screenpart of one container is used by a CAknDoubleLargeStyleListBox.
    Now the backgroundimage of the skin is shifted in the upper direction. Looks very bad.

    A few informations:
    - Skins ARE enabled in the AppUi class.
    - Context i use:
    iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgScreen ,aRect,ETrue);

    - Skin is enabled for the ItemDrawer of the Listbox.

    Without the Listbox, the Background image is shown on the whole screen correctly. In the same container is a selfwritten custom control, also showing the correct image.

    Where could my mistake be? I try to fix for a long time now.

    Regards Andi

  2. #2
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: ListBox skin shifted

    Have a look at http://wiki.forum.nokia.com/index.ph...s_in_container
    I suspect you are not setting the background position in SizeChanged correctly.

  3. #3
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Germany, Stuttgart
    Posts
    241

    Re: ListBox skin shifted

    Thank you for anwering.
    I studied this tutorial before.
    In my SizeChanged Function of the Container, I have exactly the same code for the Background Context.
    So this is a fullscreen container, and the listbox is in the middle of it. Not starting at top of the screen not ending at bottom. Do I have to do other settings in this case for position?
    The background image of the skin is shown correctly except of the area of the listbox.
    Any other possible reasons for this?

    Regards Andi

  4. #4
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: ListBox skin shifted

    Dude, I am not psychic, you will need to post some code and a picture of how it is off, my guess is there is something wrong with either the rect position or size of the background context

  5. #5
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Germany, Stuttgart
    Posts
    241

    Re: ListBox skin shifted

    Ok, here we go:
    The size of the background context seems to be ok, becouse if i remove the controls it is shown and redrawn fullscreen. If I only remove the List, its shown correct as well, only if i put the List on the screen there is the effect you can see on the attached image.

    Edit: not able to attach the image. Tell me how to do!

    Size of the Rect I give to the container:

    iAvkonAppUi->ApplicationRect()

    SizeChanged of the container:

    Code:
    void CMWayFinderMainContainer::SizeChanged()
        {
        iListBox->SetExtent( TPoint(0,26), TSize( Rect().Width(), Rect().Height()-100 ) );
        iMenuControl->SetPosition(TPoint (0,Rect().Height()-80));
        iMenuControl->SetSize(TSize( Rect().Width(), 80 )); 
        if(iBgContext)
            {
            iBgContext->SetRect(Rect());
            if ( &Window() )
                {
                iBgContext->SetParentPos( PositionRelativeToScreen() );
                }
            }
        }
    need other parts of code?

    Regards Andi ( not dude! )

  6. #6
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Germany, Stuttgart
    Posts
    241

    Re: ListBox skin shifted

    So how can i change the position of ListBoxes Background Context?
    I just can set the position of the whole background context, or not?
    So please tell me how I can check and on witch place I have to start searching.
    Or tell me how I can attach an image on a post of this board, that I can show you the displacement of the skin!

    Best regards,
    Andi

  7. #7
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: ListBox skin shifted

    I had a look at how to attach anyhting to a message and it eludes me, so you can always use something like imageshack and post a link from their or drop me an email using the forum and I will send you my real email address.

    You might want to look at the scalable UI examples and AknLayoutUtils as to get the correct height and width of the various screen components. Specifically the scalable UI doc has pictures that show the names of the components and how they relate to the screen elements.

    This is typically a combination of the CAknsBasicBackgroundControlContext constructor rectangle, HandleResource change changing the rectangle and SizeChanged changing the context's SetParentPos position.

  8. #8
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Germany, Stuttgart
    Posts
    241

    Re: ListBox skin shifted

    So here it is:

    http://img297.imageshack.us/img297/8...reendq4.th.jpg

    I checked both things before. But I think I will have another look in example and document.
    But thank you for further information!
    Asking is allways the last instance for me, but I can't see any solution at the moment!

    Regards Andi!

  9. #9
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Germany, Stuttgart
    Posts
    241

    Re: ListBox skin shifted

    I checked a few things, and it seems like listbox is getting the wrong backgroundcontext. KAknsIIDQsnBgAreaMain instead of KAknsIIDQsnBgScreen. How can i pass the other context to the listbox?

    As I said before, the context i use is:

    iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgScreen ,aRect,ETrue);

    if I draw the listbox now on full screen, without any other controls in this container, the background is paintet in the completly same way as on the pictur of the last post.

    I can´t find a way to make the listbox use, the full screen background context.

    Any solutions for this?

    Regards,
    Andi

  10. #10
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: ListBox skin shifted

    The only time I saw this was when I was using a customized listbox - I added my own listbox data object and I had a real window, as opposed to just using it as a container of a window.

    I think it revolved around the fact I needed to use ConstructWithWindowL in the ConstructL for the listbox, rather than CreateWindow and then also call ItemDrawer()->FormattedCellData()->SetControl(this); so that the drawer and control were aligned correctly with the window.

    As I had a custom item drawer (CFormattedCellListBoxItemDrawer) I had to call AknListBoxLayouts::SetupStandardFormListbox(drawer); when creating the drawer though I am not sure its relevant.

    Sorry I can't be more help on this as these are pretty vague due to fact I hacked around quickly over a year ago on this issue and I hav'nt looked at it since then.

  11. #11
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Germany, Stuttgart
    Posts
    241

    Re: ListBox skin shifted

    Unfortunatly it´s no custom listbox, so a call to SetControl will crash.

    On other views of the Application I´m using CAknSingleLargeStyleListBox having the same trouble. Maybe I´ll find the solution in the structure of the containers. ( Although I have no idea where to start search here ) Or it is just really a problem to pass fullscreen backgroundcontext to a normal control.

    So I will let you know if i´ll find a solution for this.
    Maybe I´ll write custom Listboxs just because of the Background.


    Regards
    Andi

  12. #12
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Germany, Stuttgart
    Posts
    241

    Re: ListBox skin shifted

    I had a bit of thime today, for fixing this isue.
    Solution was quite easy. I just wrote a custom listbox, only overwriting the things which are nessesary, getting its own backgoundcontext, overwriting the draw funktion, drawing the background.
    Works fine for me.
    So now i have a full screen skinned app, with listboxes.

    Best regards,
    Andi

  13. #13
    Registered User
    Join Date
    Mar 2003
    Location
    51°11'4.78"N -|- 2°48'27.05"E (Belgium)
    Posts
    730

    Re: ListBox skin shifted

    Andi,

    I'm facing the same problem,
    can you, please, post some stuff of your code ?

    Thanks so much advance,
    Domi.
    ----------------------------------------------------------------------------------
    FExplorer is my baby !

    you can get the FREE version from www.gosymbian.com
    you can get the PRO version from http://store.ovi.com/content/339454

  14. #14
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Germany, Stuttgart
    Posts
    241

    Re: ListBox skin shifted

    Hi.

    Sorry for the late response:

    As i said, i just wrote a custom listbox, with a few overwrites:

    Code:
    CCustomList::CCustomList():CAknSingleGraphicStyleListBox()
    {	
    }
    
    void CCustomList::ConstructL(const CCoeControl* aParent, TInt aFlags)
    	{
    	CAknSingleGraphicStyleListBox::ConstructL(aParent, aFlags);
    	iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgScreen,Rect(),ETrue);
    	iParent = aParent;
    	}
    
    void CCustomList::Draw(const TRect& aRect) const
    {
    	CWindowGc& gc=SystemGc();
    	MAknsSkinInstance* skin = AknsUtils::SkinInstance(); 
    	MAknsControlContext* cc = AknsDrawUtils::ControlContext(this);
    	AknsDrawUtils::Background(skin, cc, this, gc, Rect(), KAknsDrawParamDefault);
    	
    	CAknSingleGraphicStyleListBox::Draw(aRect);
    }
    
    TTypeUid::Ptr CCustomList::MopSupplyObject(TTypeUid aId)
    	{
    	if (aId.iUid == MAknsControlContext::ETypeId && iBgContext != NULL)
    		{
    		return MAknsControlContext::SupplyMopObject(aId, iBgContext);
    		}
    
    	return CCoeControl::MopSupplyObject(aId);
    	}
    
    void CCustomList::SizeChanged()
    	{
    	if(iBgContext)
            {
            iBgContext->SetRect(iBgRect);
            }
    	CAknSingleGraphicStyleListBox::SizeChanged();
            iItemDrawer->SetViewRect(Rect());
    	}
    
    void CCustomList::SetBgRect( TRect aRect )
    {
            iBgRect = aRect;
    	iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgScreen,iBgRect,EFalse);
    }
    This should help you i think!

    Regards,
    Andi

  15. #15
    Registered User
    Join Date
    Mar 2003
    Location
    51°11'4.78"N -|- 2°48'27.05"E (Belgium)
    Posts
    730

    Re: ListBox skin shifted

    Thanks for that Lichtens, I'll try your code and put some remarks if necessary.

    Kind regards,
    Domi.
    ----------------------------------------------------------------------------------
    FExplorer is my baby !

    you can get the FREE version from www.gosymbian.com
    you can get the PRO version from http://store.ovi.com/content/339454

Similar Threads

  1. skin not displayed in custom listbox....
    By Neelakantan in forum Symbian User Interface
    Replies: 10
    Last Post: 2010-06-20, 09:14
  2. Enabling the Skin in a custom Listbox
    By riteshw in forum Symbian User Interface
    Replies: 4
    Last Post: 2009-07-16, 11:00
  3. Disable skin for listbox [not for application]
    By saurbh_g in forum Symbian User Interface
    Replies: 3
    Last Post: 2007-12-12, 06:17
  4. Full screen listbox skin not rendered correctly
    By template60 in forum Symbian
    Replies: 2
    Last Post: 2007-09-11, 04:34
  5. Using a "custom" listbox in mobile s60
    By ctpthanh in forum Symbian User Interface
    Replies: 4
    Last Post: 2005-04-17, 14:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×