listCtrl - moving through selected lines
-
Hello, Moving through selected lines of a listCtrl from first to last is easy (GetFirstSelectedItemPosition - GetNextSelectedItem). But does anyone know an easy way to move from the last selected line to the first?? Thanks, Gerhard
With the last item as the current one, I think you can use
GetNextItem(-1, LVNI_SELECTED | LVNI_ABOVE)
for this. Why do you need this functionality?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
Hello, Moving through selected lines of a listCtrl from first to last is easy (GetFirstSelectedItemPosition - GetNextSelectedItem). But does anyone know an easy way to move from the last selected line to the first?? Thanks, Gerhard
If it worked the first time, wouldn't GetFirstSelectedItemPosition work again? :confused:
Chris Meech I am Canadian. [heard in a local bar] I agree with you that my argument is useless. [Red Stateler] Hey, I am part of a special bread, we are called smart people [Captain See Sharp] The zen of the soapbox is hard to attain...[Jörgen Sigvardsson] I wish I could remember what it was like to only have a short term memory.[David Kentley]
-
If it worked the first time, wouldn't GetFirstSelectedItemPosition work again? :confused:
Chris Meech I am Canadian. [heard in a local bar] I agree with you that my argument is useless. [Red Stateler] Hey, I am part of a special bread, we are called smart people [Captain See Sharp] The zen of the soapbox is hard to attain...[Jörgen Sigvardsson] I wish I could remember what it was like to only have a short term memory.[David Kentley]
-
With the last item as the current one, I think you can use
GetNextItem(-1, LVNI_SELECTED | LVNI_ABOVE)
for this. Why do you need this functionality?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
Tried the following: POSITION pos = listCtrl.GetFirstSelectedItemPosition(); if (pos) line = listCtrl.GetNextSelectedItem(pos); while (line != -1) { lineprev = line; line = listCtrl.GetNextSelectedItem(pos); }; line = lineprev; while (line != -1) { ........ line = listCtrl.GetNextItem(-1, LVNI_SELECTED | LVNI_ABOVE); }; But it doesn't work. Line is -1 after the first call of GetNextItem. But it's late here, maybe there's an obvious error:^) Thank's, Gerhard
-
Tried the following: POSITION pos = listCtrl.GetFirstSelectedItemPosition(); if (pos) line = listCtrl.GetNextSelectedItem(pos); while (line != -1) { lineprev = line; line = listCtrl.GetNextSelectedItem(pos); }; line = lineprev; while (line != -1) { ........ line = listCtrl.GetNextItem(-1, LVNI_SELECTED | LVNI_ABOVE); }; But it doesn't work. Line is -1 after the first call of GetNextItem. But it's late here, maybe there's an obvious error:^) Thank's, Gerhard
ensger wrote:
line = listCtrl.GetNextItem(-1, LVNI_SELECTED | LVNI_ABOVE);
Did you consider changing the
-1
argument to some other value?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
ensger wrote:
line = listCtrl.GetNextItem(-1, LVNI_SELECTED | LVNI_ABOVE);
Did you consider changing the
-1
argument to some other value?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb