Click here to Skip to main content
15,904,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Help with textbox control Pin
Nelek14-May-07 23:34
protectorNelek14-May-07 23:34 
AnswerRe: Help with textbox control Pin
Stick^14-May-07 23:40
Stick^14-May-07 23:40 
GeneralRe: Help with textbox control Pin
Nelek15-May-07 1:01
protectorNelek15-May-07 1:01 
AnswerRe: Help with textbox control Pin
Hamid_RT15-May-07 0:56
Hamid_RT15-May-07 0:56 
GeneralRe: Help with textbox control Pin
Stick^15-May-07 1:10
Stick^15-May-07 1:10 
GeneralRe: Help with textbox control Pin
Nelek15-May-07 1:44
protectorNelek15-May-07 1:44 
GeneralRe: Help with textbox control Pin
Stick^15-May-07 2:21
Stick^15-May-07 2:21 
GeneralRe: Help with textbox control Pin
Nelek15-May-07 3:12
protectorNelek15-May-07 3:12 
Hi another time,

ok, I have the DoDataExchange in my Form, and a member variable associated to my CEdit.
DDX_Text(pDX, IDC_MYEDIT, m_szMemberString);

I initialize it to “” (empty) in the constructor.

And then, in some events/messages I put the name of another element I saved in the Document, in the example a click in a ListCtrl (report mode) where my elements are listed

void CMyFormView::OnClickCtrlList(NMHDR* pNMHDR, LRESULT* pResult) 
{	POSITION pos = m_clcMyList.GetFirstSelectedItemPosition();

	//If the click was outside the range
if (!pos)
	{	m_nRowNum = -1;
		m_cbButton1.EnableWindow (FALSE);
		m_ szMemberString = "";
		UpdateData (FALSE);
	}
	
	while (pos)
	{	m_nRowNum = m_clcRuleList.GetNextSelectedItem(pos);
		M_szMemberString = pDoc->GetElementNameOfColumn (m_nRowNum);
		m_cbButton1.EnableWindow (TRUE);
		UpdateData (FALSE);
	}

	Invalidate ();			UpdateWindow ();
	*pResult = 0;
	return;
}


Another way (without member variables and the DoDataExchange) can be:
void CMyFormView::OnClickCtrlList(NMHDR* pNMHDR, LRESULT* pResult) 
{	POSITION pos = m_clcMyList.GetFirstSelectedItemPosition();
	CEdit* pEdit = (CEdit*)GetDlgItem (IDC_MYEDIT);

	//If the click was outside the range
	if (!pos)
	{	m_nRowNum = -1;
		m_cbButton1.EnableWindow (FALSE);
		pEdit->SetWindowText ("");
	}
	
	while (pos)
	{	m_nRowNum = m_clcRuleList.GetNextSelectedItem(pos);
		pEdit->SetWindowText (pDoc->GetElementNameOfColumn (m_nRowNum));
		m_cbButton1.EnableWindow (TRUE);
	}

	Invalidate ();			UpdateWindow ();
	*pResult = 0;
	return;
}


The function I’m using is: CString CMyDoc::GetElementNameOfColumn (int nRow);




Greetings.

--------
M.D.V.

If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

GeneralRe: Help with textbox control Pin
Stick^15-May-07 3:21
Stick^15-May-07 3:21 
GeneralRe: Help with textbox control Pin
Nelek15-May-07 21:11
protectorNelek15-May-07 21:11 
GeneralRe: Help with textbox control Pin
Hamid_RT15-May-07 1:53
Hamid_RT15-May-07 1:53 
QuestionChanging datatype from VB.NET to VC++ 6.0 Pin
ctlqt1214-May-07 22:36
ctlqt1214-May-07 22:36 
AnswerRe: Changing datatype from VB.NET to VC++ 6.0 Pin
fang_eric15-May-07 0:13
fang_eric15-May-07 0:13 
QuestionRegistry notification Pin
Alexandre GRANVAUD14-May-07 21:43
Alexandre GRANVAUD14-May-07 21:43 
AnswerRe: Registry notification Pin
Rajesh R Subramanian15-May-07 7:16
professionalRajesh R Subramanian15-May-07 7:16 
GeneralRe: Registry notification Pin
Alexandre GRANVAUD15-May-07 7:22
Alexandre GRANVAUD15-May-07 7:22 
QuestionHow to print with a new CPrintDialog derived DBox?? Pin
Nelek14-May-07 21:03
protectorNelek14-May-07 21:03 
AnswerRe: How to print with a new CPrintDialog derived DBox?? Pin
Hamid_RT14-May-07 22:01
Hamid_RT14-May-07 22:01 
GeneralRe: How to print with a new CPrintDialog derived DBox?? Pin
Nelek14-May-07 22:50
protectorNelek14-May-07 22:50 
GeneralRe: How to print with a new CPrintDialog derived DBox?? Pin
Hamid_RT15-May-07 5:59
Hamid_RT15-May-07 5:59 
GeneralRe: How to print with a new CPrintDialog derived DBox?? Pin
Nelek15-May-07 21:24
protectorNelek15-May-07 21:24 
GeneralRe: How to print with a new CPrintDialog derived DBox?? Pin
Hamid_RT15-May-07 21:54
Hamid_RT15-May-07 21:54 
GeneralRe: How to print with a new CPrintDialog derived DBox?? Pin
Hamid_RT15-May-07 22:28
Hamid_RT15-May-07 22:28 
GeneralSolved Pin
Nelek15-May-07 22:53
protectorNelek15-May-07 22:53 
QuestionHow to read a unicoded file Pin
Karismatic14-May-07 20:19
Karismatic14-May-07 20: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.