Scrolling in cells with up down arrows

General TRichView support forum. Please post your questions here
Post Reply
jwkerns
Posts: 15
Joined: Sun Mar 05, 2006 11:17 pm

Scrolling in cells with up down arrows

Post 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
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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)?
jwkerns
Posts: 15
Joined: Sun Mar 05, 2006 11:17 pm

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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)
jwkerns
Posts: 15
Joined: Sun Mar 05, 2006 11:17 pm

Post 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.
jwkerns
Posts: 15
Joined: Sun Mar 05, 2006 11:17 pm

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I myself use RichViewEdit in MDI application (in an MDI child window), but I cannot reproduce the problem.
Post Reply