Dialog box Static text
-
I have a dialog box with an Editbox. I just want to have an Static text int he dialog box which will display number of characters present in the Editbox Thanks a lot for your time and help.
-
I have a dialog box with an Editbox. I just want to have an Static text int he dialog box which will display number of characters present in the Editbox Thanks a lot for your time and help.
-
I have a dialog box with an Editbox. I just want to have an Static text int he dialog box which will display number of characters present in the Editbox Thanks a lot for your time and help.
What you can do is set the text of your static control whenever something changes in the EditBox. Here how to do that: 1) Go to class wizzard and add a handler function for the 'change text' message (I don't remember which message exactly. 2) In this handler function Retrieve the text of your EditBox (GetWindowText) and calculate his length (with strlen). 3) Format this value in a new string (with sprintf) and set the text of the static control (SetWindowText)
-
I have a dialog box with an Editbox. I just want to have an Static text int he dialog box which will display number of characters present in the Editbox Thanks a lot for your time and help.
Handle the
EN_CHANGE
message on Edit Box :- here is handller and IDC_EDIT1 is ID of Edit Box and IDC_STATIC_TEST is ID of the static box.void CNegCtrlDlg::OnChangeEdit1()
{
CString str;
this->GetDlgItemText(IDC_EDIT1,str);// Set number of the charecter in static box'
SetDlgItemInt(IDC_STATIC_TEXT,str.GetLength());}
"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
-
What you can do is set the text of your static control whenever something changes in the EditBox. Here how to do that: 1) Go to class wizzard and add a handler function for the 'change text' message (I don't remember which message exactly. 2) In this handler function Retrieve the text of your EditBox (GetWindowText) and calculate his length (with strlen). 3) Format this value in a new string (with sprintf) and set the text of the static control (SetWindowText)
cedric moonen wrote: What you can do is set the text of your static control whenever something changes in the EditBox. Here how to do that:
Ohh I miss DeadLine :((:(
"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