---
title: "getControlPos"
canonical: "https://help.vicon.com/space/Shogun113/84220715/getControlPos"
format: markdown
---
# Description

Gets the position of the user control that is specified by `userControlID`.

intArray holds the x,y coordinates of the 4 points of a rectangle, whose coordinates are relative to the top/left corner of the user window that the control is on.

## Functional area

User Window

# Command syntax

## Syntax

|  |
| --- |
| `getControlPos userControlID` |

### Arguments

| **Name** | **Type** | **Required** | **Comments** |
| --- | --- | --- | --- |
| `userControlId` | int | yes | ID of user control to get position for. |

### Flags

None

## Return value

integer array 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Get the position and size of the User Control
int $windowId;
int $controlId;
int $rect[4]; 
string  $height, $width;
 
// First create a User Window to place the Control on
$windowId = `createWindow "MyWindow"`;
 
// Create a Text Box Control in the window.
$controlId = `createTextBox $windowId`;
 
// Get the rect of the User Control. Since we haven't
// positioned it, it should be the default size, positioned
// at the top corner of the User Window (0, 0)
$rect = `getControlPos $controlId`;
  
// Calculate its width and height
$width = "width: " + string( $rect[2] - $rect[0] );
$height = "height: " + string( $rect[3] - $rect[1] );
print $width;
print $height;
```

# Additional information

## Related commands

- [enableControl](https://vicon-help.atlassian.net/wiki/spaces/Shogun113/pages/84216254)
- [getControlEnabled](https://vicon-help.atlassian.net/wiki/spaces/Shogun113/pages/84220705)
- [getControlText](https://vicon-help.atlassian.net/wiki/spaces/Shogun113/pages/84216994)
- [getControlVisibility](https://vicon-help.atlassian.net/wiki/spaces/Shogun113/pages/84223408)
- [getFocus](https://vicon-help.atlassian.net/wiki/spaces/Shogun113/pages/84223786)
- [setControlAnchor](https://vicon-help.atlassian.net/wiki/spaces/Shogun113/pages/84220914)
- [setControlPos](https://vicon-help.atlassian.net/wiki/spaces/Shogun113/pages/84225692)
- [setControlText](https://vicon-help.atlassian.net/wiki/spaces/Shogun113/pages/84214482)
- [setControlTip](https://vicon-help.atlassian.net/wiki/spaces/Shogun113/pages/84222048)
- [setFocus](https://vicon-help.atlassian.net/wiki/spaces/Shogun113/pages/84219051)
- [showControl](https://vicon-help.atlassian.net/wiki/spaces/Shogun113/pages/84224884)