Rectangle

Rectangle

The Rectangle is a graphical shape object that allows you to draw squares or rectangles on your screen.

Similar to the Ellipse object, its most common use case is to serve as a “status indicator” by changing its FillColor based on the state of a tag. Additionally, it can be used to draw a visual frame around a group of items.

Common Use Cases
  • Status Indicators: Using it as a square light (instead of an ellipse) to show a motor’s status (e.g., Red = Fault, Green = Running, Gray = Stopped).
  • Visual Grouping: Drawing a simple background or frame around a group of controls (e.g., 5 Labels) without using a Panel or GroupBox.
  • Clickable Area: Using the Click event to open a relevant detail screen when a visual square (e.g., a square representing “Area 1”) is clicked.

Properties Panel – Key Properties

The power of this object, as with the Ellipse, comes from its ability to bind its fill color directly to tags.

  • Fill Color
    • The FillColor can be bound to different states of a tag using the + New (New Condition) button.
  • Fore Color (Line Color)
    • Similar to FillColor, you can dynamically bind the color of the rectangle’s outline to a condition.

Events

  • Mouse Up/Down:
    • Function: Allows the operator to click on the rectangle shape.
    • Use Case: Triggers the Screen -> Open Screen function to open a pop-up or navigate to a relevant detail screen when the shape is clicked.

Advanced Panel – Key Properties

The Advanced panel defines the default (static) appearance and style of the rectangle.

  • FillColor (Default Fill Color)
    • The default fill color of the shape. Usually set to the “unknown status” or “stopped” color (e.g., Gray).
  • ForeColor (Default Line Color)
    • The default color of the outline.
  • LineWidth
    • The pixel thickness of the outline. If only a solid square (borderless) is desired, LineWidth can be set to 0, or the ForeColor and FillColor can be set to the same color.
  • LineStyle
    • Determines the style of the outline (Solid, Dash, Dot, etc.).

Common Usage Examples

Example 1: Dynamic Valve Status Indicator

  1. Add a Rectangle to the screen.
  2. Set the Size property to 40, 40 (width=40, height=40) to ensure it is a square.
  3. Go to the object’s Properties -> Fill Color property:
    • Set the Default color to Gray (This represents the “Closed” state, value 0).
    • Add + New (Condition 1):
      • Condition: Valve_Status_Bit = “true”
      • Value: Green

Result: The Rectangle object acts as a status indicator, taking on Gray (Closed) or Green (Open) colors based on the valve’s status.

Example 2: Static Background Frame
To draw a background to visually group a set of Labels.

  1. Add a Rectangle to the screen. Set the Size property to 300, 150.
  2. Go to the Advanced panel:
    • FillColor: Control (or a light gray tone).
    • LineWidth: 1.
    • ForeColor: ControlDark (A frame color slightly darker than the fill color).
  3. Place your Label objects on top of this Rectangle object on the screen.
    • Important: Ensure the Rectangle object is positioned behind the Labels (Send to Back).

Result: Your Labels are visually grouped within a clean frame without using a GroupBox or Panel.

Leave a Reply