trichview.support
Re: Modify the Styles at runtime |
Author |
Message |
Sergey Tkachenko |
Posted: 07/10/2002 15:17:52 Hi, Changing formatting of selected text in edited cell can be done in absolutely the same way as if this selection is in the root editor. The best way to do it is using ApplyStyleConversion method + OnStyleConversion event. A demo for this: << http://www.trichview.com/support/files/redit.zip is an alternative version of demo showing how to implement commands like "make bold", "apply font", etc. This project is similar to one that can be found in Demos\Delphi\Assorted\RichEdit\ directory of RichView installation, with the following changes: 1) It is simplified. It uses the same technique for all UI commands, and a list of commands can be extended easily (one or two lines of code per new command) 2) It supports commands for paragraphs (such as "change first indent") This project requires additional components that can be found in Demos\Delphi\Assorted\RichEdit\Components\ >> Note 1: Such commands can be implemented without writing any code, if you'll use RichViewActions. Note 2: Since you add a new styles, it will be a good idea to store a set of styles together with documents. Right-click editor in Delphi, choose "Settings" in the context menu, select "Allow adding styles dynamically". > Hi, > > I would like to highlight the selected text from rve and can i make use of > the FontDialog to apply the effect. Cause right now i prebuild a list of > the TextStyle from the TRVStyle for the text effect e.g. bold and font size > .. > > Thank you for yor reply > > "Sergey Tkachenko" <[email protected]> wrote: > >Hi, > > > >This code changes properties of text style. > >This change will affect all documents that use this style (including all > >cells), and requires their reformatting by Format(). > > > >Please give me more details what do you want to implement, and I'll try > to > >suggest a way to do it. > > > > > >> Hi, > >> > >> Is the following code can apply to selected text. If do so can you show > me > >> the way. > >> > >> Thanks. > >> > >> > >> "Sergey Tkachenko" <[email protected]> wrote: > >> >Yes, you can assign TFont to text style. > >> >But you need to call RichViewEdit1->Format() if text of this style is > >> >already in the document. > >> > > >> >> Ok, I can use the regular FontDialog and Assign: > >> >> > >> >> FontDialog1->Font = Form1->Font; > >> >> if (FontDialog1->Execute()) > >> >> RVStyle1->TextStyles->Items[0]->Assign(FontDialog1->Font); > >> >> RichViewEdit1->SetFocus(); > >> >> > >> >> Benedikt > >> >> > >> >> > >> >> "Benedikt Weber" <[email protected]> wrote in message > >> >> news:[email protected]... > >> >> > I want to define Styles for categories of text like Title, Body, > >Table > >> >> Cell. > >> >> > The problem is how to modify the Styles at runtime. How can I call > >the > >> >> > FontDialog and assign the result to TextStyle? > >> >> > > >> >> > Can I call the FontDialogs that are used in Actions at all. Are they > >> >> > implemented with the RichViewMisc Components? So I should perhaps > >make > >> >my > >> >> > own dialog using those? > >> >> > > >> >> > Benedikt > >> >> > > >> >> > > >> >> > >> >> > >> > > >> > > >> > > > > > |
Powered by ABC Amber Outlook Express Converter