|
-
April 10th, 2002, 12:45 AM
#1
Simple question, but need you help
I have a edit box. The variable associated with the edit box is "CString m_edit1". I want to know how to disable the edit box or enable the edit box.
please advice.
-
April 10th, 2002, 01:28 AM
#2
Re: Simple question, but need you help
Hi
Use the Resource ID attached to that edit box for enabling or disabling the edit box.
EX: say IDC_EDIT1 is your resource Id for that edit box then,
//to disable
GetDlgItem(IDC_EDIT1)->EnableWindow(FALSE);
//to enable
GetDlgItem(IDC_EDIT1)->EnableWindow(TRUE);
Regards
SKP
Be sure to rate answers if it helped, to encourage them.
-
April 10th, 2002, 01:29 AM
#3
Re: Simple question, but need you help
you can use two ways:
1. Create a variable control for your edit box
ex: CEdit m_cedit1
then type this code:
m_cedit1.EnableWindow(0):To disable
m_cedit1.EnableWindow(1):To enable
2. get the control id of the control edit box(see in properties of edit box)
Then type this code:
GetDlgItem(control_id)::EnableWindow(0): To disable
GetDlgItem(control_id)::EnableWindow(1): To enable.
Hope it helps you...
Please rate if this one answers your problem
-
April 10th, 2002, 01:31 AM
#4
Re: Simple question, but need you help
You need to create a CEdit for your edit box, just like how you create the variable except in this case you select 'Control' instead of 'Value' from the Category combo. Then you can use// m_ctrlEdit is the CEdit object that you have created for your edit box
m_ctrlEdit.EnableWindow(/* TRUE or FALSE */);
Chen Weiye
--------------------------------------------------------------------------------------------
When pursuing your dream, don't forget to enjoy your life...
--------------------------------------------------------------------------------------------
Chen Weiye
-----------------------------------------------------------------------------
When pursuing your dream, don't forget to enjoy your life
-----------------------------------------------------------------------------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|