apply a determined color to my selected text
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
apply a determined color to my selected text
Hello Sergey,
I have a function that find a word in all my text, each word found, the function selects it and (now is the doubt)
When I select a found word in my text, I want to change the color of the font, or the background text color to yellow, for example.
How can I do this?
Actually to change the color of my selected text I use the action rvActionFontColor1.
thanks
Alexandre
I have a function that find a word in all my text, each word found, the function selects it and (now is the doubt)
When I select a found word in my text, I want to change the color of the font, or the background text color to yellow, for example.
How can I do this?
Actually to change the color of my selected text I use the action rvActionFontColor1.
thanks
Alexandre
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
The coloring actions can apply the specified colors without displaying a color picker:
For the background color, use TrvActionFontBackColor.
If you want to apply both:
Code: Select all
rvActionFontColor1.UserInterface := rvacNone;
rvActionFontColor1.Color := clRed;
rvActionFontColor1.ExecuteTarget(RichViewEdit1);
rvActionFontColor1.UserInterface := rvacAdvanced;
If you want to apply both:
Code: Select all
rvActionFontColor1.UserInterface := rvacNone;
rvActionFontBackColor1.UserInterface := rvacNone;
rvActionFontColor1.Color := clRed;
rvActionFontBackColor1.Color := clYellow;
RichViewEdit1.TopLevelEditor.BeginUndoGroup(rvutStyleNo);
RichViewEdit1.TopLevelEditor.SetUndoGroupMode(True);
rvActionFontColor1.ExecuteTarget(RichViewEdit1);
rvActionFontBackColor1.ExecuteTarget(RichViewEdit1);
RichViewEdit1.TopLevelEditor.SetUndoGroupMode(False);
rvActionFontColor1.UserInterface := rvacAdvanced;
rvActionFontBackColor1.UserInterface := rvacAdvanced;
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
Hello Sergey,
I don't know why but when I give a double click in a word and try to apply the color font to my selected word, it is not working.
Take a look at my code:
In my editor, Is there a option that the user must select a word and apply an color, this is possible in RichEdit, why not is possible in DBSRichViewEdit? Something that I forgot to insert into my code?
I don't know why but when I give a double click in a word and try to apply the color font to my selected word, it is not working.
Take a look at my code:
Code: Select all
procedure TFEDITORTEXTO.Editor1DblClick(Sender: TObject);
begin
if rvActionItemProperties1.Enabled then
rvActionItemProperties1.ExecuteTarget((Sender as TSRichViewEdit).ActiveEditor);
rvActionFontColor1.UserInterface := rvacNone;
rvActionFontColor1.Color := clRed;
rvActionFontColor1.ExecuteTarget(Editor1.RichViewEdit);
rvActionFontColor1.UserInterface := rvacAdvanced;
end;
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
Hello Sergey,
Yeah, due to that problem that after calling the doubleclick event, it selects the word, I can't apply the font color.
I made the change you told me to do and also nothing was did. But we both know that this problem is due to that.
I will wait the fixed version
This fix will help me with another question too.
thanks
Yeah, due to that problem that after calling the doubleclick event, it selects the word, I can't apply the font color.
I made the change you told me to do and also nothing was did. But we both know that this problem is due to that.
I will wait the fixed version
This fix will help me with another question too.
thanks
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
Sergey,
Now this function GetSelText is also working fine )
This was an error that I had times ago
http://www.trichview.com/forums/viewtopic.php?t=5106
Now this function GetSelText is also working fine )
This was an error that I had times ago
http://www.trichview.com/forums/viewtopic.php?t=5106