How to make ListView's scroll absolutely without flickering - example included
-
Hi all, I am trying to make my ListView (displaying files) scroll without any flickering. But I cannot get it work. I tried for example putting GetListCtrl().SetRedraw(FALSE) and GetListCtrl().SetRedraw(TRUE) around CListView::OnKeyDown() call if key pressed was PAGE DOWN or PAGE UP, but it made things even worse. For example this program does absolutely no flickers! http://www.altap.cz/ftp/salamand/salen200.exe Try scrolling eg. WINNT\System32 directory of any other directory with thousand of files with Page Down key held and you will see that. How is this possible??? I am using virtual ListView. Thank you for any suggestion!
-
Hi all, I am trying to make my ListView (displaying files) scroll without any flickering. But I cannot get it work. I tried for example putting GetListCtrl().SetRedraw(FALSE) and GetListCtrl().SetRedraw(TRUE) around CListView::OnKeyDown() call if key pressed was PAGE DOWN or PAGE UP, but it made things even worse. For example this program does absolutely no flickers! http://www.altap.cz/ftp/salamand/salen200.exe Try scrolling eg. WINNT\System32 directory of any other directory with thousand of files with Page Down key held and you will see that. How is this possible??? I am using virtual ListView. Thank you for any suggestion!
Maybe you should do a search here at CP for articles by "Keith Rule" and see his CMemDC class. Regardz Colin J Davies
*** WARNING *
This could be addictive
**The minion's version of "Catch :bob: "It's a real shame that people as stupid as you can work out how to use a computer. said by Christian Graus in the Soapbox
-
Maybe you should do a search here at CP for articles by "Keith Rule" and see his CMemDC class. Regardz Colin J Davies
*** WARNING *
This could be addictive
**The minion's version of "Catch :bob: "It's a real shame that people as stupid as you can work out how to use a computer. said by Christian Graus in the Soapbox
Thanks for your suggestion Colin. Unfortunately, CMemDC doesn't work for my CListView-derived class. CMyView::OnDraw() is never executed and returning FALSE in OnEraseBackground() casues my ListView not being updated and look ugly...Don't you know why? Best regards, Standa.
-
Thanks for your suggestion Colin. Unfortunately, CMemDC doesn't work for my CListView-derived class. CMyView::OnDraw() is never executed and returning FALSE in OnEraseBackground() casues my ListView not being updated and look ugly...Don't you know why? Best regards, Standa.
s_k wrote: CMyView::OnDraw() is never executed That's correct behaviour. View derived from CCtrlView never have their
OnDraw()
method called. You'll have to useOnPaint()
instead.Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
s_k wrote: CMyView::OnDraw() is never executed That's correct behaviour. View derived from CCtrlView never have their
OnDraw()
method called. You'll have to useOnPaint()
instead.Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
void CMyList::OnPaint()
{
CPaintDC dc(this);
CMemDC memDC(&dc);
// ...
}Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
void CMyList::OnPaint()
{
CPaintDC dc(this);
CMemDC memDC(&dc);
// ...
}Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
Thank you Ryan, it works. But, in fact, I don't know what to wirte into OnPaint() handler routine. I have just CListView that displays list of files on local drives and the only thing I wanted to achieve is to get rid of flickering while scrolling the content of ListView....
-
Thank you Ryan, it works. But, in fact, I don't know what to wirte into OnPaint() handler routine. I have just CListView that displays list of files on local drives and the only thing I wanted to achieve is to get rid of flickering while scrolling the content of ListView....
void CMyList::OnPaint()
{
CPaintDC dc(this);
CMemDC memDC(&dc);
DefWindowProc(WM_PAINT, (WPARAM)memDC.m_hDC, 0);
}Hope this helps,
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
void CMyList::OnPaint()
{
CPaintDC dc(this);
CMemDC memDC(&dc);
DefWindowProc(WM_PAINT, (WPARAM)memDC.m_hDC, 0);
}Hope this helps,
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Thanks Ryan! Now list of files is drawn, but for example column headers are not visible till I click on them. I'm using Custom Draw feature, maybe it has something to do with it...
s_k wrote: I'm using Custom Draw feature, maybe it has something to do with it... Possibly, but I'd still expect it to work. I haven't done this with custom draw, so I don't really know. Try removing the custom draw, and then trying again. If it paints, then that's good, and you might just have to do without the custom draw. You might need to do full owner draw instead. If not, I'm sorry I can't help much more.
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Hi all, I am trying to make my ListView (displaying files) scroll without any flickering. But I cannot get it work. I tried for example putting GetListCtrl().SetRedraw(FALSE) and GetListCtrl().SetRedraw(TRUE) around CListView::OnKeyDown() call if key pressed was PAGE DOWN or PAGE UP, but it made things even worse. For example this program does absolutely no flickers! http://www.altap.cz/ftp/salamand/salen200.exe Try scrolling eg. WINNT\System32 directory of any other directory with thousand of files with Page Down key held and you will see that. How is this possible??? I am using virtual ListView. Thank you for any suggestion!
-
Does
CListCtrl::Scroll()
not work?
[
](http://www.canucks.com)Sonork 100.11743 Chicken Little "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 Within you lies the power for good - Use it!
Hi, maybe I post my question in a wrong way - I AM able to scroll the content of my ListView, I have vertical scrollbar there and pressing Key Down/Up keys also scroll the ListView. But in case when I have for example 10.000 files in ListView and I'm holding Page Key/Up or moving fastly with scroll bar, ListView "flashes", or how to say that...So I'm looking for some method with help of which I would make my ListView scroll without flashing/flickering...And in post there is link to one piece of software that does it greatly. Best regards, Standa.
-
Hi, maybe I post my question in a wrong way - I AM able to scroll the content of my ListView, I have vertical scrollbar there and pressing Key Down/Up keys also scroll the ListView. But in case when I have for example 10.000 files in ListView and I'm holding Page Key/Up or moving fastly with scroll bar, ListView "flashes", or how to say that...So I'm looking for some method with help of which I would make my ListView scroll without flashing/flickering...And in post there is link to one piece of software that does it greatly. Best regards, Standa.
-
Thanks Ryan! Now list of files is drawn, but for example column headers are not visible till I click on them. I'm using Custom Draw feature, maybe it has something to do with it...
Hi, You have to exclude the headers from the clipbox, Try something like this...
CPaintDC dc(this); CRect headerRect; CRect clientRect; GetClientRect(&clientRect); GetDlgItem(0)->GetWindowRect(&headerRect); ScreenToClient(&headerRect); dc.ExcludeClipRect(&headerRect); CMemDC memDC(&dc); //memDC.FillSolidRect(&clientRect, RGB(255, 255, 255)); DefWindowProc(WM_PAINT, (WPARAM)memDC->m_hDC, (LPARAM)0);
Arjan