1. Win32Lib - addStyle/removeStyle
- Posted by Jonas Temple <jtemple at yhti.net> Mar 12, 2003
- 478 views
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? Thanks! Jonas
2. Re: Win32Lib - addStyle/removeStyle
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 12, 2003
- 458 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
3. Re: Win32Lib - addStyle/removeStyle
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 13, 2003
- 469 views
On Thu, 13 Mar 2003 07:48:09 +1100, Derek Parnell <ddparnell at bigpond.com> wrote: > > ----- 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? Actually there is another method that I use that has the same effect. procedure KeyPress_RE(integer self, integer event, sequence parms) if equal(getUserProperty(self, "ReadOnly"), {True}) then returnValue(-1) end if end procedure setHandler(RE, w3HKeyPress, routine_id("KeyPress_RE")) defineUserProperty(RE, "ReadOnly", False) . . . if NeedsReadOnly then setUserProperty(RE, "ReadOnly", True) end if -- cheers, Derek Parnell
4. Re: Win32Lib - addStyle/removeStyle
- Posted by Robert Szalay <robsz1 at hotpop.com> Mar 13, 2003
- 485 views
Well actually... You can acheive this effect via sendMessage. Enable read-only: junk = sendMessage(RichEditID, EM_SETREADONLY, 1, 0) Disable read-only: junk = sendMessage(RichEditID, EM_SETREADONLY, 0, 0) Regards, Robert Szalay
5. Re: Win32Lib - addStyle/removeStyle
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 13, 2003
- 529 views
On Thu, 13 Mar 2003 04:59:00 +0000, Robert Szalay <robsz1 at hotpop.com> wrote: > > Well actually... > > You can acheive this effect via sendMessage. > > Enable read-only: > junk = sendMessage(RichEditID, EM_SETREADONLY, 1, 0) > > Disable read-only: > junk = sendMessage(RichEditID, EM_SETREADONLY, 0, 0) > Well, there's yet another thing that I didn't know about. Thanks Robert. -- cheers, Derek Parnell