1. Rich Edit Questions

1> How do I clear a RichEdit control? I tried clear(RichEd) but this didn't work.

2> How do a change a RichEdit control to and from "Read Only"? So as to only allow editing when it suits me.

new topic     » topic index » view message » categorize

2. Re: Rich Edit Questions

lockiedownunder said...

1> How do I clear a RichEdit control? I tried clear(RichEd) but this didn't work.

2> How do a change a RichEdit control to and from "Read Only"? So as to only allow editing when it suits me.

I haven't tried these ideas yet, as I'm about to go see Carlton beat Essendon ... anyhow ...

setText(RE, "") -- Clear the control. 
 
RE = create(RichEdit, "", aWin, x,y, w,h, ES_READONLY) -- read only control 
 
removeStyle(RE, {ES_READONLY, 0}) -- Take away readonly style 
addStyle(RE,  {ES_READONLY, 0}) -- Add readonly style 

I'm not sure if the remove/add style works with richedits as they have loads of quirks.

If not, then I'd suggest you have two controls - one readonly and one not - overlay each other, then when you want to use other or the other, just make visible the one you want.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Rich Edit Questions

Thanks Derek, I didn't even try setText :( it works fine, I just assumed you had to stream text

Add and Remove style doesn't work so I will use your idea of using 2 RE overlayed. A bit messy bit it will do

Thanks again

new topic     » goto parent     » topic index » view message » categorize

4. Re: Rich Edit Questions

lockiedownunder said...

Thanks Derek, I didn't even try setText :( it works fine, I just assumed you had to stream text

Add and Remove style doesn't work so I will use your idea of using 2 RE overlayed. A bit messy bit it will do

Thanks again

There is a better way. The EM_SETREADONLY message wil do what you want. The first paramater of the message will set readonly if TRUE. The message is documented under the Edit control but it also works for RichEdit controls.

Larry Miller

new topic     » goto parent     » topic index » view message » categorize

5. Re: Rich Edit Questions

Awesome thanks for your help Derek and Larry

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu