CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2006
    Posts
    33

    Question How to set an Edit in a Dialog read-only?

    All,

    I have a problem like this:
    I use a CString member to exchange data with CEdit using DDX, now I sometimes want the CEdit to be read-only, how can I implement this?

    Thanks a lot.

  2. #2
    Join Date
    Oct 2006
    Posts
    33

    Re: How to set an Edit in a Dialog read-only?

    I found a function "CWnd* GetDlgItem( int nID ) const" which may be used to resolve this problem, do you think so?

  3. #3
    Join Date
    Sep 2004
    Location
    New Delhi, India
    Posts
    640

    Re: How to set an Edit in a Dialog read-only?

    Set the Read Only property of the edit box to be TRUE. The DDX/DDV routines work fine even if the edit box is read only.

    You can do it this way as well:
    Code:
    CString strText;
    GetDlgItem (IDC_TEXT)->GetWindowText (strText);
    "I rather not play football than wear Nerrazzuri shirt" - Paolo Maldini
    FORZA MILAN!!!

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: How to set an Edit in a Dialog read-only?

    Err... CEdit::SetReadOnly?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured