How to create static text dynamically on dialogbox?
-
Hi All, I want ot create static text on the dialog box. I wrote following code in OninitDialog function. CStatic myStatic; myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(15,15,150,50), this); But it doesn't work for me. Whats wrong.. can anybody help me regards, Aj
-
Hi All, I want ot create static text on the dialog box. I wrote following code in OninitDialog function. CStatic myStatic; myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(15,15,150,50), this); But it doesn't work for me. Whats wrong.. can anybody help me regards, Aj
Declare
CStatic myStatic;
in class not in a function_**
**_
whitesky
-
Hi All, I want ot create static text on the dialog box. I wrote following code in OninitDialog function. CStatic myStatic; myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(15,15,150,50), this); But it doesn't work for me. Whats wrong.. can anybody help me regards, Aj
-
Hi All, I want ot create static text on the dialog box. I wrote following code in OninitDialog function. CStatic myStatic; myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(15,15,150,50), this); But it doesn't work for me. Whats wrong.. can anybody help me regards, Aj
jadhav123 wrote:
Static myStatic; myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(15,15,150,50), this);
it is not created because, as soon as OnInitDialog function Exit, scope of MyStatic variable will end which inturn destory the object.. Now if you want to see Your Dynamically created Static Box you have to decalre CStatic variable as global or as classmember, so ity lifetime is that of program :)
"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