|
-
November 12th, 2003, 03:25 AM
#1
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.
-
November 13th, 2003, 12:05 AM
#2
isint there anyone???????
-
November 13th, 2003, 12:24 AM
#3
incorrect initialization may cause what you said,what is your initialized code?
-
November 13th, 2003, 01:17 AM
#4
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...
-
November 13th, 2003, 01:42 AM
#5
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.
-
November 13th, 2003, 02:02 AM
#6
-
November 13th, 2003, 02:37 AM
#7
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?
-
November 13th, 2003, 02:42 AM
#8
Which mapping mode are you using when drawing to the DC?
-
November 13th, 2003, 02:59 AM
#9
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...
-
November 13th, 2003, 03:10 AM
#10
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?
-
November 13th, 2003, 03:21 AM
#11
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?
-
November 13th, 2003, 03:33 AM
#12
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.
-
November 13th, 2003, 04:29 AM
#13
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?
-
November 13th, 2003, 05:13 AM
#14
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?
-
February 3rd, 2004, 03:26 PM
#15
Did you get it to move. How did you do it. I'm having the same problem. Could you help me?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|