PixInsight Forum (historical)

Software Development => PCL and PJSR Development => Topic started by: mschuster on 2012 September 26 16:23:33

Title: PJSR TextBox rich text?
Post by: mschuster on 2012 September 26 16:23:33
TextBox seems to be running in rich text mode.

Basically I have a TextBox t and when I do t.text = "a < b" I get "a  b" in the box (2 spaces, no <). When I do t.text = "a &lt; b" (the tag for <) I get "a < b".

Label has a useRichText property, but TextBox does not seem to. Is it possible to turn off rich text in TextBoxes?

Thanks,
Mike
Title: Re: PJSR TextBox rich text?
Post by: Juan Conejero on 2012 September 26 16:59:58
Hi Mike,

The TextBox PJSR object is the JavaScript counterpart to pcl::TextBox (http://pixinsight.com/developer/pcl/doc/html/classpcl_1_1TextBox.html), which in turn is a PixInsight console, so it provides the whole functionality of pcl::Console (http://pixinsight.com/developer/pcl/doc/html/classpcl_1_1Console.html).

To disable tag interpretation for a block of text, write it between <raw></raw> tags. For example:

Code: [Select]
var box = new TextBox;
box.text = "This is <raw>raw text, where you can include < and >.</raw> However, you can't write < in normal text.";

After a <raw> tag, all tags and character entities are ignored (i.e., handled as plain text) except the </raw> tag.