Placing Objects

Example—Using the properties and method of the Placement node.

  To move an object (graphic) across a dashboard frame:

  1. In Interactive Reporting Studio, select File, then New

    New File is displayed.

  2. Select Other, then A Blank Document, and then click OK.

    The document opens in Design mode.

  3. From Elements, expand Graphics, drag the rectangle onto the dashboard and resize it to be bigger.

  4. Right-click the rectangle, and select Properties.

    Properties is displayed.

  5. In Properties, enter a Name for the rectangle, and click OK.

    For example, type Field. The rectangular shape is the area that the ball graphic moves across.

  6. Optional: Select Border and Background, and change the background color.

  7. From Graphics, drag a picture onto the dashboard, and then navigate to and select an image of a ball.

  8. Right-click the ball graphic, and select Properties.

  9. In Properties, enter a Name for the graphic, and click OK.

    For example, type Ball.

  10. From Elements, expand Controls, and drag an option button onto the dashboard.

    With the option button selected, drag a copy to the right to create a duplicate.

  11. Right-click the first option button, and select Properties.

  12. In Properties, enter a Name, Title, and Group Name, and then click OK.

    For example, type Left as the Name, Move Left 100 as the Title, and LeftRight as the Group Name.

  13. Repeat step 12 for the second option button with alternate data.

    For example, type Right as the Name, Move Right 100 as the Title, and LeftRight as the Group Name.

  14. From Controls, drag a command button onto the dashboard, right-click, and select Properties.

  15. In Properties, enter a Title, and click OK.

    For example, type Move Ball.

  16. Right-click Move Ball again, and select Scripts.

    Script Editor is displayed.

  17. Copy and paste this script into the editor. You can modify the script to suit your requirements.

    var moveHoriz
    if (Right.Checked){
       moveHoriz = 100
    }else{
      moveHoriz = (-100)
    }
    var left = Ball.Placement.XOffset
    var top = Ball.Placement.YOffset
    var width = Ball.Placement.Width
    var height = Ball.Placement.Height
    
    if (moveHoriz > 0){
       if ( left+width+moveHoriz > Field.Placement.XOffset + Field.Placement.Width){
          Alert ("Reached the right end of the field","Goal !!! Yay!!!")
          Ball.Placement.XOffset = Field.Placement.XOffset + Field.Placement.Width - Ball.Placement.Width
          Left.Checked = true
          return
       }
    }else{
       if ( left+moveHoriz < Field.Placement.XOffset){
          Alert ("Reached the left end of the field","Goal !!! Yay!!!")
          Ball.Placement.XOffset = Field.Placement.XOffset
          Right.Checked = true
          return
       }
    }
    Ball.Placement.Modify(left + moveHoriz, top, width, height)
  18. Click OK to close Script Editor.

  19. Press Ctrl+D to exit Design mode, and save the dashboard.