PDA

View Full Version : HOWTO: Display Conditional Text Based Upon a List Box Selection


Support
10-15-2002, 11:54 AM
<HTML><HEAD><TITLE>HOWTO: Display Conditional Text Based Upon a List Box Selection</TITLE></HEAD><BODY><h3>HOWTO: Display Conditional Text Based Upon a List Box Selection</h3><b>Document ID: IR04023</b><hr>The information in this article applies to:<ul><li>AutoPlay Media Studio 4.0</li></ul><hr><h3>SUMMARY</h3><p>This article explains how to display conditional text based upon a list box selection.</p><h3>DISCUSSION</h3><p>When a user selects an entry in a list box object in AutoPlay Media Studio 4.0 it is sometimes useful to display some conditional text to the user that will explain their selection. The best way to accomplish this is to use the DATA member of each list box item.</p><p>In general list box items are formatted in the following manner:</p><pre><code>NAME::DATA</code></pre><p>Where <b>NAME</b> is the text that will be displayed in the list box during runtime, and <b>DATA</b> is the data that is associated with this list box item.</p><p>So in order to display conditional text based upon a list box selection we will store the condition text as the DATA member of each list box entry. For example:</p><pre><code>Product1::This is Product one.<br>Product2::This is Product two.<br>Product3::This is Product three.</code></pre><p>Now that we have the conditional text stored in our list box items we simply need a method to retrieve that information, and then display it when the user selects one of the items in the list box. In order accomplish this the following actions can be used on the list box object's "On Selection Change" event: </p><pre><code>%Index% = ListBoxObject[ListBox1].GetSelected<br>%ItemData% = ListBoxObject[ListBox1].GetItemData (%Index%)<br>TextObject[txtDescription].SetText ("%ItemData%")</code></pre><p>The first action gets the index of the currently selected item and stores it in %Index%. The second action then gets the data associated with the list box item at position %Index% and stores it in %ItemData%. At this point %ItemData% holds the conditional text of the currently selected list box item. The last action then sets the text of a Text object named "txtDescription" to %ItemData%. This will display the conditional text in the textbox so that the user can view it. There are other methods that can be used to display the conditional text, but setting the text of a text object is the quickest and easiest.</p><h3>MORE INFORMATION</h3><p>For more information please see the following topics in the AutoPlay Media Studio 4.0 Help:</p><li><b>Command Reference | Actions | List Box Object | Get Selected</b></li><li><b>Command Reference | Actions | List Box Object | Get Item Data</b></li><li><b>Command Reference | Actions | Text Object | Set Text</b></li><li><b>Command Reference | Objects | List Box Object</b></li><p>KEYWORDS: AutoPlay Media Studio 4.0, List Box Object, Conditional Text, Selection</p><hr><FONT SIZE=1>Last reviewed: October 30, 2002<br>Copyright © 2002 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br></FONT></BODY></HTML>