dsch
asked on
How toenble & disable edit boxes
Hi everyone. Just when you thought it was safe to look at a question. I'm back!
Still doing edit & static controls in dialog boxes.
I would like to display and remove boxes depending on selection in checkbox.
eg. click checkbox and change an edit box from enabled to disabled to enabled etc.
case IDC_CHECKBOX:
{ if(1==SendMessage(GetDlgIt em(hdlg,ID C_CHECKBOX ),BM_GETCH ECK,0,0))
{SetWindowLong(
GetDlgItem(hdlg,IDC_TEXTBO X), // handle of window
GWL_STYLE, // offset of value to set
ES_RIGHT | WS_BORDER | WS_TABSTOP // new value
);
MessageBox(hdlg,"Clicked", "",MB_OK | MB_ICONINFORMATION);
}
else
{SetWindowLong(
GetDlgItem(hdlg,IDC_TEXTBO X), // handle of window
GWL_STYLE, // offset of value to set
ES_RIGHT | WS_BORDER | WS_TABSTOP | WS_DISABLED // new value
);
MessageBox(hdlg,"UNClicked ","",MB_OK | MB_ICONINFORMATION);
}
break;
}
I know that the message is being seen as the correct MessageBox is shown when I click the checkbox. All that happens though is it disables the edit box permanentley.
Like I say, I would really like it to disapear the become visible when I want it to be.
I am sure this must be trivial but I've been trying to do this for three nights now (It is a home project and it's driving me mad)
Regards to U all.
dsch
P.S.
Please no MFC or OWL
The app is win32 written in c++
Still doing edit & static controls in dialog boxes.
I would like to display and remove boxes depending on selection in checkbox.
eg. click checkbox and change an edit box from enabled to disabled to enabled etc.
case IDC_CHECKBOX:
{ if(1==SendMessage(GetDlgIt
{SetWindowLong(
GetDlgItem(hdlg,IDC_TEXTBO
GWL_STYLE, // offset of value to set
ES_RIGHT | WS_BORDER | WS_TABSTOP // new value
);
MessageBox(hdlg,"Clicked",
}
else
{SetWindowLong(
GetDlgItem(hdlg,IDC_TEXTBO
GWL_STYLE, // offset of value to set
ES_RIGHT | WS_BORDER | WS_TABSTOP | WS_DISABLED // new value
);
MessageBox(hdlg,"UNClicked
}
break;
}
I know that the message is being seen as the correct MessageBox is shown when I click the checkbox. All that happens though is it disables the edit box permanentley.
Like I say, I would really like it to disapear the become visible when I want it to be.
I am sure this must be trivial but I've been trying to do this for three nights now (It is a home project and it's driving me mad)
Regards to U all.
dsch
P.S.
Please no MFC or OWL
The app is win32 written in c++
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
In fact, I've just found ShowWindow(I didn't realise you could use it for anything) and it works in a similar way to EnableWindow, SW_HIDE & SW_SHOW sort that out.
Regards and thanks
Dsch