rw8
asked on
How to reset the scrollbar and scroll position of a CListCtrl box?
Hi i have a CListCtrl Box (in Icon view) in my application which i need to fill it up with lots of icons and the icons will be removed and new icons will be added from time to time... everythings working fine except i can't figure out how to reset the scrollbar and scroll position (to origin) when i'm updating the icons.
At the moment I got this in my code but it doesn't seem to working too well:
//The function for updating the CListCtrl Box
SetWindowLong(m_ctlColourS ample.m_hW nd,GWL_STY LE,m_listB oxStyle );
//clears the current colour list and Clistctrl box
while(!m_currentSampleList ->IsEmpty( ))
{
CSample *pa;
pa = (CSample*)m_currentSampleL ist->Remov eHead();
delete pa;
}
int imageCount= m_imageListColour->GetImag eCount();
for (int k=imageCount;k >0;k--)
{
m_imageListColour->Remove( k-1);
}
//resets the position.. doesn't really work well
m_ctlColourSample.SetScrol lPos( SB_HORZ ,1, false);
m_ctlColourSample.SetScrol lPos( SB_VERT ,1, true);
m_ctlColourSample.SetScrol lRange(SB_ HORZ,0,0,f alse);
m_ctlColourSample.SetScrol lRange(SB_ VERT,0,0,f alse);
//codes adding new icons
..
..
..
..
//
//try to reset the scroll position to origin.. doesn't really work
m_ctlColourSample.SetScrol lPos( SB_HORZ ,1, false);
m_ctlColourSample.SetScrol lPos( SB_VERT ,1, true);
Anyone tell me how to fix the problem? did i do something wrong?
cheers,
At the moment I got this in my code but it doesn't seem to working too well:
//The function for updating the CListCtrl Box
SetWindowLong(m_ctlColourS
//clears the current colour list and Clistctrl box
while(!m_currentSampleList
{
CSample *pa;
pa = (CSample*)m_currentSampleL
delete pa;
}
int imageCount= m_imageListColour->GetImag
for (int k=imageCount;k >0;k--)
{
m_imageListColour->Remove(
}
//resets the position.. doesn't really work well
m_ctlColourSample.SetScrol
m_ctlColourSample.SetScrol
m_ctlColourSample.SetScrol
m_ctlColourSample.SetScrol
//codes adding new icons
..
..
..
..
//
//try to reset the scroll position to origin.. doesn't really work
m_ctlColourSample.SetScrol
m_ctlColourSample.SetScrol
Anyone tell me how to fix the problem? did i do something wrong?
cheers,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER