Hi there,
I'm writing an editor that has to support hypertext links, but I can't use AllTagsArePChars because I'm using tags for other purposes elsewhere in the code. So I'm looking for advice on the best method of storing and retrieving the URLs associated with hypertext links, using the item tags.
One option is to store the URLs in a StringList as name-value pairs, with some arbitrary number generated for each item:
123456=http://hotpot.uvic.ca/
234567=http://www.halfbakedsoftware.com/
and then retrieve them like this:
URLList.Values[IntToStr(MyRichView.GetItemTag(ItemNo))]
I'd have to ensure the tag values were all unique, of course. Does this seem like a reasonable approach? Has anyone else faced this problem and found a better solution?
All help appreciated,
Martin
Hypertext and URLs
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Since tags may be strings, you can encode any information in them.
For example, tags may be strings like:
(tags must not contain line break and #0 characters, other characters are allowed)
You need to modify you code in OnReadHyperlink, OnWriteHyperlink and OnJump event to work only with "url" part of tags
For example, tags may be strings like:
Code: Select all
url="http://hotpot.uvic.ca/" mydata=15 yes=no
You need to modify you code in OnReadHyperlink, OnWriteHyperlink and OnJump event to work only with "url" part of tags
-
- Posts: 131
- Joined: Mon Aug 29, 2005 12:03 pm
That's a point; I guess I could set AllTagsArePChars and store my integers in the strings too. It'll slow down some other processing which uses integer tags, though.
Have you thought about adding a WideString field to every item by default? It would be SO handy to have a WideString and an integer tag as well.
Cheers,
Martin
Have you thought about adding a WideString field to every item by default? It would be SO handy to have a WideString and an integer tag as well.
Cheers,
Martin
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: