/
Recipe Exercise

Recipe Exercise

Exercise: Using a Recipe to Adjust Parameters

Recipe Configuration

  1. Begin by creating 4 Tags. The first tag will be named “Record_ID,” its data type will be an INT (INT16), and the initial value will be 0. The second tag will be called “Width”. It will also have a Data Type of INT (INT16) and an Initial Value of 300. There will also be a String tag named “Color”; the Initial Value is #FF0000. Finally, the last tag will be a BOOL tag named “Visibility”; its Initial Value will be set to “True.”

 

 

 

 

  1. Go to Tools > Recipe Editor, or click on Open Recipe Editor… icon within the Toolbar. Click the + to create a new Recipe. The Record ID Tag will be set to the “Record_ID” tag created in Step One. Once that is set, click OK to create the Recipe. Select the new Recipe, and click on Edit Parameter Bindings. Create new Parameters until there are three Parameters; this can be achieved by clicking the + icon on the Tag Binding Page. Set the first parameter tag to be Width, the second should be Color, and the third will be Visibility. Click OK to exit the page.

 

 

  1. Now, double-click the blank cell under Width. Enter a value of 300 here. Again, double-click Color to change the value to #0000FF. Lastly, double-click the empty visibility cell and have the value set to 1. Click OK to exit out of the Recipe Editor.

 

 

  1. Create three Text Boxes and four Rectangles. Three of the Rectangles should be placed on the right side of the screen, while the last one will take up most of the left and middle of the screen. The three Text Boxes will be placed above the final rectangle. The Text Boxes will have the following text: “Edit Width,” “Edit Color,” and “Edit Visibility.”

 

 

  1. Click on the “Edit Width” text box, click the Actions tab, and create a new On Press Command. Select Enter Tag Value; the tag that will be connected to it is “Width.” The Header will say “Set Width Value” with a Subheader of “Min 0, Max 450” and enable Use Min/Max and set the Min to 0 and the Max to 450. Click OK to exit. Select the Edit Color text box, click on the Actions tab, and create a new On Press Command. Select Enter Tag Value; the tag that will be connected to it is “Color.” It will be of the Type Text. The Header will say “Enter Color” with a Subheader of “Use Hex Code.” Click OK to exit. Finally, click on Edit Visibility, then click on the Actions tab and create a new On Press Command. Select Toggle Tag Value and set the tag to “Visibility.” Click OK to exit.

 

 

 

  1. Now add Action Commands to the three Rectangles on the right side. Select the top one, go to the Actions tab, and create a new On Press Command. Select Send Recipe Record, and select the Recipe Database that was created, enable Use Record ID Tag, and the Record ID Tag will be “Record_ID.” Now, in the middle one, go to the Actions tab and create a new On Press Command. Select Recieve Recipe Record, and select the Recipe Database that was created, enable Use Record ID Tag, and the Record ID Tag will be “Record_ID.” For the bottom one, go to the Actions tab and create a new On Press Command. Select Open Recipe Config and select the Recipe that was created.

 

 

 

  1. For the final rectangle, click and drag the tag “Visibility” to the Visibility Field under the Appearance tab. Click and drag the “Color” tag to the Fill field under Appearance. Lastly, drag the “Width” tag to the Width field under the Transform tab.

 

 

Recipe Runtime

  1. Click Tools >Launch Simulator to launch the Canvas Simulator.

 

 

  1. Change the following values: Width to 400, Color to #AB50DE, and keep Visibility at 1.

 

 

  1. Click on the top rectangle. This will change all tag values to what was saved within the Recipe.

 

 

  1. Click the bottom rectangle, and click Add. Insert the following values: Record ID will be 1, Record Name will be “New,” Width will be 400, Color will be #000000, Visibility will be 0. After the following info has been added, click on Save.

 

 

  1. Change the Record_ID to 1, and click on the top rectangle. This will change the tag values to the newly defined ones.

 

 

  1. Toggle Visibility and change the Color to #00FF00. Then click on the Middle Rectangle.

 

 

  1. Now change Width to 100, Color to #0000FF, and toggle visibility again. Once these changes are made, click on the top rectangle. This will switch back to the changes made in Step 6. By clicking on the Middle rectangle, the current tag values are recorded and saved within the Recipe at Record_ID 1. Click on the bottom rectangle to see the changes made to the Recipe.

 

 

Back to Top of Recipes

 

 

 

 

Related content