Click here to Skip to main content
15,936,119 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: list control Pin
David Crow10-Jul-06 6:11
David Crow10-Jul-06 6:11 
GeneralRe: list control Pin
jokefake10-Jul-06 6:39
jokefake10-Jul-06 6:39 
QuestionRe: list control Pin
David Crow10-Jul-06 6:41
David Crow10-Jul-06 6:41 
AnswerRe: list control Pin
jokefake10-Jul-06 6:48
jokefake10-Jul-06 6:48 
GeneralRe: list control Pin
David Crow10-Jul-06 7:31
David Crow10-Jul-06 7:31 
GeneralRe: list control Pin
jokefake11-Jul-06 1:57
jokefake11-Jul-06 1:57 
GeneralRe: list control Pin
David Crow11-Jul-06 2:07
David Crow11-Jul-06 2:07 
GeneralRe: list control Pin
jokefake11-Jul-06 2:57
jokefake11-Jul-06 2:57 
deleting it first, deletes the row as i click on the buttom



i extracted my code from here.


BOOL CListCtrlEx::MoveRow(int from, int to)
{
//Can't move to the same place, or from or to a negative index
if(from == to || from < 0 || to < 0)
return FALSE;

//First Copy the row to the new location
if(CopyRow(from, to))
{
//If we have just inserted a row before
//this one in the list, we need to increment
//our index.
if(from > to)
DeleteItem(from + 1);
else
DeleteItem(from);

return TRUE;
}
else
return FALSE;
}

BOOL CListCtrlEx::CopyRow(int from, int to)
{
//Can't move to the same place, or from or to a negative index
if(from == to || from < 0 || to < 0)
return FALSE;

//Copy the row to the new index
InsertItem(to, GetItemText(from, 0));

//If row has been inserted before original
//increment the original
if(from > to)
from++;

//Loop through subitems
for(int i = 1; i < GetColumnCount(); i++)
{
SetItemText(to, i, GetItemText(from, i));
}

return TRUE;
}
GeneralRe: list control Pin
David Crow11-Jul-06 4:52
David Crow11-Jul-06 4:52 
QuestionRe: list control Pin
jokefake11-Jul-06 5:29
jokefake11-Jul-06 5:29 
AnswerRe: list control Pin
David Crow11-Jul-06 5:39
David Crow11-Jul-06 5:39 
GeneralRe: list control Pin
jokefake11-Jul-06 6:01
jokefake11-Jul-06 6:01 
GeneralRe: list control Pin
David Crow11-Jul-06 6:19
David Crow11-Jul-06 6:19 
QuestionRe: list control Pin
jokefake11-Jul-06 7:02
jokefake11-Jul-06 7:02 
QuestionRe: list control Pin
David Crow11-Jul-06 7:11
David Crow11-Jul-06 7:11 
AnswerRe: list control [modified] Pin
jokefake11-Jul-06 23:50
jokefake11-Jul-06 23:50 
GeneralRe: list control Pin
David Crow12-Jul-06 2:23
David Crow12-Jul-06 2:23 
AnswerRe: list control Pin
FarPointer10-Jul-06 4:23
FarPointer10-Jul-06 4:23 
GeneralRe: list control Pin
jokefake10-Jul-06 5:49
jokefake10-Jul-06 5:49 
QuestionWIN32 and MFC FAQ's Pin
Abhi Lahare10-Jul-06 3:39
Abhi Lahare10-Jul-06 3:39 
AnswerRe: WIN32 and MFC FAQ's Pin
Sarath C10-Jul-06 4:13
Sarath C10-Jul-06 4:13 
AnswerRe: WIN32 and MFC FAQ's Pin
Jun Du10-Jul-06 4:32
Jun Du10-Jul-06 4:32 
AnswerRe: WIN32 and MFC FAQ's Pin
earl10-Jul-06 5:26
earl10-Jul-06 5:26 
AnswerRe: WIN32 and MFC FAQ's Pin
Joe Woodbury10-Jul-06 8:30
professionalJoe Woodbury10-Jul-06 8:30 
Questionpipe to istream Pin
khb10-Jul-06 3:27
khb10-Jul-06 3:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.