Re: Win32Lib - addStyle/removeStyle
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 12, 2003
- 431 views
----- Original Message ----- From: "Jonas Temple" <jtemple at yhti.net> To: "EUforum" <EUforum at topica.com> Subject: Win32Lib - addStyle/removeStyle > > Anyone have any experience with addStyle/removeStyle? What I'm wanting > to do is add/remove the ES_READONLY style from a rich edit during > program execution. > > When I use these routines nothing happens. I've tried using setEnable() > but if the control is disabled the scroll bar is also disable, therefore > the user cannot scroll down through the text. > > Any suggestions? I'm afraid that this is the way that the richedit control, as supplied by Microsoft, works. Once its read-only style is set at creation time, it cannot be changed during run-time. One trick to get around this is to use two controls, identical to each other except the read-only status. When you need to switch to read-only, copy the current text to the read-only control, hide the read-write control and make the read-only control visible. When you need to switch back, reverse the procedure. ---------------- cheers, Derek Parnell