Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding bookmarks to RTF and jump to them 1

Status
Not open for further replies.

Hokkie

MIS
Nov 21, 2001
77
NL
Hello,

I have a rich text box with a play manuscript, and in a separate window the structure of the manuscript in a treeview (acts and scenes). In the RTF I show one scene at a time, so if the actor learning his lines wants to see the next scene he or she has to select that scene in the treeview and it will pop up in the RTF. So far, no problem.

What I now want to do is add bookmarks within scenes--or rather, have the actor add them. In the treeview with the manuscript structure I want to show these bookmarks as children of the scenes they're added to.

What I cannot figure out is how to add bookmarks to a RTF and how to go there. If the actor wants to go to a particular bookmark, I want the place where that bookmark is in a scene to be at the top of the RTF (even if the bookmark is halfway through a scene).

If you understand what I mean, can you help me figure out how to do this?

Thanks in advance.

when there's too much something is missing
 
If the content of the RichTextBox is going to remain constant, you could store a SelStart value for each of the bookmarks. When a bookmark is selected, set the SelStart value and the RichTextBox control will jump to that point.
Another trick might be to use the SelColor property. If you're not going to allow the user to change the text color, you can use this property to store unique values for certain chunks of text. I don't know much about colors and how different users' color depth settings might effect things but it seems to me that large ranges of values can be used to display the same color. By that I mean, there are alot of numbers that will still make the text look black to the user allowing you to assign unique tags to specific text without changing the appearance of the document.
Kind of a hack but this trick did work for me in a very similar circumstance once.
 
Hi Schroeder,

I have made a small demo implementing your first suggestion, using the .SelStart property of the RTF. This works great for my purposes, and keeps things neat and clean as opposed to the hack sort of thing. A star to you and thanx!
 
Oh--

setting the .SelStart property doesn't always put the bookmark at the top of the RTF (but that's only a minor inconvenience and will be corrected later, I think).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top