How do I get text in bold in a textbox?

Reply
Occasional Contributor
Posts: 12

How do I get text in bold in a textbox?

This is a really simple question, and I am probably missing something obvious, but using JSL, how do I get a word in the middle of a textbox to appear in bold?

New Contributor
Posts: 3

Re: How do I get text in bold in a textbox?

With the cursor on top of the text box, right click, then select Font and then Font Style "Bold".

Occasional Contributor
Posts: 12

Re: How do I get text in bold in a textbox?

I wrote my question in a hurry and perhaps I was not clear enough.

I am writing a textbox in JSL and want a single word within that to appear in bold:

textbox("blah blah blah blah blah blah");

If I use:

textbox("blah blah blah blah blah blah", set font style("Bold"));

then this makes the whole box bold, when I only want one word in bold.

Is this possible?

SAS Employee
Posts: 268

Re: How do I get text in bold in a textbox?

Unless there's some way of inserting control characters into the text itself, the only way I can think of approaching it would be to break down the sentence into segments, each of them inside a different text box, and then just string them together something like the following:

tba = text box("   This ", set font style("italic"));

tbb = text box("is a ");

tbc = text box("very ", set font style("bold"));

tbd = text box("tricky question.   ");

nw1 = new window("Demo", hlistbox(tba, tbb, tbc, tbd));

If you don't know how many changes in style you're going to have in advance, you won't know how many text boxes you're going to need, but you could get around that by doing something like this, in which I've also added a border box with lines on all sides around the text:

textlist = {"   This ", "is a ", "very ", "tricky question.   "};

stylelist = {"italic", "", "bold", ""};

hlb = hlistbox();

for(i=1, i<=nItems(textlist), i++,

     hlb << append(textbox(textlist, set font style(stylelist)))

);

nw2 = new window("Demo2", borderbox(hlb, << sides(15)));

Is that of any use?

Occasional Contributor
Posts: 12

Re: How do I get text in bold in a textbox?

Thanks - that is really helpful.  I had a sneaking suspicion it was going to be something like that, but I hadn't managed to figure out the 'how'.

SB1
N/A
Posts: 1

Re: How do I get text in bold in a textbox?

This is a very delayed reply, but I thought I should put it here in case anyone else has a similar question and comes across this thread.

In JMP 11, the textbox() command can accept 3 HTML markups - bold, italic, underlined.

From the scripting index:

win = New Window( "Example", text = Text Box( "Example Text" ) );

text << setText(

    "This is <b>bold</b> text. This is <i>italic</i> text. This is <u>underlined</u> text. This is <b><i><u>bold, italic, underlined</u></i></b> text."

);

text << markup;

Here's a one-line text box script: TB_MyTextBox = text box("My example <b>bold</b> text can also be <i>italicized</i> and <u>underlined</u>, as in <b><i><u>this example</u></i></b>.", <<Markup),

When combining, remember that order of the HTML markups matters. <m1><m2>text</m1></m2> will not work - the markups must be 'closed' in the opposite order they are opened, so </m2></m1>.

Ask a Question
Discussion stats
  • 5 replies
  • 749 views
  • 0 likes
  • 4 in conversation