Click to See Complete Forum and Search --> : Please Help !!!


Kaps
June 22nd, 1999, 03:48 AM
I have an tracker and when I scroll down , my tracker is at the same place but the covering object(ellipse or rectangle) moves up.
Pls advice me the way to move tracker also !!!

regards,
Kapil

Jason Teagle
June 22nd, 1999, 04:34 AM
If you are manually positioning the tracker, you must call CScrollView::GetScrollPosition() and offset your tracker's CRect by the contents of the CPoint returned. I.e.,

CPoint ptScrollPos ;
CRect rctTracker(0, 0, 100, 50); // Top-left, with no scrolling.

ptScrollPos = GetScrollPosition();
rctTracker.OffsetRect(ptScrollPos); // ALWAYS top-left now.

Does this help?

Kaps
June 22nd, 1999, 05:50 AM
Thanx for the suggestion but the problem is bit more complex as its not derived from CRect, the object is derived from CRetcTracker , which takes the parameter in Device coordinates.
I am waiting for your reply.

Regards,
Kapil

Jason Teagle
June 22nd, 1999, 06:06 AM
I think it should still work - after all, the CRectTracker still uses a standard CRect for its position and size.

Why do you say 'device co-ordinates'? I cannot find any mention that the position must be in device co-ords, although we have VC++ V4.0 here, so it may say that in later versions. It DOES say 'client' (description of m_rect member), but it is assuming a non-scrolling window, I believe. Have you tried it and it fails?