Changing the Value of a Text Dynamically

In this tutorial we’ll simulate a text that, when clicked, allows you to directly edit it, and replace the value of the original text with that entered by the user.

  • Drag a Dynamic Panel. Right click on it and select ‘Edit contents’. Then, drag a label inside the panel.
  • Select the dynamic panel and create a new panel.
  • Insert a text input in the new panel. Drag also a button.
  • Select the button you placed in the second panel and click Add Event (in the Event tab).
  • Choose the ‘Set active panel’ option and select the first panel (it’s easier if you use the Outline tab). Click OK. The event that you just created is displayed in the Events tab.
  • Click the arrow next to the word “Do” in the Events tab. In the open context menu, click ‘Add Action’.
  • Now choose Set Value, go to the first panel of the dynamic panel, and select the label.
  • Click on the calculator button at the bottom of the dialog.
  • In the Screen tab, select the second panel of the Dynamic Panel and drag the input text element to the expression (in the dotted box).
  • Click OK and return to the Event dialog box. Click OK again. You selected all the necessary commands so that when the user clicks the button, the text entered goes to the first panel.
  • Select the label on the first panel, go to the Events tab and push the ‘Add event’ button. Select ‘set active panel’ and select the second panel. Push ok.
  • Click the Simulate button to verify the results: the user can replace the original text by clicking on it.

Leave a reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>