A string object represents a single-line or multi-line text value.

  <string id="title">
      <description>This text will be used as the title for all plots.</description>

  <string id="indeck">
      <description>This is the control file for the program.</description>
      <hints>EXAMPLE:  .print ac vm(11) mag(i(vcc))</hints>
    <default>Enter your SPICE commands
in this area.  Right-click
for a menu of editing options.</default>

A string becomes a multi-line string by setting its <size> to WxH. The width W and height H represent a good size for the text editor. They do not limit the overall size of the text.

The <hints> parameter represents a hint for the user, shown below the editing area.

If binary data is loaded into a string element, it changes to show a binary data icon and information about the data type:

If you expect binary data for a particular string element, you can force the binary display mode by setting the string size to binary as follows:

  <string id="tarfile">
      <label>Archive File</label>
      <description>Upload a gzipped tar file containing the input data</description>

If you specify a <filetype> in your xml the download button will create a file name that concatenates the widget's <label> and <filetype> to create the name of the downloaded file.

  <string id="tarfile">
      <description>Generated data .csv file</description>
55 OMAHA CT,SACRAMENTO,95823</current>

In this example, the output string's <label> is mydata and the <filetype> is .csv. When the user downloads the data, it will be offered to be saved in a file named mydata.csv.

Note that if your <label> was mydata.csv and you don't specify a <filetype> element in the xml, Rappture will look to see if the file is text or binary data. If the file is plain text data, Rappture will offer the name mydatacsv.txt, removing the . in the original label and tacking on a .txt file extension. If the file is binary data, Rappture will offer the name mydatacsv.dat, removing the . in the original label and tacking on a .dat file extension.

You can see working code in the zoo of examples in the string example directory, or on the hub in the directory /apps/rappture/examples/zoo/string. There's also an example of handling binary data.

Last modified 7 years ago Last modified on Jul 17, 2015 11:04:23 AM