---
title: "getControlPos"
canonical: "https://help.vicon.com/space/ShogunPost121/1253738647/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

> Macro (scroll-tablelayout)

|  |
| --- |
| `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;
```

> Macro (scroll-pagebreak)

# Additional information

## Related commands

- [enableControl](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253739268)
- [getControlEnabled](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737474)
- [getControlText](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253738043)
- [getControlVisibility](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737201)
- [getFocus](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737500)
- [setControlAnchor](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253738871)
- [setControlPos](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737132)
- [setControlText](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736614)
- [setControlTip](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253739037)
- [setFocus](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737907)
- [showControl](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736955)