×

Discussion Board

Results 1 to 3 of 3

Hybrid View

  1. #1
    Regular Contributor
    Join Date
    Apr 2004
    Posts
    322

    background doesnt cover lower part of the view

    Hi
    I use an sdk example and try to create a simple view with a white background and two text fields.
    the text fields work fine , also the menu , but the white background doesnt cover the lower part of the view (I can see part of the the application menu in the view ...).

    Please take a look at the relevant code I put here and tell me what I should change

    Thanks a lot , TE

    Code:
    class CMyAppTextView : public CAknView
    
    class CMyAppTextContainer : public CCoeControl, MCoeControlObserver
    // *** Container ***
    void CMyAppTextContainer::ConstructL(const TRect& aRect, CMyAppTextView* aView)
    {
        CreateWindowL();   
        iView = aView;
        TResourceReader reader;
        iUpperText = new(ELeave) CEikLabel; // defined as CEikLabel* in header file
        iUpperText->SetContainerWindowL(*this);
    	_LIT(TEXT1,"Check upper");
    	iUpperText->SetTextL(TEXT1);
        iLowerText = new(ELeave) CEikLabel; // defined as CEikLabel* in header file 
        iLowerText->SetContainerWindowL(*this);
    	_LIT(TEXT2,"Check lower");
    	iLowerText->SetTextL(TEXT2);
        SetRect(aRect);
        ActivateL();
    }
    
    void CMyAppTextContainer::SizeChanged()
    {
        TRect rect = Rect();
        TSize size;
        size.iWidth = rect.iBr.iX + rect.iTl.iX;
        size.iHeight = (rect.iBr.iY + rect.iTl.iY) / 2;
        iUpperText->SetExtent(rect.iTl, size);
        size.iHeight+=1;
        iLowerText->SetExtent(TPoint(rect.iTl.iX, (rect.iBr.iY/2)+1), size);
    }
    
    void CMyAppTextContainer::Draw( const TRect& aRect ) const
    {
        CWindowGc& gc = SystemGc();
        gc.SetPenStyle( CGraphicsContext::ENullPen );
        gc.SetBrushColor(TRgb(0xffffff)); //White
        gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
        gc.DrawRect( aRect );
    }
    // *** View ***
    void CMyAppTextView::ConstructL()
    {
        BaseConstructL(R_MYAPPTEXT_MENU);
    }
    
    void CMyAppTextView::DoActivateL(const TVwsViewId& ,TUid ,const TDesC8&)
    {
        iContainer = new(ELeave) CMyAppTextContainer;
        iContainer->SetMopParent(this);
        iContainer->ConstructL(ClientRect(), this);
    	SetTitlePaneL();
        AppUi()->AddToStackL(*this, iContainer);
    }
    // *** RSS ***
    RESOURCE AVKON_VIEW r_myapptext_menu
    {
        menubar = r_myapptext_menubar;  
    	cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
    }

  2. #2
    Registered User
    Join Date
    Apr 2005
    Posts
    2
    I think you are declaring cba twice in your resource file. Check that in eg. eik_app_info and your view section don't both have cba area defined.

  3. #3
    Regular Contributor
    Join Date
    Apr 2004
    Posts
    322
    You're right !!!
    Thank you very much :-)

Posting Permissions

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