Click here to Skip to main content
15,903,030 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: query on Database support Pin
David Crow11-May-06 6:31
David Crow11-May-06 6:31 
GeneralRe: query on Database support Pin
swapna_signsin14-May-06 2:34
swapna_signsin14-May-06 2:34 
QuestionHow to compile a dialog-resource, source files into a DLL Pin
Jason Huang10-May-06 5:31
Jason Huang10-May-06 5:31 
AnswerRe: How to compile a dialog-resource, source files into a DLL Pin
Chris Losinger10-May-06 6:16
professionalChris Losinger10-May-06 6:16 
QuestionOnDraw Vs OnPaint in CView Pin
cpp_prgmer10-May-06 4:37
cpp_prgmer10-May-06 4:37 
AnswerRe: OnDraw Vs OnPaint in CView Pin
Michael Dunn10-May-06 10:02
sitebuilderMichael Dunn10-May-06 10:02 
GeneralRe: OnDraw Vs OnPaint in CView Pin
cpp_prgmer21-May-06 20:28
cpp_prgmer21-May-06 20:28 
QuestionLVN_ITEMCHANGING Pin
YaronNir10-May-06 4:32
YaronNir10-May-06 4:32 
Hi All,

I have a window that on the left side it has a list control, and selecting an item in that list , switch between child dialogs (same as in all property pages).


my problem is that before i jump into the new page i validate the current page and if it is not invalid i show a message. here i want to prevent the list from jumping to the new selected item.

here is the code i use:

BEGIN_MESSAGE_MAP(...)
ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST,OnListItemChanged)
ON_NOTIFY(LVN_ITEMCHANGING,IDC_LIST,OnListItemChanging)
END_MESSAGE_MAP(...)

void CMyWnd::OnListItemChanged(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLISTVIEW *pState = (NMLISTVIEW *)pNMHDR;

//... do whatever

*pResult = 0;
}

void CMyWnd::OnListItemChanging(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pState = (NM_LISTVIEW*)pNMHDR;

if (pState->iItem == m_iCurrentItem)
{
if (!ValidatePage(...)
{
*pResult = TRUE;
return;
}
}

*pResult = FALSE;
}

the problem is that the OnTopicListItemChanging is being called twice so i get twice a message box.....i tried to prevent that using a static bool variable, but didn't do me good...

any suggestions?

thanks in advanced
Yaron



Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp

don't forget to vote Smile | :)


-- modified at 10:33 Wednesday 10th May, 2006
AnswerRe: LVN_ITEMCHANGING Pin
David Crow10-May-06 6:17
David Crow10-May-06 6:17 
GeneralRe: LVN_ITEMCHANGING Pin
YaronNir10-May-06 10:00
YaronNir10-May-06 10:00 
Questionsrvany Problems Pin
steff.k@gmx.net10-May-06 4:16
steff.k@gmx.net10-May-06 4:16 
AnswerRe: srvany Problems Pin
David Crow10-May-06 6:13
David Crow10-May-06 6:13 
GeneralRe: srvany Problems Pin
steff.k@gmx.net10-May-06 21:03
steff.k@gmx.net10-May-06 21:03 
Questionhow to stop the action of one button by pushing another button Pin
joy2110-May-06 3:55
joy2110-May-06 3:55 
AnswerRe: how to stop the action of one button by pushing another button Pin
Cedric Moonen10-May-06 4:01
Cedric Moonen10-May-06 4:01 
QuestionRe: how to stop the action of one button by pushing another button Pin
joy2110-May-06 4:31
joy2110-May-06 4:31 
AnswerRe: how to stop the action of one button by pushing another button Pin
Cedric Moonen10-May-06 4:36
Cedric Moonen10-May-06 4:36 
AnswerRe: how to stop the action of one button by pushing another button Pin
Chris Losinger10-May-06 4:02
professionalChris Losinger10-May-06 4:02 
QuestionMsgsrv.exe Pin
Aryan S10-May-06 3:18
Aryan S10-May-06 3:18 
AnswerRe: Msgsrv.exe Pin
David Crow10-May-06 3:49
David Crow10-May-06 3:49 
AnswerRe: Msgsrv.exe Pin
Steffen Lange10-May-06 5:46
Steffen Lange10-May-06 5:46 
QuestionMetafile Pin
submit-CD10-May-06 3:15
submit-CD10-May-06 3:15 
AnswerRe: Metafile Pin
Chris Losinger10-May-06 3:52
professionalChris Losinger10-May-06 3:52 
GeneralRe: Metafile Pin
submit-CD10-May-06 4:23
submit-CD10-May-06 4:23 
GeneralRe: Metafile Pin
Chris Losinger10-May-06 4:47
professionalChris Losinger10-May-06 4:47 

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.