According to the XOJO docs http://documentation.xojo.com/index.php/TextArea.TextStyleData
the TextArea property TextStyleData was DEPRECATED starting with this release.
However it was not Deprecated it was REMOVED… it is no long a property of TextArea
The doc says to use STYLEDTEXT as its replacement but that is not a replacement…
This data can be stored in a ‘styl’ resource and can be set with the SetTextAndStyle method (which also seems to be missing)
TEXTSTYLEDATA contained binary data for the style information… STYLEDTEXT is “everything”
I am trying adapt some code Charles Yeoman wrote years ago… He used EDITFIELD, which I replaced with TEXTAREA
[quote=13943:@Dave S]According to the XOJO docs http://documentation.xojo.com/index.php/TextArea.TextStyleData
the TextArea property TextStyleData was DEPRECATED starting with this release.
However it was not Deprecated it was REMOVED… it is no long a property of TextArea
The doc says to use STYLEDTEXT as its replacement but that is not a replacement…
This data can be stored in a ‘styl’ resource and can be set with the SetTextAndStyle method (which also seems to be missing)
TEXTSTYLEDATA contained binary data for the style information… STYLEDTEXT is “everything”
I am trying adapt some code Charles Yeoman wrote years ago… He used EDITFIELD, which I replaced with TEXTAREA[/quote]
Iterate the style runs in the styled text
‘Styl’ resources aren’t really supported any more
Not an option as I need to transfer the information in that format
Dim styleData As MemoryBlock = ctrl.TextStyleData
Dim fontInfo As MemoryBlock
Dim runCount As Integer = styleData.Short(0)
Dim runStart As Integer = 2
fontInfo = New MemoryBlock(18)
fontInfo.Short(4) = styleData.Short(runStart + 8) //font
fontInfo.Short(6) = styleData.Short(runStart + 10)\\ 256 //styles
fontInfo.Short(8) = styleData.Short(runStart + 12) //size
unless you can come up with a way to access a FONT PICKER
something that has been missing from RealStudio since the beginning
And even if I can make this work… it still calls the CARBON framework
plus the LOCAL help file makes no mention of this being deprecated
and the REMOTE one says it is deprecated, and says the STYL resource is still supported…
both of which are false statements…
Deprecated means… still available but its use should be avoided as it may be removed in a future release
This feature was “removed” completely… which of course will break any RealStudio project that use this property
you say [quote=13948:@Dave S]Not an option as I need to transfer the information in that format[/quote]
where are you transferring it ?
And we’re aware that changes can break projects
Sometimes, like when Apple’s API’s for this no longer exist in Cocoa, we don’t have a choice
Cocoa and it’s text system don’t use ‘styl’ resources - they DO use Attributed Text which is much more like Styled Text
Oh I see - I can’t help you with that one sorry, the Apple mechanism works automagically, you simple add a NSTextView to a window and call the NSFontPanel and while the NSTextView has focus the font panel manipulates it. I’m sure that there is a way to get into the behind the scenes, but I’m afraid it’s beyond my knowledge. Personally I find the Apple font picker counter-intuative because it doesn’t display the actual font, just the name, so I rolled my own for one of our apps.
Well I found this piece of code on the old forum [from Thoma Erwin? (MauiTom)]
But I don’t know how (of if) I can turn the fontArray pointer into a actual Xojo string array
declare function NSClassFromString lib "Cocoa" (aClassName as CFStringRef) as Ptr
// + (NSFontManager *)sharedFontManager
Dim NSManager As Ptr = NSClassFromString("NSFontManager")
Soft Declare Function sharedFontManager Lib "Cocoa" Selector "sharedFontManager" (receiver As Ptr) As Ptr
NSManager = sharedFontManager(NSManager)
// - (NSArray *)availableFonts an array of fonts
Dim fontArray As Ptr = NSClassFromString("NSArray")
//Soft Declare Function availableFonts Lib "Cocoa" Selector "availableFonts" (receiver As Ptr) As Ptr
Soft Declare Function availableFonts Lib "Cocoa" Selector "availableFontFamilies" (receiver As Ptr) As Ptr
fontArray = availableFonts(NSManager)
// - (NSUInteger)count NSArray method
Soft Declare Function count Lib "Cocoa" Selector "count" (receiver As Ptr) As Integer
Dim numFonts As Integer
numFonts = count(fontArray)
MsgBox Str(numFonts)
If so, that gives me all the data (font and families) to roll a really good picker…
[quote=13950:@Dave S]plus the LOCAL help file makes no mention of this being deprecated
and the REMOTE one says it is deprecated, and says the STYL resource is still supported…
both of which are false statements…
Deprecated means… still available but its use should be avoided as it may be removed in a future release
This feature was “removed” completely… which of course will break any RealStudio project that use this property[/quote]
Near as I can tell, TextArea.TextStyleData is unavailable for Cocoa. It is deprecated elsewhere and remains available.