Platforms to show: All Mac Windows Linux Cross-Platform
Back to CFMutableAttributedStringMBS class.
CFMutableAttributedStringMBS.AsNSMutableAttributedString as Variant
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation | MBS MacCF Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
For passing to functions which need a NSMutableAttributedStringMBS.
CFMutableAttributedStringMBS.BeginEditing
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation | MBS MacCF Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
In cases where attributed string might do a bunch of work to assure self-consistency, BeginEditing/EndEditing allow disabling that to allow deferring and coalescing any work. It's a good idea to call these around a set of related mutation calls which don't require the string to be in consistent state in between. These calls can be nested.
CFMutableAttributedStringMBS.Constructor(maxLength as Integer = 0)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation | MBS MacCF Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
maxLength, if not 0, is a hard bound on the length of the attributed string; exceeding this size limit during any editing operation is a programming error. If 0, there is no limit on the length.
See also:
CFMutableAttributedStringMBS.Constructor(str as CFAttributedStringMBS, range as CFRangeMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation | MBS MacCF Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
str: The attributed string to copy.
range: The range of the attributed string to copy. range must not exceed the bounds of Str.
Returns a new attributed string whose string and attributes are copied from the specified range of the supplied attributed string. Raises OutOfMemory exception if there was a problem copying the object. Ownership follows the Create Rule.
See also:
CFMutableAttributedStringMBS.Constructor(str as CFStringMBS, attributeDictionary as CFDictionaryMBS = nil)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation | MBS MacCF Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
str: A string that specifies the characters to use in the new attributed string. This value is copied.
attributeDictionary: A dictionary that contains the attributes to apply to the new attributed string. This value is copied.
Returns an attributed string that contains the characters from str and the attributes specified by attributes. Raises OutOfMemory exception if there was a problem in creating the attributed string.
Note that both the string and the attributes dictionary are copied. The specified attributes are applied to the whole string. If you want to apply different attributes to different ranges of the string, you should use a mutable attributed string.
See also:
CFMutableAttributedStringMBS.EndEditing
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation | MBS MacCF Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
In cases where attributed string might do a bunch of work to assure self-consistency, BeginEditing/EndEditing allow disabling that to allow deferring and coalescing any work. It's a good idea to call these around a set of related mutation calls which don't require the string to be in consistent state in between. These calls can be nested.
CFMutableAttributedStringMBS.MutableString as CFMutableStringMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation | MBS MacCF Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Attributes corresponding to the edited range are appropriately modified. If, as a result of the edit, new characters are introduced into the string, they inherit the attributes of the first replaced character from range. If no existing characters are replaced by the edit, the new characters inherit the attributes of the character preceding range if it has any, otherwise of the character following range. If the initial string is empty, the attributes for the new characters are also empty.
(Note: This function is not yet implemented and will return NULL except for toll-free bridged instances.)
CFMutableAttributedStringMBS.RemoveAttribute(Range as CFRangeMBS, attrName as CFStringMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation | MBS MacCF Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
It's OK for the attribute not the exist over the specified range.
CFMutableAttributedStringMBS.ReplaceAttributedString(Range as CFRangeMBS, Replacement as CFStringMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation | MBS MacCF Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
range should be valid. To delete a range of the attributed string, call ReplaceString() with empty string and specified range.
CFMutableAttributedStringMBS.ReplaceString(Range as CFRangeMBS, Replacement as CFStringMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation | MBS MacCF Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
It's an error for range to specify characters outside the bounds of aStr.
CFMutableAttributedStringMBS.SetAttribute(Range as CFRangeMBS, attrName as CFStringMBS, Value as CFObjectMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation | MBS MacCF Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
value should not be nil.
CFMutableAttributedStringMBS.SetAttributes(Range as CFRangeMBS, replacements as CFDictionaryMBS, clearOtherAttributes as boolean)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation | MBS MacCF Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
If clearOtherAttributes is false, existing attributes (which aren't being replaced) are left alone; otherwise they are cleared. The dictionary should be setup for "usual" CF type usage --- CFString keys, and arbitrary CFType values. Note that after this call, further mutations to the replacement dictionary argument by the caller will not affect the contents of the attributed string.
The items on this page are in the following plugins: MBS MacCF Plugin.