Author Topic: PJSR TextBox rich text?  (Read 3871 times)

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
PJSR TextBox rich text?
« 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

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PJSR TextBox rich text?
« Reply #1 on: 2012 September 26 16:59:58 »
Hi Mike,

The TextBox PJSR object is the JavaScript counterpart to pcl::TextBox, which in turn is a PixInsight console, so it provides the whole functionality of pcl::Console.

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.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/