Hi.
In my application I scan the text (from ScaleRichView) and then I write in a listbox a few lines that look like this: "Line x Col y: Some problem". Each line in listbox is associated with a TPoint in which x is ItemNo and y is Offs (in item). When the user double clicks on that line in listbox then with SetSelectionBounds the cursor is moved to that position.
Problem is that the user sometimes is deleting text, inserting something or using Undo/Redo. So some items in listbox may become unusable and some may have to be resynchronized.
For this I need a method that is fast (so the user doesn't wait seconds when is modifying the text). So I understand that can't be 100% precise...
I tried to store the cursor position and selection length at OnChanging event but it's not working. Even if it would work it would not helped me with Undo/Redo.
Any ideas?
Thank you in advance.
resynchronizing
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
For example: I scan the text and if I found this "It's a beautifull day ;!" then I place a line in listbox saying "Line 3 Col 20: you must remove ';' character". It's just an example - the messages in my language are more sofisticated..
The user may start fixing the text or may start doing something else. My application has to try to resynchronize this lines (from listbox). ItemNo and Offs at least but it would be great also with "Line x Col y"...
The user may start fixing the text or may start doing something else. My application has to try to resynchronize this lines (from listbox). ItemNo and Offs at least but it would be great also with "Line x Col y"...
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
It's a good idea. Thank you.
Just a problem: checkpoints are associated with items not with a specific position inside items. So if there are several problems in a text item how can I assign a checkpoint to each of them?
Let's say that I will use SetCheckpointInfo to add a invisible checkpoint to a item. The ATag parameter will be the index of the message from the listbox. With GetItemCheckpoint I have to check every item from text (slow). Is there a way to access the "checkpoint array" to find the specific checkpoint (when I double click on a line in listbox)?
Just a problem: checkpoints are associated with items not with a specific position inside items. So if there are several problems in a text item how can I assign a checkpoint to each of them?
Let's say that I will use SetCheckpointInfo to add a invisible checkpoint to a item. The ATag parameter will be the index of the message from the listbox. With GetItemCheckpoint I have to check every item from text (slow). Is there a way to access the "checkpoint array" to find the specific checkpoint (when I double click on a line in listbox)?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
So you say that when i scan the text I have to move the caret to each problem? Isn't this slow (especially on ScaleRichView which in slow)?The method InsertCheckpoint inserts the checkpoint at the caret position. If it is in the middle of the item, the item will be splitted.
Plus I have to scan again the text from editor because if the item is splitted then all position of the items (that are stored in an integer array) after this item will be no longer valid...
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I have implemented checkpoints and it works fine. Thank you very much for your help.
Just 2 things:
1. I noticed that you can find checkpoints inserted as bookmarks in Word but you can't use their CheckpointData to find, for example, item number. The code gives error "Invalide CheckpointData".
2. In help at GetLineNo you say "There is an idea how to make it lightning-fast in future, but it will be implemented later". Maybe you'll implement a faster GetLineColNo (with a TPoint as result for example) in the near future. This would help me to resynchronize "Line x Col y" from that listbox. For now I can't use it (or make one myself) because it's slow on large texts...
Just 2 things:
1. I noticed that you can find checkpoints inserted as bookmarks in Word but you can't use their CheckpointData to find, for example, item number. The code gives error "Invalide CheckpointData".
2. In help at GetLineNo you say "There is an idea how to make it lightning-fast in future, but it will be implemented later". Maybe you'll implement a faster GetLineColNo (with a TPoint as result for example) in the near future. This would help me to resynchronize "Line x Col y" from that listbox. For now I can't use it (or make one myself) because it's slow on large texts...