Formatted Text Control 3.1.0 Alpha 1

If you work with Canvas objects that need text handling in Real Studio/Xojo Cocoa builds you quickly realize that it works vastly different than in Carbon builds.  This is because Carbon apps (through Apple Text Services) gives you a bunch of information for free.  In Cocoa only text controls get that information and that presents some issues to Xojo developers creating custom controls that do keyboard handling.

The Formatted Text Control is a word processor control for Xojo that is based on a canvas subclass and it works in Cocoa – somewhat.  If you try to do any international characters such as é or ü you quickly discover it doesn’t work like it should.  This problem is not unique to just the FTC because the Xojo Code Editor is also based on a Canvas subclass.

Xojo released an open source plugin on Friday for those who want to create custom text controls with international support (and integration with some Cocoa features).  The plugin is available on GitHub for anyone to use.  That page is at and the direct download for the plugin is at (this may change soon).

Formatted Text.debugScreenSnapz001

We’ve been fortunate to work with Xojo Inc in getting the Text Input Canvas plugin for early testing and integration.  This plugin works on Mac, Windows, and Linux and adds a number of events to the canvas control that you have to implement to get it to work.  Among one of the more important events you now need to handle is the DoCommand event.  The OS passes in all of the keyboard events the could happen including arrow key movement, delete and backspace keys, and insert new line to name just a few of the possibilities.  If it’s actual text to be inserted (rather than cursor handling or selection changes) the InsertText event passes in the text as well as the range of the text.  Incomplete text (such as the é and ü) that requires multiple steps in Cocoa get inserted using the SetIncompleteText event.

The control itself then wants to retrieve some data that Cocoa needs by way of several events such as the IncompleteTextRange and SelectedRange events.  This allows the FTC to not only support international text in Cocoa but to also get use some OS level Cocoa goodies.  Hover the cursor over a word and then press Control + Command + d to see the definition of the word just like any other Cocoa app.

Unfortunately, the current download for the plugin doesn’t have much in the way of documentation for how the new events work and what is required for it to function in Cocoa.  This is unfortunate because it’s rather complex and we’ve spent a lot of time working with the plugin and with the Xojo engineers to get the FTC working properly (and we still have some things to work on).  I guess this means that the best example/documentation currently available is the Formatted Text Control.  Again, I expect this to change in the near future.

Today we are releasing FTC version 3.1 alpha 1 for Xojo.  Since this requires the use of the Text Input Canvas plugin this is a Xojo-only solution.  For those still on Real Studio you need to stick with version 3.  Version 3.1 is a free upgrade to anyone that already owns version 3.  All previous versions are eligible for a discounted upgrade.  If you do not have an upgrade coupon from us, please send us an email at support at bkeeney dot com.

If you already are on version 3.0 you should have received email notifications from our File Share application.

UPDATE:  I need to note that building for Carbon isn’t supported in FTC 3.1.  The new plugin is Cocoa, Windows, and Linux compatible.  If you’re building for Carbon you should continue to use version 3.0.

4 thoughts on “Formatted Text Control 3.1.0 Alpha 1

  1. Do you know why they decided to release the plugin as open source instead of integrating it with the product?

    If it could not be integrated with the current canvas, then a canvas subclass or an entirely new control could be added.

    – Karen

  2. @Karen
    Honestly, I’m not sure. We’ll have to get official word from Xojo if they’ll say.

    Just thinking out loud:

    I suspect it’s a support issue. Implementing all of the events so that it works properly is fairly complex and time consuming. We spent a fair amount of time getting it to work with FTC which already had years of development behind it. I suspect that for most Xojo developers it would be beyond their skill/patience level thus causing frustration and them blaming Xojo Inc for a crappy control when in reality it’s just very difficult to use. Perhaps there are just enough custom control developers that could actually use it (not to mention I made a nuisance of myself early in the alpha to be able to get this plugin).

    Additionally, if it’s open source they don’t have to officially support it or even really document it all that well. It clears them of a bunch of obligations that we’d hold them to if they made it part of the product.

  3. I assume you are including the compiled plugin in the FTC distribution?

    In general, not having international character support is a fairly significant omission for Xojo. If you are correct in saying that they think it clears them from a bunch obligations would really be insane on their part. So it would seem to me that is probably not the case. More likely if it was a difficult development as you say, it is better to work it out before putting it into the main stream product.

    As a side note, you previously stated that you used the FTC to render RTF in your “Bkeeney Shorts” product by stripping out the other stuff. Have you considered refactoring the FTC so the FormattedText class inherits from a class called FormattedTextRender and you place all the rendering code in the super class and thus you add a new way/feature to the FTC?

    BTW, when are your “Bkeeney Boxers” and “String Bkeeney” products coming out? 😉

    • Brendan, we are not including it (so far). Of course this is assuming that Xojo Inc actually makes an official page for it. If need be I’ll gladly make one.

      Yes, we have considered refactoring. It’s actually very high on our list because it would be good for a number of reasons. It’s a significant project and we have plenty of things on our plate with consulting at the moment.

      Boxers, String, Wax: All product names we’ve debated. I’m sure there’s plenty more. 🙂

Comments are closed.