Text Boxes

Although the formatting of an appearance file is set in PopChart Builder and cannot be changed dynamically (unless you override its PCXML), there are several aspects of text boxes that you can change dynamically, including setting the text, enabling drill-down, and hiding a text box.

Setting the Text in a Text Box

One of the most useful things to do with a text box dynamically is to change its text.

PCScript

In PCScript, you can change the text inside of a text box using the textbox. SetText() method. For example, if you have a title text box, you could change its text to Car Inventory using the following command.

title.setText(Car Inventory)

Note: It is useful to have a textbox named title in your appearance file. This way, PopChart Server knows what to name your PopChart image when it generates descriptive text. For more information, refer to "Setting the Title of Your Descriptive Text".

PopChart XML

In PopChart XML, you can change the text inside of a text box by changing the value of the Textbox element itself. For example, if you have a title text box, you could change its text to Car Inventory using the following tag.

<Textbox Name="title">Car Inventory</Textbox>

Drill-Down for a Text Box

You can also enable drill-down effects for a text box. For information about drill-down effects in general, see "Drill-down Effects" in Chapter 7.

PCScript

To add a drill-down effect to a text box, simply use the textbox. DDEnable() method. For example, to add a drill-down link from a text box named textbox to http://mycompany.com, you would use the following PCScript command:

textbox.DDEnable(http://mycompany.com)

PopChart XML

To add a drill-down effect to a text box with PopChart XML, simply add a DrilldownURL attribute to the Text subelement of your Textbox element, as shown in the example below.

<Textbox Name="textbox"><Text DrilldownURL="http://mycompany.com" /></Textbox>

Hiding a Text Box

Another useful feature is the ability to hide a text box. If your appearance file already contains a text box, but you don't want to show it in certain instances, you can use PCScript or PopChart XML to turn it off.

PCScript

To hide a text box in PCScript, simply use the textbox. Hide() method. For example, if your textbox is named title, you can make it disappear with the PCScript command from below.

title.Hide()

PopChart XML

To hide a text box in PopChart XML, simply override its Visible attribute to false. For example, if your text box is named title, you could hide it with the following PopChart XML.

<Textbox Name="title" Visible="false" />

Adding a Text Box with PopChart XML

If your appearance file does not contain a text box, but you would like to add one, you can add a text box by declaring a new Textbox item in PopChart XML. For example, if you wanted to add a textbox containing the text This is a Textbox, you could do it with the following tag:

<Textbox Name="title" Top="400" Left="10" Width="400" Height="50"><Text>This is a Textbox</Text></Textbox>

Important: Be sure to give your text box a distinct name (one that is not already being used).