cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
pmroz
Super User

Text Box Length when Set Width Used

This is a strange problem; maybe I'm missing something simple.  I'm displaying multiline text in a text box, and I'm setting the width of the box via << set width(700).  The weird part is that the length of the text box doesn't adjust for the new width.  In other words I'm getting too much white space below the text.

Here's some code that illustrates the problem:

h1 = "Etymology";

txt1 = "\["Boiler plate" originally referred to the sheet steel used to make boilers.[1]

In the field of printing, the term dates back to the early 1900s. From the 1890s onwards, printing plates of text for widespread reproduction such as advertisements or syndicated columns were cast or stamped in steel (instead of the much softer and less durable lead alloys used otherwise) ready for the printing press and distributed to newspapers around the United States. By analogy, they came to be known as 'boilerplates'. Until the 1950s, thousands of newspapers received and used this kind of boilerplate from the nation's largest supplier, the Western Newspaper Union.[citation needed]

Some companies also sent out press releases as boilerplate so that they had to be printed as written. The modern equivalent is the press release boilerplate, or "boiler," a paragraph or two that describes the company and its products.[citation needed]]\";

h2 = "Boilerplate language";

txt2 = "\[In contractual law, the term "boilerplate language" describes the parts of a contract that are considered standard.

Boilerplate language may also exist in pre-created form letters on the Internet for such things as issues to be broached by a politician based on an issue ad, requests that a cable or satellite operator add a cable network to a system, pre-written complaints about a product that is opposed by groups that create such letters, or online petitions. The person requesting the action usually only needs to type or sign his or her name at the end of the pre-written greeting and body.]\";

h3 = "Boilerplate code";

txt3 = "\[Main article: Boilerplate code

In computer programming, boilerplate is the sections of code that have to be included in many places with little or no alteration. Such boilerplate is particularly salient when the programmer must include a lot of code for minimal functionality. The need for boilerplate can be reduced through high-level mechanisms.

A related phenomenon, bookkeeping code, is code that is not part of the business logic but is interleaved with it in order to keep data structures updated or able to handle secondary aspects of the program.]\";

nwa = new window("Text Test Default Width",

     outline box(h1,

           text box(txt1)

     ),

     outline box(h2,

           text box(txt2)

     ),

     outline box(h3,

           text box(txt3)

     ),

);

nwb = new window("Text Test Set Width",

     outline box(h1,

           text box(txt1, << set width(700))

     ),

     outline box(h2,

           text box(txt2, << set width(700))

     ),

     outline box(h3,

           text box(txt3, << set width(700))

     ),

);


Here's what it looks like:

Text Box Length Bug.png

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: Text Box Length when Set Width Used

Figured it out - found the set wrap method:

nwb = new window("Text Test Set Width",

     outline box(h1,

           tb1 = text box(txt1)

     ),

     outline box(h2,

           tb2 = text box(txt2)

     ),

     outline box(h3,

           tb3 = text box(txt3)

     ),

);

tb1 << set width(700) << set wrap(700);

tb2 << set width(700) << set wrap(700);

tb3 << set width(700) << set wrap(700);

View solution in original post

1 REPLY 1
pmroz
Super User

Re: Text Box Length when Set Width Used

Figured it out - found the set wrap method:

nwb = new window("Text Test Set Width",

     outline box(h1,

           tb1 = text box(txt1)

     ),

     outline box(h2,

           tb2 = text box(txt2)

     ),

     outline box(h3,

           tb3 = text box(txt3)

     ),

);

tb1 << set width(700) << set wrap(700);

tb2 << set width(700) << set wrap(700);

tb3 << set width(700) << set wrap(700);