attaching "metadata" to a single character

Martin Baxter mb.ur at
Thu Sep 21 14:26:25 EDT 2006

Josh Mellicker wrote:
> I have a text field, with blocks of text deliniated with the "\" character.
> I am trying to figure out the best way to attach "metadata" to this 
> character.
> The first thing I thought of is that I could alter the color of the 
> character, that would give me three data values up to 255 each (which 
> would probably be enough, but might look weird). I could use the "blue" 
> value to point to a separate numbered group of data with multiple 
> fields, for example, but this complicates the overall scheme, perhaps 
> needlessly.
> I can't use the position of the character or the order of the delimiters 
> as an absolute, because the user will be typing and deleting in the 
> field, copying and pasting sections of the text, so each "\" character 
> will be moved around quite a bit, but I need it to retain special info.
> I need the character to be visible so the user doesn't accidentally 
> highlight a section, cut it and paste it elsewhere without grabbing the 
> "\" character.
> I might go the direction of experimenting with the htmlText of the 
> field, to see if I can put custom tags in without affecting the display, 
> and see if the tags care copied and pasted properly... but I'm not sure 
> what dangers might arise if I mess with the htmlText too much.
> I need something like custom properties of a single character...
> Ideas?
> _______________________________________________

Here's one...

If you aren't using links for anything else, you could use the link 
style on the character of your choice. You could then set its href 
attribute to pretty much anything you like, and retrieve that value 
easily. RR won't change it behind your back, and the attribute will 
travel with it when copied. You can manipulate this without fussing 
around with htmltext.

Martin Baxter

More information about the Use-livecode mailing list