views:

42

answers:

1

I have an application (IM Client) that I wish to setup custom formatting symbols in similar to mIRC rather than relying on rich text. I will accomplish this by pairing a UniChar 003 with a number 0-15 to process colors and other characters for different things. The only problem that I have is that when these characters are inserted they are invisible so it is difficult for the end user to thus delete them when needed. Is there a way to manipulate NSTextField in a way to show squares for specific invisible characters?

A: 

You could replace them whith a visible character in the Text field, and when the user is done replace them back:

NSString *visibleFormatCharacters=[stringWithInvisibleCharacters stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%c",0x03] withString:@"§"]];

when the user is done do it backwards:

NSString *invisibleFormatCharacters=[visibleFormatCharacters stringByReplacingOccurrencesOfString:@"§"] withString:[NSString stringWithFormat:@"%c",0x03]];
Leg10n