Rich Text in the Clarify Classic Client
Someone recently asked me if the Clarify Classic Client could handle rich text in multi-line text controls – i.e. can text be made bold, italics, use different fonts/colors, etc.
Out of the box – no. Clarify handles plain text only.
But, we can customize Clarify.
One approach to this problem is to use an ActiveX control that supports rich text.
As a proof-of-concept, I downloaded the SpellEditor RichTextBox RTF Control, and slapped it onto the Solution form. (There’s a bunch of available controls out there. I’m not saying this is the best one, but it was sufficient to prove my concept.)
I then added a bit of ClearBasic code:
- During form_load, take the description field contents from the solution’s contextual object, and stuff it into the RTF text property of the control.
- During form_save, take the RTF text from the control, and stuff it into the description field of the solution’s contextual object.
And here’s what we get:
Pretty slick!
Clarify String Limits
One issue that we may need to deal with is that Clarify can only handle strings up to 32K. When using RTF (rich text format), the 32K would include the formatting.
For example, this plain text:
The Dovetail Technology Stack includes:
.NET 1.1, 2.0, 3.5
Javascript
CSS
HTML
Important: Server 2003 is recommended!
(server 2008 is OK as well)
would become this in RTF:
{rtf1ansiansicpg1252deff0deflang1033{fonttbl{f0fnilfcharset0 Trebuchet MS;}{f1fswissfprq2fcharset0 Trebuchet MS;}{f2fnilfcharset0 Calibri;}{f3fnilfcharset0 Times New Roman;}{f4fswissfprq2fcharset0 Calibri;}{f5fnilfcharset0 MS Sans Serif;}{f6fnilfcharset2 Symbol;}}
{colortbl ;red128green0blue0;red255green0blue0;red0green0blue255;red0green0blue0;}
{*generator Msftedit 5.41.15.1507;}viewkind4uc1pardcf1f0fs32 The Dovetail Technology Stack includes:cf2f1par
pard{pntextf6’B7tab}{*pnpnlvlbltpnf6pnindent0{pntxtb’B7}}fi-360li1080cf3 .NET 1.1, 2.0, 3.5par
{pntextf6’B7tab}Javascriptpar
{pntextf6’B7tab}CSSpar
{pntextf6’B7tab}HTMLpar
pardcf2bfs44 Important: Server 2003 is recommended!par
fs28 (server 2008 is OK as well)par
}
Pretty clear how RTF takes up more space.
Looking at the text that you see in the above screenshot, there are 474 characters displayed. But with formatting, it becomes 3246 characters. This means that we’ll need to keep track of the total length, including the formatting. Not hard, just something we’ll need to deal with.
Proof-Of-Concept
Obviously, this isn’t a complete working example – but it does prove that it can be done.
This demonstrates the Extensibility of the Clarify platform.