Page 1 of 1

TRichViewEdit: Move focus centered to a certain Item

Posted: Mon Oct 08, 2007 8:04 am
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

Posted: Tue Oct 09, 2007 12:54 pm
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.

Posted: Tue Oct 09, 2007 7:23 pm
by forestfox
Hello Sergey,

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


Thanks and greetings
forestfox

Posted: Wed Oct 10, 2007 3:47 am
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.