Page 1 of 1

Scrolling in cells with up down arrows

Posted: Tue Apr 11, 2006 2:43 am
by jwkerns
Actually 2 questions.

1) I have a Richview of cells. If the cursor is in a cell and I use the down key to begin scrolling down , when it reaches the bottom of the cell instead of continuing to the next cell and moves focus all the way to the bottom cell and loses the cursor. Is there to smoothly move the cursor up and down thru the cells?

2) I must be missing something. How does one insert text by code. Say I want to insert a string on the second line in a cell or richview. How do I say what line and position ?

John K

Posted: Tue Apr 11, 2006 8:28 pm
by Sergey Tkachenko
1) Sorry, I do not understand the first question.
Down key at the last cell line must move the caret to the beginning of the cell below the given cell.

2) Should it be an editing operation (which can be undone by user)?

Posted: Wed Apr 12, 2006 2:00 am
by jwkerns
1) Correct. You have any example code or a demo that might demonstrate how to do this?

2) Doesnt matter. I just want to insert text at the beginning of each cell.
Currently I stream in cell. I see I can call cell[].AddNL and then my stream. But that puts the stream text below my NL. I want to call a cell[].InsertText but the cells don't have an insert.

Posted: Wed Apr 12, 2006 9:02 am
by Sergey Tkachenko
1) I still do not understand. This is a default (and the only possible behavior) - moving to the beginning of the lower cell when pressing the Down key

2) As an editing operation:

First, initiate inplace editor for the cell:

Code: Select all

table.EditCell(r, c);
Now, the caret is at the beginning of this cell, and this cell is edited. Editor for the cell is available as RichViewEdit1.TopLevelEditor.
For example, you can move caret to the end of this cell:

Code: Select all

with RichViewEdit1.TopLevelEditor do
  SetSelectionBounds(ItemCount-1, GetOffsAfterItem(ItemCount-1),
    ItemCount-1, GetOffsAfterItem(ItemCount-1));
For inserting, you can use RichViewEdit1.TopLevelEditor.InsertText, or simply RichViewEdit1.InsertText (in all cases, text is inserted in the position of caret, in the top level editor)

Posted: Thu Apr 13, 2006 11:20 am
by jwkerns
1) I tried creating a demo and it works fine in that. Somehow I've broken it. I will dig into it .
2) Thanks . this works the way I want.

Posted: Fri Apr 14, 2006 1:28 am
by jwkerns
1) Figured it out. If formstyle is MDIForm it will goof. Fortunately for me I don't need this as an MDI project. Is that a known limitation with MDI or a bug?

Posted: Sat Apr 15, 2006 8:42 am
by Sergey Tkachenko
I myself use RichViewEdit in MDI application (in an MDI child window), but I cannot reproduce the problem.