Hi, im a new fan of your products.
i've recently downloaded the trial version of trichview, that is GREAT!!!
I've also found that in a mixed text, object are known as "item"s, but only thing that i couldn't understand was that "How can i move the Caret Position before/after a specified Item?"
i would like verryy much to buy this component, but i need this ability too!
Thanks.
Moving the Caret Position
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
If you know ItemNo in the document of rve: TRichViewEdit:
Before the item:
After the item:
----
To move the caret to the beginning of the ItemNo-th item in the table cell:
Before the item:
Code: Select all
rve.SetSelectionBounds(ItemNo, rve.GetOffsBeforeItem(ItemNo),
ItemNo, rve.GetOffsBeforeItem(ItemNo));
Code: Select all
rve.SetSelectionBounds(ItemNo, rve.GetOffsAfterItem(ItemNo),
ItemNo, rve.GetOffsAfterItem(ItemNo));
To move the caret to the beginning of the ItemNo-th item in the table cell:
Code: Select all
uses CRVData;
var RVData: TCustomRVFormattedData;
RVData := TCustomRVFormattedData(table.Cells[r,c].Edit);
RVData.SetSelectionBounds(ItemNo, RVData.GetOffsBeforeItem(ItemNo),
ItemNo, RVData.GetOffsBeforeItem(ItemNo));
Moving the Caret Position
Thanks for ur help, but here's the thing:
I just want to move the caret at before and after all images in rve and put those images in new lines by pressing "enter" at before and after each of them;
but i'm wondering why the Enter code (#13#10) wont work in RVE!
How can i achieve this?
Thanks.
I just want to move the caret at before and after all images in rve and put those images in new lines by pressing "enter" at before and after each of them;
but i'm wondering why the Enter code (#13#10) wont work in RVE!
How can i achieve this?
Thanks.
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Code: Select all
procedure PicturesToNewLines(RVData: TCustomRVData; rve: TCustomRichViewEdit);
var i,r,c: Integer;
table: TRVTableItemInfo;
begin
for i := RVData.ItemCount-1 downto 0 do
case RVData.GetItemStyle(i) of
rvsPicture, rvsHotPicture:
begin
if (i<>RVData.ItemCount-1) and not RVData.IsFromNewLine(i+1) then begin
RVData := RVData.Edit;
TCustomRVFormattedData(RVData).SetSelectionBounds(
i, RVData.GetOffsAfterItem(i), i, RVData.GetOffsAfterItem(i));
SendMessage(rve.Handle, WM_KEYDOWN, VK_RETURN, 0);
end;
if not (RVData.IsFromNewLine(i) or ((i>0) and (RVData.GetItemStyle(i-1)=rvsListMarker))) then begin
RVData := RVData.Edit;
TCustomRVFormattedData(RVData).SetSelectionBounds(
i, RVData.GetOffsBeforeItem(i), i, RVData.GetOffsBeforeItem(i));
SendMessage(rve.Handle, WM_KEYDOWN, VK_RETURN, 0);
end;
end;
rvsTable:
begin
table := TRVTableItemInfo(RVData.GetItem(i));
for r := 0 to table.RowCount-1 do
for c := 0 to table.ColCount-1 do
if table.Cells[r,c]<>nil then
PicturesToNewLines(table.Cells[r,c].GetRVData, rve);
end;
end;
end;
Code: Select all
PicturesToNewLines(RichViewEdit1.RVData, RichViewEdit1);
Moving the Caret Position
Thanks again for ur answer, thats helpful. but i really need to have "Enter" ability, so maybe i should use the sendmessage function instead of inserttext! but its not a good idea in all times!
maybe i should wait for an update for RVE which solves this problem.
but for now i think i can handle it by message function.
Thanks for ur guidance.
maybe i should wait for an update for RVE which solves this problem.
but for now i think i can handle it by message function.
Thanks for ur guidance.
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Actually, the only problem with InsertText(#13#10) after a picture is that it adds unnecessary empty text item after the picture. It is not noticeable - you will not see the difference if you replace SendMessage to InsertText in the code above.
But the condition for checking if the picture already ends a paragraph (not RVData.IsFromNewLine(i+1)) does not work with this empty text line, so when this code is called for the second time, empty lines are added after pictures.
A fix will be added in a beta version for registered users later in this weak.
As for the trial version, we plan to update it in the end of this month or at the beginning of the next month.
But the condition for checking if the picture already ends a paragraph (not RVData.IsFromNewLine(i+1)) does not work with this empty text line, so when this code is called for the second time, empty lines are added after pictures.
A fix will be added in a beta version for registered users later in this weak.
As for the trial version, we plan to update it in the end of this month or at the beginning of the next month.