CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Apr 2001
    Location
    Karachi, Pakistan.
    Posts
    466

    Question CScrollView.. not scrolling?

    Good day guys,

    I am having an sdi (doc/view)... drived from CScrollView. I have initialized/enabled the scrollbars... and set its position. My document size is 2400x1600 and view size is 800x600.

    Some text is on the other side of the view but my scroll bars are not moving anything... its just static to its postion... even if i try to move it from its place...it just comes back to its orignal position... with no change of view.

    Any suggestions/workarounds will be highly appreciated.
    KMan
    use code-tags
    Rating a post is'nt injurious(0:


    http://izlooite.blogspot.com

  2. #2
    Join Date
    Apr 2001
    Location
    Karachi, Pakistan.
    Posts
    466

    Unhappy

    isint there anyone???????
    KMan
    use code-tags
    Rating a post is'nt injurious(0:


    http://izlooite.blogspot.com

  3. #3
    Join Date
    Nov 2003
    Posts
    22
    incorrect initialization may cause what you said,what is your initialized code?

  4. #4
    Join Date
    Apr 2001
    Location
    Karachi, Pakistan.
    Posts
    466
    thanks a million for replying... SunHeart! Really...

    wat could be the incorrect initialization?? may code is as follows...

    Code:
    void CDPSView::OnInitialUpdate() 
    {
    	CView::OnInitialUpdate();
    	CClientDC dcScreen(this);
    
    	CSize sz(CPoint(2400,1800));
    	SetScrollSizes(MM_TWIPS, sz);
    
    	ShowScrollBar(SB_HORZ);
    	ShowScrollBar(SB_VERT);
    
    	SetScrollRange(SB_HORZ,0,2400,TRUE);
    	SetScrollPos(SB_HORZ, 300, TRUE);
    
    .......
    }
    Thanks...
    KMan
    use code-tags
    Rating a post is'nt injurious(0:


    http://izlooite.blogspot.com

  5. #5
    Join Date
    Nov 2003
    Posts
    22
    MM_TWIPS means 1/1440 inch.so your 2400 TWIPS means 1.6 inch.that is,it's mall than your screen,even your window.so scollbar does invalidate.try MM_TEXT in the function SetScrollSizes(MM_TWIPS, sz).Of course,it is not what your want.so try 240000.

  6. #6
    Join Date
    Nov 2003
    Posts
    22
    maybe you can answer me,plz read http://www.codeguru.com/forum/showth...hreadid=271891
    .thanks lots

  7. #7
    Join Date
    Apr 2001
    Location
    Karachi, Pakistan.
    Posts
    466
    no way yo!

    no scroll bar is working at all.... just the size of the scroll bar is changing... rest is the same.

    ? Any other suggestions?
    KMan
    use code-tags
    Rating a post is'nt injurious(0:


    http://izlooite.blogspot.com

  8. #8
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815
    Which mapping mode are you using when drawing to the DC?

  9. #9
    Join Date
    Apr 2001
    Location
    Karachi, Pakistan.
    Posts
    466
    Oh gstercken... i really was waiting for you!

    Im using MM_TWIPS mode. I have got following code.

    Code:
    void CDPSView::OnInitialUpdate() 
    {
    	CView::OnInitialUpdate();
    	CClientDC dcScreen(this);
    
    	CRect rect;
    	GetClientRect(rect);
    
    	CSize sz(CPoint(2400,1800));
    	SetScrollSizes(MM_TWIPS, sz);
    	CSize ptOldWinExt = dcScreen.SetWindowExt(sz.cx, sz.cy);
    	CSize ptOldViewportExt = dcScreen.SetViewportExt(rect.Width(),-rect.Height());
    	ShowScrollBar(SB_HORZ);
    	ShowScrollBar(SB_VERT);
    	m_pScrollBar=GetScrollBarCtrl(SB_HORZ);
    	SetScrollRange(SB_HORZ,0,2000,TRUE);
    	SetScrollPos(SB_HORZ, 300, TRUE);
    Thanks...
    KMan
    use code-tags
    Rating a post is'nt injurious(0:


    http://izlooite.blogspot.com

  10. #10
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815
    Well, as sunheart already said, 2400 TWIPS means 1.6 inches. Also, I don't understand why you are calling SetScrollRanges(), ShowScrollBar() etc. The only thing you need to do in a CScrollView is to call SetScrollSizes(), the rest is automatic. But I was asking for the drawing code in your OnDraw(). Are you sure it is using MM_TWIPS as well?

  11. #11
    Join Date
    Apr 2001
    Location
    Karachi, Pakistan.
    Posts
    466
    thanks... gstercken!

    But the problem is not the drawing code. The problem is... that none of the scroll bars .... are moving away from its position, means that i am unable to see the text written on the far right side of my view.

    ...I mean.. like... ok just consider this InternetExplorer window... from which you are reading the text right now. There are scroll bars in it... Both are Enabled and Active. And when you pull an scrollbar... the page will go up or ritewards... which ever bar you click on.

    the same is the case with my application... but when i pull my any of the bars... down or towards right-side... it ScrollBar's Cursor comes back to its orignal postion. I dont know what im doing wrong?

    Everything is drawing fine... but scrollbars arent changing the postions... as i click on it.

    getting anything?
    KMan
    use code-tags
    Rating a post is'nt injurious(0:


    http://izlooite.blogspot.com

  12. #12
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815
    As already said: The total size you set for your document (in TWIPS) is far to small. Based on that size, all of your document should be visible, and there would be no scroll bars. However, you are bypassing CScrollView's automatism by manually showing the scroll bars. So you should remove all that code and just call SetScrollSizes() with reasonable values: If you tell your view that the total width of the data is just 1.6 inches, then you can't expect it to display a working scroll bar.

  13. #13
    Join Date
    Apr 2001
    Location
    Karachi, Pakistan.
    Posts
    466
    okay.... but wat about now? its 20 by 20 inches. As 2400 means 1.6 inches then 30000 shud mean... 20 inches. I have got only these two lines in OnInitialUpdate()
    Code:
    ...
    CSize sz(CPoint(30000,30000));//means 20inches by 20 inches
    SetScrollSizes(MM_TWIPS, sz);
    ...
    its displaying scrollbar! But still... the problem remains... im unable to move the scroll bar!

    do you think i shud change the mapping mode? mm_anisotropic?
    KMan
    use code-tags
    Rating a post is'nt injurious(0:


    http://izlooite.blogspot.com

  14. #14
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815
    Well, what else are you doing? Are you handling any other messages related to scrolling? Are you calling methods related to scrolling like SetScrollSizes() or SetViewportOrg() / SetWindowOrg() in other places of your code?

  15. #15
    Join Date
    Jul 2003
    Posts
    79
    Did you get it to move. How did you do it. I'm having the same problem. Could you help me?

Page 1 of 2 12 LastLast

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured