×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    31

    Question Scrolling in Dialog resource.

    Hi,

    How to enable scrolling in CAknDialog having labels with long text?

    I tried using following code PreLayoutDynInitL():

    void CVocabolShowDialog::PreLayoutDynInitL ()
    {
    CAknDialog::PreLayoutDynInitL ();
    CEikScrollBarFrame* scrollbarFrame = new (ELeave)
    CEikScrollBarFrame((CCoeControl *)this,NULL,ETrue); scrollbarFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto,
    CEikScrollBarFrame::EAuto);

    scrollbarFrame->DrawScrollBarsNow();
    }

    But it does'nt works. Did I do something worng?

    Any other way to enable scrolling?

    Thanks in Advance.

    Mahavir

  2. #2
    Registered User
    Join Date
    Nov 2007
    Posts
    444

    Re: Scrolling in Dialog resource.

    Code:
    void CImageViewer::ScrollBarFrameL()
    {
       iScroll = new(ELeave) CEikScrollBarFrame(this,NULL,ETrue);
    
       iScroll->CreateDoubleSpanScrollBarsL(ETrue,EFalse);
        
       iScroll->SetScrollBarVisibilityL(
                    CEikScrollBarFrame::EAuto, // horizontal on
                    CEikScrollBarFrame::EAuto); // vertical
    
       iVDsSbarModel.iScrollSpan =100;
       iVDsSbarModel.iThumbPosition = 1;
       iVDsSbarModel.iThumbSpan = 10;
    
       iHDsSbarModel.iScrollSpan = 100;
       iHDsSbarModel.iThumbPosition = 1;
       iHDsSbarModel.iThumbSpan = 10;
    
       TEikScrollBarFrameLayout layout;
       layout.iTilingMode = TEikScrollBarFrameLayout::EInclusiveRectConstant;
    
       TRect iRect(Rect());
       iScroll->TileL( &iHDsSbarModel, &iVDsSbarModel, iRect, iRect, layout );
            
       iScroll->MoveVertThumbTo(iVDsSbarModel.iThumbPosition);
       iScroll->MoveHorizThumbTo(iHDsSbarModel.iThumbPosition);
       iScroll->DrawScrollBarsNow();
    }
    hope above code will work.

    Regards,
    Kavit.
    Last edited by Kavit Patel; 2008-06-13 at 09:10.

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    31

    Re: Scrolling in Dialog resource.

    Thanks Kavit for your immediate reply..

    The above code doesn't works :(

    Any other way?

    Thanks Again..

    Mahavir

  4. #4
    Registered User
    Join Date
    Nov 2007
    Posts
    444

    Re: Scrolling in Dialog resource.

    It works for me.

    BTW what was the problem for that code with you?

    BR.
    Kavit

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    31

    Re: Scrolling in Dialog resource.

    Actually I tried using your code in CAknDialog's (My class derived from CAknDialog) PreLayoutDynInitL() method..

    But it neither show scrollbar nor scrolling works. :(

    Do I need to handle something in OfferKeyEventL()?

    Is this right way of doing??

    Thanks

    Mahavir
    Last edited by mahavirjain; 2008-06-13 at 09:48.

  6. #6
    Registered User
    Join Date
    Mar 2006
    Posts
    31

    Re: Scrolling in Dialog resource.

    Does scrolling works with dialog with only labels?

  7. #7
    Registered User
    Join Date
    Nov 2007
    Posts
    444

    Re: Scrolling in Dialog resource.

    Quote Originally Posted by mahavirjain View Post
    Does scrolling works with dialog with only labels?
    I am not sure , I have used that code to display scroll bar in the dialog having Image(Bitmap).

  8. #8
    Registered User
    Join Date
    Mar 2006
    Posts
    31

    Re: Scrolling in Dialog resource.

    Hi,

    Now its displaying scrollbar :).. I just put your code in PostLayoutDynInitL() as in PreLayoutDynInitL() it is rendering label it does'nt know in advance the length of text..

    But now problem is that scrollbar is not working :(

    Any Idea?

    Thanks..

    Mahavir

  9. #9
    Regular Contributor
    Join Date
    Jun 2008
    Location
    Tianjin
    Posts
    156

    Re: Scrolling in Dialog resource.

    Firstly create the scrollbar in ConstructL function.
    Code:
    iScrollBarFrame = new ( ELeave ) CEikScrollBarFrame(this, NULL);
    iScrollBarFrame->CreateDoubleSpanScrollBarsL( ETrue, EFalse );
    iScrollBarFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EDoubleSpan );
        iScrollBarFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
    And then product a function to update the scroll bar if necessary.

    Code:
    void CSignUpContainer::UpdateScrollBarFrameL()
    	{
    	// This view height
    	TRect viewRect;
    	AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, viewRect);
    ......
    	// Update scroll bar position
    	iVertModel.SetScrollSpan(cnt);
    	iVertModel.SetWindowSize(1);
    	iVertModel.SetFocusPosition(pos);
    
    	TEikScrollBarFrameLayout layout;
    	layout.iTilingMode = TEikScrollBarFrameLayout::EInclusiveRectConstant;
    
    	TRect rect(Rect());
    
    	iScrollBarFrame->TileL( &iHorizModel, &iVertModel, viewRect, rect, layout );
    	TSize size = iScrollBarFrame->VerticalScrollBar()->Size();
    	size.iHeight = height;
    	iScrollBarFrame->VerticalScrollBar()->SetSize(size);
    	iScrollBarFrame->SetVFocusPosToThumbPos(iVertModel.FocusPosition());
    	//iScrollBarFrame->DrawScrollBarsNow();
    	}
    anson_zhao

  10. #10
    Registered User
    Join Date
    Mar 2006
    Posts
    31

    Re: Scrolling in Dialog resource.

    To make scrollbar working I write the following code and called it in CAknDialog's OfferKeyEventL().. Also I set the extent of dialog to the height of controls by SetExtent() function in PostLayOutDynInitL().. Now it's scrolling but dialog goes over ClientRect area and paint over Title pane..

    void UpdateScrollBarFrameL(TScrollbarDirection aDirection)
    {
    TPoint pos = Position();
    if(aDirection == EScrollMoveDown)
    {
    pos.iY = pos.iY - 10;
    SetPosition(pos);
    }
    else if(aDirection == EScrollMoveUp)
    {
    pos.iY = pos.iY + 10;
    SetPosition(pos);
    }
    }

    Is there any way to invalidate the Dialog's rect which is over title pane?

    Thanks.

    Mahavir

  11. #11
    Regular Contributor
    Join Date
    Jun 2008
    Location
    Tianjin
    Posts
    156

    Re: Scrolling in Dialog resource.

    anson_zhao

  12. #12
    Registered User
    Join Date
    Mar 2006
    Posts
    31

    Re: Scrolling in Dialog resource.

    Thanks Zhao for attention..

    I tried this also but it makes the control invisible only(Control is not painted in rect area of control)

    I want to invalidate the rect which is going over title pane.

    I tried using Window()'s Invalidate() function but doesn't works :(

    Any Ideas??

    Any other way to do scrolling in dialog?

    Thanks all for attention..

    Mahavir

  13. #13
    Registered User
    Join Date
    Mar 2006
    Posts
    31

    Re: Scrolling in Dialog resource.

    Still Did'nt got the solution for dialog going over title pane..

    But as a temporary solution I make the dialog full screen and scrolling the full screen dialog.. Its working fine..

    Mahavir

Similar Threads

  1. problem in using dialog resource
    By ayman09 in forum Symbian
    Replies: 2
    Last Post: 2008-05-18, 12:05
  2. Why am i getting this error?
    By shankha in forum Symbian
    Replies: 4
    Last Post: 2007-10-12, 11:21
  3. Using a resource query dialog
    By aleianna in forum Symbian User Interface
    Replies: 6
    Last Post: 2007-03-16, 09:22
  4. Multiple Resource file - Dialog
    By clifford_dias in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-11-13, 16:43
  5. resource dialog
    By plmanikandan in forum Symbian User Interface
    Replies: 1
    Last Post: 2005-05-19, 08:36

Posting Permissions

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