Re: Scrolling?
- From: "Sanjeev" <sanjeev.sahu@xxxxxxxxxxxxx>
- Date: Fri, 21 Apr 2006 14:31:54 +0530
Hello Robby,
Try to override the WM_CTLCOLOR. Hopefully it should solve the problem.
Regards
Sanjeev
"Robby" <Robby@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:72084A36-FEB0-409B-93F1-8447D0C169FD@xxxxxxxxxxxxxxxx
Hi,learning
I have been doing extensive VC++ programming, however I find myself
eVC++ where I find there are some slight differences.with
If I want to scroll some text in my client area, I would do it one way
the traditional WM_VSCROLL to get the user's scroll bar clicking and thenclean
scrolling the window down a line, followed by an UpdateWindow. And
thereafter, WM_PAINT would re-paint the lines required.
This worked fine. Meaning no flickering and was constantly erasing the
client area after every scroll so the next text would be re-drawn in a
slate , sort of speak!
However I tried doing thids in eVC, and it doesn't quit work as well!
I replaced the following lines from VC++:
===================================================
ScrollWindow(hwnd,0,cyChar *(iCurentThumbPos - si.nPos),NULL,NULL);
UpdateWindow(hWnd);
===================================================
with the following eVC++ command:
===================================================
ScrollWindowEx(hWnd, 0, cyChar * (iVertPos - si.nPos),(CONST RECT *) NULL,
(CONST RECT *) NULL, (HRGN) NULL, (LPRECT) NULL,SW_INVALIDATE);
UpdateWindow(hWnd);
===================================================
However, somehow the client area doesn't fully erase the previous scrolled
text.
EXAMPLE: Suppose I had to display 3 text items in my screen... here is a
sample :
wordA
wordAB
wordABC
If I scroll up, we get:
wordAB
wordABC
right...!
So If I re-scroll back down I go back to:
wordAB //its like as if the old 'B' stayed there????
wordAB
wordABC
To get rid of this problem I have to put an InvalidateRect command in
WM_PAINT, however this causes an irritable flicker!
Here is the core portion of my code in eVC++:
===============================================
case WM_VSCROLL:
//Get scroll info
si.cbSize = sizeof(si);
si.fMask = SIF_ALL;
GetScrollInfo (hWnd,SB_VERT,&si);
// Save current position
iVertPos = si.nPos;
switch (LOWORD (wParam))
{
case SB_LINEUP:
si.nPos -= 1;
break;
case SB_LINEDOWN:
si.nPos += 1;
break;
default:
break;
}
si.fMask = SIF_POS;
SetScrollInfo(hWnd,SB_VERT,&si,TRUE);
GetScrollInfo(hWnd,SB_VERT,&si);
if(si.nPos != iVertPos)
{
ScrollWindowEx(hWnd, 0, cyChar * (iVertPos - si.nPos),(CONST RECT *) NULL,
(CONST RECT *) NULL, (HRGN) NULL, (LPRECT) NULL,SW_INVALIDATE);
UpdateWindow(hWnd);
}
return 0;
case WM_PAINT:
//InvalidateRect(hWnd,NULL,TRUE); //It works but creates a flicker!!!
hdc = BeginPaint (hWnd,&ps);
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
GetScrollInfo (hWnd,SB_VERT,&si);
iVertPos = si.nPos;
iPaintBeg = max(0,iVertPos);
iPaintEnd = min(NUMLINES - 1,iVertPos + ps.rcPaint.bottom / cyChar);
for(i = iPaintBeg; i <= iPaintEnd;i++)
{
y = cyChar * (i - iVertPos);
ExtTextOut (hdc,0,y, ETO_CLIPPED, NULL,sysmetrics[i].szLabel,
lstrlen(sysmetrics[i].szLabel),NULL);
}
EndPaint (hWnd, &ps);
return 0;
===============================================
I don't know what else to try, does anyone see something wrong with this
setup?
I feel frustrated because the things I am used to doing in VC++, I sort of
can't do them anymore In eVC++. Its like I am slightly re-learning the
mechanics of the language.
Anyways, If anyone can help me with this, it would be very appreciated!
Thankyou for all sugestions and comments!
--
Best regards
Robert
.
- Follow-Ups:
- Re: Scrolling?
- From: Robby
- Re: Scrolling?
- References:
- Scrolling?
- From: Robby
- Scrolling?
- Prev by Date: How to access Inbox's data by CEDB's Remote APIs
- Next by Date: File Interrupt plug-in in Windows CE 5.0
- Previous by thread: Scrolling?
- Next by thread: Re: Scrolling?
- Index(es):
Relevant Pages
|