×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    8

    Smile why is background line covered with CAknGrid Control ? about Myself Calendar Program

    i code calendar program like nokia calendar. use CAknGrid control. use DrawRect() func draw frame. but it allways covered with CAknGrid Control.
    code snippet under:
    Code:
    RESOURCE ARRAY r_kfc_calendar_grid_items
    {
    	items = 
    	{
    		LBUF { txt = "0\t\t1" ; },
    		LBUF { txt = "0\t\t2" ; },
    		LBUF { txt = "0\t\t3" ; },
    		LBUF { txt = "0\t\t4" ; },
    		LBUF { txt = "0\t\t5" ; },
    		LBUF { txt = "0\t\t6" ; },
    		LBUF { txt = "0\t\t7" ; },
    		LBUF { txt = "0\t\t8" ; },
    		LBUF { txt = "0\t\t9" ; },
    		LBUF { txt = "0\t\t10" ; },
    		LBUF { txt = "0\t\t11" ; },
    		LBUF { txt = "0\t\t12" ; },
    		LBUF { txt = "0\t\t13" ; },
    		LBUF { txt = "0\t\t14" ; },
    		LBUF { txt = "0\t\t15" ;},
    		LBUF { txt = "0\t\t16" ;},
    		LBUF { txt = "0\t\t17" ;},
    		LBUF { txt = "0\t\t18" ;},
    		LBUF { txt = "0\t\t19" ;},
    		LBUF { txt = "0\t\t20" ;},
    		LBUF { txt = "0\t\t21" ;},
    		LBUF { txt = "0\t\t22" ;},
    		LBUF { txt = "0\t\t23" ;},
    		LBUF { txt = "0\t\t24" ;},
    		LBUF { txt = "0\t\t25" ;},
    		LBUF { txt = "0\t\t26" ;},
    		LBUF { txt = "0\t\t27" ;},
    		LBUF { txt = "0\t\t28" ;},
    		LBUF { txt = "0\t\t29" ;},
    		LBUF { txt = "0\t\t30" ;},
    		LBUF { txt = "0\t\t31" ;},
    		LBUF { txt = "0\t\t1" ; },
    		LBUF { txt = "0\t\t2" ; },
    		LBUF { txt = "0\t\t3" ; },
    		LBUF { txt = "0\t\t4" ; },
    		LBUF { txt = "0\t\t5" ; },
    		LBUF { txt = "0\t\t6" ; },
    		LBUF { txt = "0\t\t7" ; },
    		LBUF { txt = "0\t\t8" ; },
    		LBUF { txt = "0\t\t9" ; },
    		LBUF { txt = "0\t\t10" ; },
    		LBUF { txt = "0\t\t11" ; },
    		LBUF { txt = "0\t\t12" ; }
    	};
    }
    
    RESOURCE GRID_STYLE r_kfc_calendar_grid_style
    {
    	layoutflags= EAknGridHorizontalOrientation | EAknGridTopToBottom;
    	primaryscroll= EAknGridIncrementLineAndLoops; // horizontal scroll
    	secondaryscroll=EAknGridIncrementLineAndLoops; // vertical scroll
    	itemsinprimaryorient=7; // number of items horizontally per screen
    	itemsinsecondaryorient=6; // number of items vertically per screen
    	gapwidth=1;
    	gapheight=1;
    	width = 21; 
    	height = 19;
    }
    void CKFCContainer::ShowGrid()
    {
    	AknListBoxLayouts::SetupStandardGrid(*m_pMonthGrid);
    	CFormattedCellListBoxItemDrawer* itemDrawer = m_pMonthGrid->ItemDrawer();
    	TInt cellWidth =  21;//21;
    	TInt cellHeight = 19;//19;
    	const CFont* KFont = LatinBold12();
    	const TInt KTextColor = 215;
    	TInt baseline = cellHeight - KFont->DescentInPixels() - 4;
    
    	AknListBoxLayouts::SetupFormAntiFlickerTextCell (*m_pMonthGrid, // the grid
    										 itemDrawer, // the grid's drawer
    										 2, // index of text within item strings
    										 KFont, // the font for the text
    										 KTextColor, // the color of the text - N.B. although commented out in the header file, this is still used!
    										 0, // left margin
    										 0, // right margin - unused
    										 baseline, // Baseline
    										 cellWidth, // text width (would need to take margin into account if set, i.e. - lm)
    										 CGraphicsContext::ECenter,//ELeft, // Alignment
    										 TPoint (cellWidth, 0), // start position
    										 TPoint(cellWidth, cellHeight)); // end position	  
    }
    void CKFCContainer::SizeChanged()
        {
        	if( m_pMonthGrid )
        	{
        		//ShowGrid();
        		TRect aRect = Rect();
        		aRect.Shrink( 2, 3 );
        		//TPoint( 19,21)
     			m_pMonthGrid->SetExtent( TPoint( 20,21) , aRect.Size());
        		
        		//m_pMonthGrid->SizeChanged();
        	}      
        }
    
    void CKFCContainer::Draw(const TRect& aRect) const
        {
    	    CWindowGc& gc = SystemGc();
      		gc.Clear( aRect );
      		TRect back_rect = aRect;
      		back_rect.Shrink( 2, 3 );
      		back_rect.iTl.iX = 1;
      		back_rect.iTl.iY = 1;	
      		gc.DrawRect( back_rect );
      		TPoint cline0_b(19, back_rect.iTl.iX);
      		TPoint cline0_e(19, back_rect.iBr.iY ); 
      		gc.DrawLine( cline0_b, cline0_e );
      		TPoint rline0_b(back_rect.iTl.iY, 20 );
      		TPoint rline0_e(back_rect.iBr.iX, 20 );
      		gc.DrawLine( rline0_b, rline0_e);
        }
    expecting!
    thank U !

  2. #2
    Super Contributor
    Join Date
    Jun 2004
    Location
    SymbianLand
    Posts
    763

    Re: why is background line covered with CAknGrid Control ? about Myself Calendar Prog

    Why not just derive your control from CEikBorderedControl?
    And on the construction of the container just do this:
    Code:
    CMyContainer::CMyContainer():
    CEikBorderedControl(TGulBorder(TGulBorder::EDeepRaised)),iTextAlign(ECenterText)
    Also in the Draw of you container just this line only and remove rest of the stuff.
    Code:
    CEikBorderedControl::Draw(aRect);
    This will give you a border frame automatically.
    Hope this helps.
    --Mayur.

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    8

    Smile Re: why is background line covered with CAknGrid Control ? about Myself Calendar Program

    Thank U !
    i try it!

Similar Threads

  1. Replies: 1
    Last Post: 2004-11-25, 03:42
  2. BUG: No background light and vibrator control
    By apriori in forum Mobile Java General
    Replies: 0
    Last Post: 2003-03-29, 12:45
  3. Replies: 1
    Last Post: 2002-10-18, 02:35
  4. Writing a IR remote control program on the Nokia 9290
    By krajag in forum Bluetooth Technology
    Replies: 1
    Last Post: 2002-10-04, 07:33
  5. How to enter new line character in edit control
    By engrsanjiv in forum Symbian
    Replies: 1
    Last Post: 2002-08-03, 05:54

Posting Permissions

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