Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User aamitgupta's Avatar
    Join Date
    Jul 2007
    Location
    Noida
    Posts
    1,503
    Hi All,

    I create a GUI that have scroll bar in container, but the scroll bar is not scrolled or my text which i draw on screen display only 11 line text rest all text does not display, but in my next screen i draw a list here the scroll bar is working fine.

    My code is following
    in constructl function:
    Code:
    iDeviceMap = iCoeEnv->ScreenDevice();
    	iNum=2;	// This Number handle scroll down and up counting
    	iScrollBarFrame = new(ELeave) CEikScrollBarFrame(this, this,ETrue);
    	iScrollBarFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
    	iScrollBarFrame->CreateDoubleSpanScrollBarsL(ETrue,EFalse);
    	TRect rect = Rect();
    	rect.iTl.iX=Rect().iBr.iX-iScrollBarFrame->VerticalScrollBar()->DefaultScrollBarBreadth();
    	
    	iDoubleSpanAttributes.iScrollSpan = iNum;
    	iDoubleSpanAttributes.iThumbSpan = 1;
    	iDoubleSpanAttributes.iThumbPosition = iCurrentScrollNum;
    	
    	iScrollBarFrame->Tile(&iDoubleSpanAttributes,rect);
    	iScrollBarFrame->MoveVertThumbTo(iDoubleSpanAttributes.iThumbPosition);
    	iScrollBarFrame->DrawScrollBarsNow();
    Code:
    TKeyResponse CMyViewContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    	if (aType != EEventKey)
    		{
    		return EKeyWasNotConsumed;
    		}
    
    //	if ((aKeyEvent.iCode == EKeyDownArrow) || (aKeyEvent.iCode == EKeyUpArrow))
    	if ((aKeyEvent.iCode == EStdKeyDownArrow) || (aKeyEvent.iCode == EStdKeyUpArrow))
    		{
    		//if (aKeyEvent.iCode == EEventKeyDown)
    		if (aKeyEvent.iCode == EStdKeyDownArrow)
    			{
    			if (iCurrentScrollNum < iNum - 1)
    				{
    				iCurrentScrollNum++;
    				}
    			}
    		//else if (aKeyEvent.iCode == EEventKeyUp)
    		else if (aKeyEvent.iCode == EStdKeyUpArrow)
    			{
    			if (iCurrentScrollNum > 0)
    				{
    				iCurrentScrollNum--;
    				}
    			}
    
    		iVertModel.iThumbPosition = iCurrentScrollNum;
    		DrawNow();
    		iScrollBarFrame->SetVFocusPosToThumbPos(iVertModel.iThumbPosition);	
    		iScrollBarFrame->DrawScrollBarsNow();
    		return EKeyWasConsumed;
    		}			
    		
    	return EKeyWasNotConsumed;
    	}
    please any body help me, i m serching a scroll bar example in S60 5th edition.
    Regards,
    Amit


    ****"Putting a Smile on other's faces is the essence of true Happiness"****

  2. #2
    Registered User kamalakshan's Avatar
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998
    In 5th edition you should be handling scroll events in HandlePointerEventL right? The code you have posted is for OfferKeyEventL. Just check if at all it is getting executed. If its N97 then it might be ok as keyboard is there.

  3. #3
    Registered User aamitgupta's Avatar
    Join Date
    Jul 2007
    Location
    Noida
    Posts
    1,503
    Quote Originally Posted by kamalakshan View Post
    In 5th edition you should be handling scroll events in HandlePointerEventL right? The code you have posted is for OfferKeyEventL. Just check if at all it is getting executed. If its N97 then it might be ok as keyboard is there.
    The scroll bar is working now but the problem is i am drawing some texts in the container line by line like following.

    This is
    Amit
    Kumar
    Gupta
    i
    am
    a
    engineer
    .
    .
    .
    .
    .


    these text writes in a the loop, in the container it draws only 11 lines, rest all lines does not visible.

    Code:
        	
    	// Clear the graphics context.
    	CWindowGc& gc = SystemGc();
    	//gc.Clear(); 
    /* 	
        gc.SetPenStyle( CGraphicsContext::ENullPen );
        gc.SetBrushColor( KRgbWhite );
        gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
        gc.DrawRect( aRect );
        
        */
    	//skin
    	TRgb textColor; // text color when not highlighted
    	MAknsSkinInstance* skin =AknsUtils::SkinInstance();
    	AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG9 );
    	TRgb highlightColor; // text color when highlighted
    	AknsUtils::GetCachedColor( skin, highlightColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 );
    	MAknsControlContext* cc =AknsDrawUtils::ControlContext(this );
    	AknsDrawUtils::Background( skin, cc, this,gc,aRect);
         
        TRealFormat y(6,2);
        y.iType=KRealFormatFixed;
    	//gc.SetPenColor(KRgbWhite);
        gc.SetPenColor(textColor);
    	TBuf<32> fontName=_L("LatinPlain12");
        CFont* fontToUse;	
    	CGraphicsDevice* iDeviceMap = iCoeEnv->ScreenDevice();
        TInt iHeightTwips = 100;
        
        #ifdef __SERIES60_30__
        TInt iHeightPixels = iDeviceMap->VerticalTwipsToPixels(iHeightTwips);
    	if(iHeightPixels<12)
    	{
    		iHeightPixels=12;
    		iHeightTwips = iDeviceMap->VerticalPixelsToTwips(iHeightPixels);
    	}
    	#endif
    		
    		
    	TPoint textPoint(10, 5);
    	TInt l2 = 8; 
    	TFontSpec fontSpec(fontName, iHeightTwips);
    	iDeviceMap->GetNearestFontInTwips(fontToUse, fontSpec);
    	gc.UseFont(fontToUse);
    	
    	
    	for (TInt i = iCurrentScrollNum+1; i < iCurrentScrollNum+12; i++)
        { 
    		if(i <= 14)
    		{
    
    			textPoint.iY += (fontToUse->HeightInPixels() + 5);
    			gc.DiscardFont();
    			iDeviceMap->ReleaseFont(fontToUse);	    
    			#ifdef __SERIES60_30__
    		     	fontName=_L("Latin");
    		 		TFontSpec fontSpec1(fontName, iHeightTwips);
    		 		fontSpec1.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
    		    #else
    		    	fontName=_L("LatinBold12");
    		 		TFontSpec fontSpec1(fontName, iHeightTwips);
    		    #endif	
    			iDeviceMap->GetNearestFontInTwips(fontToUse, fontSpec1);
    			gc.UseFont(fontToUse);
    		    TInt k=i;
    			gc.DrawText(formattedLabel[k], textPoint);
    		}  // end of if 
         	    
    	 }//for loop closed
    	gc.DiscardFont();
      	iDeviceMap->ReleaseFont(fontToUse);
    In the formattedLabel[] array has the string value which draws.
    Regards,
    Amit


    ****"Putting a Smile on other's faces is the essence of true Happiness"****

  4. #4
    Registered User kamalakshan's Avatar
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998
    so is it that you need to use scroll bar to loop thru next 11 set of lines.

Similar Threads

  1. Nokia N-Series Complete Model Line-Up
    By Dopod in forum General Development Questions
    Replies: 6
    Last Post: 2008-07-22, 20:16
  2. Nokia Mobile VPN Client
    By marcyl in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2003-12-01, 14:47
  3. Series 60 Concept Emulator (SDK Beta 0.2 Linux) not working
    By mattbee in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2003-06-10, 11:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved