Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

Another question on dialog controls

I recently learned how to disable a CButton control prior to opening a modal dialog box with the following code:

CButton *cb = (CButton *)GetDlgItem(IDC_BUTTON);
cb->EnableWindow(FALSE);

I want to do something similar now.  What do I do if I want to make an edit control read only prior to opening the dialog box?
0
scs1
Asked:
scs1
  • 2
  • 2
1 Solution
 
dvestCommented:
CEdit *ce = (CEdit *)GetDlgItem(IDC_EDIT1);
ce->SetReadOnly( TRUE );

Should work like a charm! :)

Hope this helps,
David

0
 
scs1Author Commented:
It did indeed work like a charm!!! Thanks

P.S. where do you find these specifiers such as SetReadOnly??
0
 
dvestCommented:
 If using VC, pull up"help" then "search".  In this case CEdit or edit control is what you should look for.  In the bottom pane look for an entry that says "class members".  You'll access all kinds of great info for that control.  As a bonus, all the standard controls are derived from CWnd, so many CWnd functions are usable on the control as well!

Happy hunting,
David
0
 
scs1Author Commented:
Thanks again
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now