SetItemTag, AllTagsArePChars and integers
Posted: Wed Mar 08, 2006 1:31 pm
Hi there,
For various reasons, I need to use rvoTagsArePChars to store strings in some item tags. However, in other tags, it would be easier to store integers. I'm looking at this code in the Help file:
var Tag: Integer;
S: String;
TagStr: PChar;
// Converting first text item and its tag string to upper case
MyRichView.GetTextInfo(0, S, Tag);
TagStr := StrNew(PChar(Tag));
TagStr := StrUpper(TagStr);
MyRichView.SetItemText(0, UpperCase(S));
MyRichView.SetItemTag(0, Integer(TagStr));
and noticing that the PChar is cast to an integer when storing it in the tag anyway. I also saw in another post that it is possible to "delete" a PChar tag by setting it to 0. If I store a regular integer in a tag with rvoTagsArePChars set, will this cause problems?
Cheers,
Martin
For various reasons, I need to use rvoTagsArePChars to store strings in some item tags. However, in other tags, it would be easier to store integers. I'm looking at this code in the Help file:
var Tag: Integer;
S: String;
TagStr: PChar;
// Converting first text item and its tag string to upper case
MyRichView.GetTextInfo(0, S, Tag);
TagStr := StrNew(PChar(Tag));
TagStr := StrUpper(TagStr);
MyRichView.SetItemText(0, UpperCase(S));
MyRichView.SetItemTag(0, Integer(TagStr));
and noticing that the PChar is cast to an integer when storing it in the tag anyway. I also saw in another post that it is possible to "delete" a PChar tag by setting it to 0. If I store a regular integer in a tag with rvoTagsArePChars set, will this cause problems?
Cheers,
Martin