TRichViewEdit: Move focus centered to a certain Item

General TRichView support forum. Please post your questions here
Post Reply
forestfox
Posts: 5
Joined: Sat Sep 30, 2006 9:29 pm

TRichViewEdit: Move focus centered to a certain Item

Post by forestfox »

Hello,

I want to move the focus to a certain Item in an TRichViewEdit,
that means the Item should be shown appr. in the middle of
the TRichViewEdit then. Any hints?


Thanks and greetings
Udo
Sergey Tkachenko
Site Admin
Posts: 17332
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can move caret to the end of this item. If this item is not in table cell, and you know its index (ItemNo), the code is:

Code: Select all

rve.SetSelectionBoudns(ItemNo, rve.GetOffsAfterItem(ItemNo),
  ItemNo, rve.GetOffsAfterItem(ItemNo));
The editor will be scrolled to show the caret, but not necessary in the middle of window.
forestfox
Posts: 5
Joined: Sat Sep 30, 2006 9:29 pm

Post by forestfox »

Hello Sergey,

yep, part of my solution. But maybe there is a better one
(middle of the screen)?


Thanks and greetings
forestfox
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post by shmp »

Pardon me for intruding. It seems to me that you want to move an item to the middle of the screen without moving TRichView itself which is like changing the content itself. Why not move the form so that the item looks as if it is in the center of the screen (This way you are not changing the contents of rv at all).

Cheers.
Post Reply