Updating text from another class
-
Hi all, Can u please tell me how to update an edit-box field present in a model-dialog from another class I have used CUsatDlg *dlg= new CUsatDlg; HWND hdlg =dlg->m_hWnd; SetDlgItemText(hdlg,IDC_SERIALNO,"Serial"); UpdateWindow(hdlg); Where CUsatDlg is mu dialog box class ,and IDC_SERIALNO is my edit box field But the edit-box is not displaying the text
-
Hi all, Can u please tell me how to update an edit-box field present in a model-dialog from another class I have used CUsatDlg *dlg= new CUsatDlg; HWND hdlg =dlg->m_hWnd; SetDlgItemText(hdlg,IDC_SERIALNO,"Serial"); UpdateWindow(hdlg); Where CUsatDlg is mu dialog box class ,and IDC_SERIALNO is my edit box field But the edit-box is not displaying the text
Veeresh Hiremath wrote:
edit-box field present in a model-dialog from another class
You need to pass a pointer of the class (where the edit box is contained) to another class. Using that pointer you can access the variables in another class.
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Veeresh Hiremath wrote:
edit-box field present in a model-dialog from another class
You need to pass a pointer of the class (where the edit box is contained) to another class. Using that pointer you can access the variables in another class.
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
_AnShUmAn_ I am newbie to vc++/mfc. Can u please send me a skeleton code
-
Hi all, Can u please tell me how to update an edit-box field present in a model-dialog from another class I have used CUsatDlg *dlg= new CUsatDlg; HWND hdlg =dlg->m_hWnd; SetDlgItemText(hdlg,IDC_SERIALNO,"Serial"); UpdateWindow(hdlg); Where CUsatDlg is mu dialog box class ,and IDC_SERIALNO is my edit box field But the edit-box is not displaying the text
if your main class is Main and another class in Local you can use this code on Local class
CMain *m_Main=(CMain*)GetParent(); m_Main->functions or variables
WhiteSky
-
_AnShUmAn_ I am newbie to vc++/mfc. Can u please send me a skeleton code
Veeresh Hiremath wrote: Can u please send me a skeleton code Here is a sample code. You access the function of class B from class A. On similar lines you can also use the variables etc. #include using namespace std; class B { public: B() { cout<<"Constructor of B\n"; } void Display() { cout<<"In Function Display of B\n"; } }; class A { public: B b; A() { cout<<"Constructor of A\n"; } void CallBClassFn() { b.Display(); } }; int _tmain(int argc, _TCHAR* argv[]) { A a; a.CallBClassFn (); return 0; } I hope this helps in solving out your problem... Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Hi all, Can u please tell me how to update an edit-box field present in a model-dialog from another class I have used CUsatDlg *dlg= new CUsatDlg; HWND hdlg =dlg->m_hWnd; SetDlgItemText(hdlg,IDC_SERIALNO,"Serial"); UpdateWindow(hdlg); Where CUsatDlg is mu dialog box class ,and IDC_SERIALNO is my edit box field But the edit-box is not displaying the text
Simply post a message to the window (e.g., dialog) that owns the edit control.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
Hi all, Can u please tell me how to update an edit-box field present in a model-dialog from another class I have used CUsatDlg *dlg= new CUsatDlg; HWND hdlg =dlg->m_hWnd; SetDlgItemText(hdlg,IDC_SERIALNO,"Serial"); UpdateWindow(hdlg); Where CUsatDlg is mu dialog box class ,and IDC_SERIALNO is my edit box field But the edit-box is not displaying the text
Veeresh Hiremath wrote:
CUsatDlg *dlg= new CUsatDlg; HWND hdlg =dlg->m_hWnd;
you need the actual Window Handle of displayed window.. this willnot help.. either have a pointer to that class. or make some global variable!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief And you