Click here to Skip to main content
15,916,702 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generaleasy question about CFile Pin
Martin_Viet8-Apr-03 2:58
Martin_Viet8-Apr-03 2:58 
GeneralRe: easy question about CFile Pin
Mike Zinni8-Apr-03 3:21
Mike Zinni8-Apr-03 3:21 
GeneralRe: easy question about CFile Pin
Pavel Klocek8-Apr-03 3:27
Pavel Klocek8-Apr-03 3:27 
GeneralRe: easy question about CFile Pin
puzzolino8-Apr-03 3:30
puzzolino8-Apr-03 3:30 
GeneralRe: easy question about CFile Pin
Cedric Moonen8-Apr-03 3:36
Cedric Moonen8-Apr-03 3:36 
GeneralRe: easy question about CFile Pin
Anonymous8-Apr-03 4:03
Anonymous8-Apr-03 4:03 
GeneralRe: easy question about CFile Pin
Martin_Viet8-Apr-03 4:46
Martin_Viet8-Apr-03 4:46 
GeneralOnItemChanged runs several times! Pin
ns8-Apr-03 2:44
ns8-Apr-03 2:44 
If I put a breakpoint in OnItemChanged of my CListCtrl, and debug, it runs through the function many many times! The statement at which I step into this function is a SetItemState to highlight a previous element.At first I thought it ran only twice, so I put a boolean flag which returned the code right away at the second pass after setting it to false again (the first time it runs, this flag is set to true at the end of the function....).

However OnItem runs over and over again, setting and unsetting the flag:

OnItemChanged()
{
if (flag)
{
flag = false;
return
}

if (some condition)

{
AfxMessageBox(...);
flag = true;
<code>list1.SetItemState(....);</code> // this line seems to trigger the onitemchanged recursively.....despite the flag,
return;
}

so I alternate between getting the messagebox and not in pairs of runs. Funnily enough after a zillion times of doing this it suddenly goes through like it should and the UI shows again, with the highlight where I intended it to be.
My intention was to have the messagebox pop up only once, and when dismissed the highlight should have been on the desired item and the UI ready for the next move.

}


Appreciate your help,
ns
GeneralRe: OnItemChanged runs several times! Pin
Joan M8-Apr-03 3:22
professionalJoan M8-Apr-03 3:22 
GeneralRe: OnItemChanged runs several times! Pin
ns8-Apr-03 3:30
ns8-Apr-03 3:30 
GeneralRe: OnItemChanged runs several times! Pin
Mike Upton8-Apr-03 3:29
Mike Upton8-Apr-03 3:29 
GeneralRe: OnItemChanged runs several times! Pin
ns8-Apr-03 4:01
ns8-Apr-03 4:01 
GeneralRe: OnItemChanged runs several times! Pin
Mike Upton8-Apr-03 4:27
Mike Upton8-Apr-03 4:27 
GeneralRAS AutoDial Settings problem Pin
Mark Otway8-Apr-03 1:00
Mark Otway8-Apr-03 1:00 
GeneralBmp to jpg convertion Pin
Mahesh Varma8-Apr-03 0:49
Mahesh Varma8-Apr-03 0:49 
GeneralRe: Bmp to jpg convertion Pin
Anonymous8-Apr-03 1:40
Anonymous8-Apr-03 1:40 
GeneralRe: Bmp to jpg convertion Pin
Chris Losinger8-Apr-03 1:42
professionalChris Losinger8-Apr-03 1:42 
GeneralRe: Bmp to jpg convertion Pin
Dudi Avramov8-Apr-03 1:54
Dudi Avramov8-Apr-03 1:54 
GeneralRe: Bmp to jpg convertion Pin
RaajaOfSelf9-Apr-03 13:08
RaajaOfSelf9-Apr-03 13:08 
GeneralList exported function in DLL Pin
AnTri8-Apr-03 0:22
AnTri8-Apr-03 0:22 
GeneralRe: List exported function in DLL Pin
vmaltsev8-Apr-03 5:06
vmaltsev8-Apr-03 5:06 
GeneralRe: List exported function in DLL Pin
AnTri8-Apr-03 11:04
AnTri8-Apr-03 11:04 
GeneralRe: List exported function in DLL Pin
Dudi Avramov8-Apr-03 23:04
Dudi Avramov8-Apr-03 23:04 
GeneralCListView Pin
rosen7-Apr-03 23:59
rosen7-Apr-03 23:59 
GeneralRe: CListView Pin
jhwurmbach8-Apr-03 0:16
jhwurmbach8-Apr-03 0:16 

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.