33 Understanding Text Block Controls

This chapter contains the following topics:

33.1 Text Block Controls

You can use a text block control to create different text segments and then attach attributes to them. You can format the text segments differently so that each segment looks different. For example, you can create a clickable text segment and add event rules to the Text Clicked event so that you can click the text to connect to a different form. You can also use several system functions with this control. The text block control is particularly useful for Web applications.

33.2 Charts in Text Blocks

You also use text blocks to create graphs like those in the Plant Manager Dashboard application. The graphs you can create are:

  • Bar

  • Combo

  • Line

  • Pie

  • Pie_ontime

  • Stacked_bar

  • Stacked_bar_ontime

The format, fonts and color choices for each chart type are defined by their templates. You cannot change these values.

33.3 Text Block Control Design-Time Considerations

Unlike most Form Deign Aid (FDA) controls, text block properties in the Property Browser do not mirror those in the properties dialog that appears when you double-click the control. Set standard properties (such as height, title, and so forth) in the browser. Create the text strings themselves with the properties dialog. For each text string in the control, you can designate whether it is clickable, and you can control its font and color. For even more control over the appearance of the content of the control, you can include HTML tags as part of the text segments. The tags do not appear at runtime, but the engine formats the control as indicated.

33.4 Text Block Control Charts Design-Time Considerations

XML template files for each chart type are included. Those templates are:

  • bar_basic.xml

  • combo_basic.xml

  • line_basic.xml

  • pie_basic.xml

  • pie_ontime.xml

  • stacked_bar_basic.xml

  • stacked_bar_ontime.xml

You define the template you want to use in an XML file. You then insert the XML file into a text block control, and runtime uses that file to create the graph. This is an example XML file:

<?xml version="1.0" encoding="utf-16"?> <Graph graphName="bar_basic"> ⇒
<O1Title text="Week Ending" visible="true"/> ⇒
<Y1Title text="Production Cost Variance (USD)" visible="true"/> 
 <LocalRelationalData>
   <Row columnKey="1-Sept 05" rowKey="Actual Variance" dataValue="1504" />
   <Row columnKey="8-Sept 05" rowKey="Actual Variance" dataValue="980" />
   <Row columnKey="15-Sept 05" rowKey="Actual Variance" dataValue="-675" />
   <Row columnKey="22-Sept 05" rowKey="Actual Variance" dataValue="784" />
   <Row columnKey="20-Sept 05" rowKey="Actual Variance" dataValue="0" />
 </LocalRelationalData> 
</Graph>

The graphName attribute defines the type of chart you are displaying in your application.

To create the XML file, can write a business function that performs any calculations and then writes the XML to an array variable. You can also use write hard-coded strings within ER. In both of these cases, the encoding of the resulting XML file is UTF-16.

If, however, you write C code business functions and use a tool outside of the JD Edwards EnterpriseOne system to create the XML file, it is likely that the encoding will not be UTF-16. This creates problems when the chart is displayed in the browser. It is recommended that you do not create XML files using any tool or operating that does not use UTF-16 encoding. If you do, you must be sure to set the encoding in the XML file to be the same as your application.

33.5 Text Block Events

Only one event can fire on the text block control during runtime: Text Clicked.

33.6 Text Block Control System Functions

System functions for text block controls are located in the Text Control Functions folder.

This section discusses the system functions for text block controls.


Add Segment

Use this system function to add a text segment (clickable or not) to the text block.

Parameters

Text Control

Input, required. The text control form control (FC) to affect.

Text

Input, required. The content of the text segment to add. Set the parameter to an alphanumeric constant (<Literal>), <Blank>, <Zero>, or an applicable object from the object list.

Font

Input, required. The font (including type, style, color, and so forth) to apply to the text segment. Set the parameter to select a font and its properties (<Pick Font>), or to revert to the default font and property settings (<Reset Font>).

Clickable

Input, required. An indicator of whether the text segment is clickable. Set the parameter to <Yes> or <No>.

SegmentID

Output, required. The variable to which to assign the return value. Set the parameter to an applicable object from the object list.

Returns

This system function returns the ID of the segment you added to the object indicated by SegmentID.


Get Last Clicked Segment

Use this system function to acquire the ID of the segment that was clicked which caused the current event (Text Clicked) to fire.

Parameters

Text Control

Input, required. The text control FC to affect.

SegmentID

Output, required. The variable to which to assign the return value. Set the parameter to an applicable object from the object list.

Returns

This system function returns the ID of the segment just clicked to the object indicated by SegmentID.


Get Segment Information

Use this system function to acquire the textual content of a given segment, along with whether the segment is clickable.

Parameters

Text Control

Input, required. The text control FC to affect.

Text

Output, required. The variable to which to return the textual content of the text segment. Set the parameter to an applicable object from the object list.

Clickable

Output, required. The variable to which to assign the return value. Set the parameter to an applicable object from the object list.

SegmentID

Input, required. The ID of the segment to affect. Set the parameter to an applicable object from the object list.

Returns

This system function returns the text of the segment and an indicator of whether it is clickable to the objects indicated by Text and Clickable, respectively.


Remove Segment

Use this system function to delete a text segment from a given text block control.

Parameters

Text Control

Input, required. The text control FC to affect.

SegmentID

Input, required. The ID of the segment to affect. Set the parameter to an applicable object from the object list.


Update Segment

Use this system function to change text, font, color, and clickability of a given text segment in a text block control.

Parameters

Text Control

Input, required. The text control form control (FC) to affect.

Text

Input, required. The text that you want to display in the text segment. Set the parameter to an alphanumeric constant (<Literal>), <Blank>, <Zero>, or an applicable object from the object list.

Font

Input, required. The font (including type, style, color, and so forth) to apply to the text segment. Set the parameter to select a font and its properties (<Pick Font>), or to revert to the default font and property settings (<Reset Font>).

Clickable

Input, required. An indicator of whether the text segment is clickable. Set the parameter to <Yes> or <No>.

SegmentID

Input, required. The ID of the segment to affect. Set the parameter to an applicable object from the object list.