Highlight issue
Highlight issue
When I highlight text and select a highlight color and hit [OK], the text still shows the dark blue highlight. How can I get it to reveal the selected highlight color like MS Word works?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
RichEditor Demo...
I am using the RichEditor Demo.
I should make one thing clear. The highlighting takes place but it is not visible until I move the cursor. Then the highlight is visible. With MS Word when you select the highlight color the cursor moves to the front of the highlighted word annd the highlight color is immediately visible.
So how can I tell the cursor to move to the front of the highlighted word revealing the new highlight color?
[/img]
I should make one thing clear. The highlighting takes place but it is not visible until I move the cursor. Then the highlight is visible. With MS Word when you select the highlight color the cursor moves to the front of the highlighted word annd the highlight color is immediately visible.
So how can I tell the cursor to move to the front of the highlighted word revealing the new highlight color?
[/img]
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
In TRichView, the color of selection does not depend on the color of selected text.
If you want to view the result of the color change immediately, you can remove the selection after applying color.
For example, for the background color, you can add to the end of TForm1.btnFontBackColorClick the following code:
If you want to view the result of the color change immediately, you can remove the selection after applying color.
For example, for the background color, you can add to the end of TForm1.btnFontBackColorClick the following code:
Code: Select all
with rve.TopLevelEditor do
SetSelectionBounds(CurItemNo, OffsetInCurItem, CurItemNo, OffsetInCurItem);
rve.TopLevelEditor.Invalidate;
That worked...
Here is the application of your suggestion. Thanks...
procedure TFindingEntry.TextHighlightColor ;
begin
// if no highlight display color selection. if color, display messagebox
cd.Color := rvs.TextStyles[rve.CurTextStyleNo].BackColor;
if cd.Color = clNone then
begin
cd.Color := rvs.TextStyles[rve.CurTextStyleNo].BackColor;
if cd.Color=clNone then
cd.Color := clWhite;
if not cd.Execute then
exit;
end
else
begin // display messagebox
case Application.MessageBox('Clear the selected text highlight color? '#13+
'(YES - clear highlight; NO - choose color)',
'Text Background', MB_YESNOCANCEL or MB_ICONQUESTION) of
IDYES:
cd.Color := clNone;
IDNO:
begin
cd.Color := rvs.TextStyles[rve.CurTextStyleNo].BackColor;
if cd.Color=clNone then
cd.Color := clWhite;
if not cd.Execute then
exit;
end;
IDCANCEL:
exit;
end;
end ;
rve.ApplyStyleConversion(TEXT_BACKCOLOR);
// test
with rve.TopLevelEditor do
SetSelectionBounds(CurItemNo, OffsetInCurItem, CurItemNo, OffsetInCurItem);
rve.TopLevelEditor.Invalidate;
end;
procedure TFindingEntry.TextHighlightColor ;
begin
// if no highlight display color selection. if color, display messagebox
cd.Color := rvs.TextStyles[rve.CurTextStyleNo].BackColor;
if cd.Color = clNone then
begin
cd.Color := rvs.TextStyles[rve.CurTextStyleNo].BackColor;
if cd.Color=clNone then
cd.Color := clWhite;
if not cd.Execute then
exit;
end
else
begin // display messagebox
case Application.MessageBox('Clear the selected text highlight color? '#13+
'(YES - clear highlight; NO - choose color)',
'Text Background', MB_YESNOCANCEL or MB_ICONQUESTION) of
IDYES:
cd.Color := clNone;
IDNO:
begin
cd.Color := rvs.TextStyles[rve.CurTextStyleNo].BackColor;
if cd.Color=clNone then
cd.Color := clWhite;
if not cd.Execute then
exit;
end;
IDCANCEL:
exit;
end;
end ;
rve.ApplyStyleConversion(TEXT_BACKCOLOR);
// test
with rve.TopLevelEditor do
SetSelectionBounds(CurItemNo, OffsetInCurItem, CurItemNo, OffsetInCurItem);
rve.TopLevelEditor.Invalidate;
end;
Code: Select all
Position Of Highlighted texts in RVE
Hi,
i'm about to find the character Position of Highlighted texts in RVE, but im worndering how can i achieve that, and also i dont know the GetSelectionBounds function works with offset, cuz everytime it just returns the length of selected text +1 instead of strartOffset and endOffset (both are the same)!
and one more question
How can i find the type of items in RVE and filter some types and preventing them to be placed in RVE ?
THANK YOU.
i'm about to find the character Position of Highlighted texts in RVE, but im worndering how can i achieve that, and also i dont know the GetSelectionBounds function works with offset, cuz everytime it just returns the length of selected text +1 instead of strartOffset and endOffset (both are the same)!
and one more question
How can i find the type of items in RVE and filter some types and preventing them to be placed in RVE ?
THANK YOU.
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
1) You can use the functions from RVLinear unit:
http://www.trichview.com/help/idh_rvlinear.html
2) For example?
http://www.trichview.com/help/idh_rvlinear.html
2) For example?
and one more thing...
how can i use RVLinear functions to get linear coordinates of background-highlighted texts in RVE?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
1) For RTF import (as well as for all formats imported via RTF using TRVOfficeConverter), TRichView.RTFReadProperties has the following properties:
- IgnoreBookmarks;
- IgnoreNotes;
- IgnorePictures;
- IgnoreSequences;
- IgnoreTables;
- SkipHiddenText.
2) Do you mean selected text? What do you want to do with these coordinates later?
- IgnoreBookmarks;
- IgnoreNotes;
- IgnorePictures;
- IgnoreSequences;
- IgnoreTables;
- SkipHiddenText.
2) Do you mean selected text? What do you want to do with these coordinates later?
hmmm..
1) tnx for this solution, but what about Pasting Pictures for example? how can i ban the picture paste?
2) No, i mean a text with red background for example. if i knew how to get the FontInfo.BackColor of each item, this would be solved!
i want to export only the back-colored sections of the text for a reason!
tnx
2) No, i mean a text with red background for example. if i knew how to get the FontInfo.BackColor of each item, this would be solved!
i want to export only the back-colored sections of the text for a reason!
tnx
another problem..
i have another problem too.. when the filename is just unicode characters, the rvc.importRV function can not import and returns False?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
1) You can allow pasting only RVF, RTF and plain text:
Unfortunately, there are no ways to exclude pictures or tables when inserting RVF (RichView Format), so you may exclude it as well (well, there is a way: pasting in a hidden TRichViewEdit, removing pictures and tables in it, saving this hidden RichViewEdit using SaveRVFToStream, then inserting in the main editor using InsertRVFFromStreamEd).
Additionally, pictures or tables can appear as a result of drag&drop. You can exclude formats from AcceptDragDropFormats property.
Code: Select all
procedure TForm3.RichViewEdit1Paste(Sender: TCustomRichViewEdit;
var DoDefault: Boolean);
begin
if Sender.CanPasteRVF then
Sender.PasteRVF
else if Sender.CanPasteRTF then
Sender.PasteRTF
else if Clipboard.HasFormat(CF_TEXT) then
Sender.PasteText;
DoDefault := True;
end;
Additionally, pictures or tables can appear as a result of drag&drop. You can exclude formats from AcceptDragDropFormats property.
Re: Problem!
its gonna happen almost after importing HTML files! something like this:viperpix wrote:when i try to use rve.SelectAll , sometimes (many times) an exception: List index out of bounds (0) occurs! whats the problem?
rvc.importRV(od.FileName, rve, 0);
rve.SelectAll;
if i import anythin one time, the next time which i want to import a HTML file out of bounds error bug me!