OWL NExt - Knowledge Base

[ Home | Contents | Search | Next | Previous | Up ]

Disabling static text and TEdit boxes?

Date: 11/30/99
Time: 12:14:41 AM


Q. Still struggling with graying out and disabling static text and TEdit boxes in the dialog box.

I have taken two lines from the .RC file:

CONTROL "", IDC_UNITS, "edit", ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 88, 26, 68, 13
CONTROL "Units", Unitid, "static", SS_LEFT |

The first line is for the TEdit box. In the .cpp file i have set a check

TMyApp::DialogBox()
{
    check=10;
    if (check == 10)    {
        SendDlgItemMessage( IDC_UNITS, WS_DISABLED | WS_VISIBLE);
    }

}
This does not disable the edit box, does anybody know what i am doing wrong?

To disable the text i do

if (check == 10)    {
    SendDlgItemMessage(Unitid, WS_DISABLE);
}

But no joy

A.
If you have created an OWL object for your edit object

    MyEdit = new TEdit(this,IDC_UNITS);

    Then you can do stuff like

    MyEdit->EnableWindow(false);

    and/or

    MyEdit->ShowWindow(SW_HIDE);

    in any member function AFTER you call TDialog::SetupWindow().
    If you haven't created an Owl object you can

    ::EnableWindow(GetDlgItem(IDC_UNITS),false);

    Same deal for your static controls.

Last changed: July 14, 2001