Re: RichEdit Attributes Bold, Italic, Underline

new topic     » goto parent     » topic index » view thread      » older message » newer message

Craig Welch wrote:
> 
> Alan Hollingsworth wrote:
> > Instead of using the font dialog to change attributes like bold, italic,
> > underline
> > I want to use a seperate button for each and toggle these attributes on/off
> > for
> > either selected text or from the insertion point while editing text.
> >
> > Nothing I try seems to work. Is there a way of doing this, Or am I better
> > off
> > just using the font dialog instead?
> 
> My understanding is that you would have to (with code in your button) do 
> the following.
> 
> Get the selected text with
> buffer = getStream(RichTextField, StreamRTF).
> Modify it to change various attributes (see below).
> Put the text back in the control with putstream(RichTextField, 
> StreamRTF, buffer).
> 
> To change the attributes of the text, you would have to learn up on RTF.

I just bought "RTF Pocket Guide" with the intention of learning more about RTF.

> 
> As an example, the following will display the word 'Euphoria' in plain 
> text then in bold text on a new line:
> 
> =====================================
> {\rtf1\ansi\deff0
> {\fonttbl{\f0 Times New Roman;}
> }
> \f0 Euphoria\par
> \b \f0 Euphoria
> }
> =====================================
> The only change is the '\b' to make it bold, but it's the placement that 
> is the key.
> 
> To test it, copy the file to a text editor; save it with a filetype of 
> .rtf; double-click, and it should open in Word.
> 
> -- 
> Craig
> 
Thanks for taking the time to give me your ideas on this. I see now that I am at
least on the right track.
There are probably many ways to go about manipulating text within the RichEdit
control. I have much more than just RTF to learn about I'm sure.
Looks like I will also need to learn more about riched20.dll and how to use it
from within Euphoria.
(hopefully I'll get the hang of using this forum along the way...)
This should be interesting and fun too:)

Alan

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu