Link to home
Start Free TrialLog in
Avatar of kakamna
kakamna

asked on

How to Make Edit Control Read Only

I have created a View Drived from FormView. Also I have Inserted a
Edit Box from Resource Editor on My Dialog/Form. Now i want to
make the Edit Control Read Only at RunTime(by code not on Intial Setting).
ASKER CERTIFIED SOLUTION
Avatar of RAVID
RAVID

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zoppo
Hi kakamna,

To RAVID: what your code does is makeing a edit box disabled, which is not exactly the same as read-only: In a read-only edit box the user can still select the text and copy it to the clipboard, in a disabled edit box the user cannot select any text.

To set a edit box to read-only just use the CEdit::SetReadOnly() function, i.e.:

m_edit.SetWindowText(...);
m_edit.SetReadOnly( TRUE );

hope that helps,

ZOPPO
Avatar of RAVID
RAVID

hi,

u can also use

m_edit.ModifyStyle(0,ES_READONLY,0);

to get the read only property

cheers