Disable Edit Box In A Dialog

How can I disable a text edit box in a dialog I have in my application? I have a drop down control in the same dialog, and I would like to disable that edit box depending on the item I select in the drop down. Thanks.

Comments

  • Disable the windows.

    -----
    m_MyEditBox.EnableWindow(FALSE);
    -----

    Kuphryn
  • : Disable the windows.
    :
    : -----
    : m_MyEditBox.EnableWindow(FALSE);
    : -----
    :
    : Kuphryn
    :
    if m_MyEditBox is a member varible i sugest you to try this

    GetDlgItem(IDC_EDIT1)->EnableWindow(FALSE);

    The definition of GetDlgItem() :
    CWnd *GetDlgItem(UINT nID);

    if you have a lot of Controls that is economic mode for your internal memory;

    IDC_EDIT1 is an ID for an EditBox Control;
    ps. i'm sorry for my bad eng

  • : : Disable the windows.
    : :
    : : -----
    : : m_MyEditBox.EnableWindow(FALSE);
    : : -----
    : :
    : : Kuphryn
    : :
    : if m_MyEditBox is a member varible i sugest you to try this
    :
    : GetDlgItem(IDC_EDIT1)->EnableWindow(FALSE);
    :
    : The definition of GetDlgItem() :
    : CWnd *GetDlgItem(UINT nID);
    :

    : if you have a lot of Controls that is economic mode for your internal memory;
    :
    : IDC_EDIT1 is an ID for an EditBox Control;
    : ps. i'm sorry for my bad eng
    :
    :

    To make it easy if you have alot of controls to enable or disable, what I normally do is declare a few Macros in a header file:
    [CODE]
    #define Enable(x) GetDlgItem(x)->EnableWindow(TRUE)
    #define Disable(x) GetDlgItem(x)->EnableWindow(FALSE)
    [/CODE]
    Then it's as easy as writing Enable(x) or Disable(x)
    where x = UINT nid

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories