Click here to Skip to main content
16,005,038 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
SetItemState might well be triggering several OnItemChanged calls - especially if you're changing the selection, because it might (depends if you've got multi-select enabled) unselect one item before selecting the next.

Anyway, whatever is going on, the easy solution is to set your flag before your call to SetItemState, and unset the flag when the call to SetItemState has returned:
::OnItemChanged(...) {
    static bool flag = false;
    if (flag) return;

    ...

    if (some condition)
    {
        flag = true; //lock-out OnItemChanged
        list1.SetItemState(...);
        flag = false; //re-enable OnItemChanged
    }

    ...    
}





"We are the knights who say Ni" (The Knights Who Say Ni)
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 
Generalcontext mneu question Pin
Jump_Around7-Apr-03 23:50
Jump_Around7-Apr-03 23:50 
GeneralRe: context mneu question Pin
Brian Shifrin8-Apr-03 1:15
Brian Shifrin8-Apr-03 1:15 
GeneralRe: context mneu question Pin
Cedric Moonen8-Apr-03 1:19
Cedric Moonen8-Apr-03 1:19 

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.