---
title: "getControlText"
canonical: "https://help.vicon.com/space/ShogunPost121/1253738043/getControlText"
format: markdown
---
# Description

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

Each user control has its own text which is usually displayed with the control. This text is not to be confused with tooltip text, which only gets displayed when a user hovers the mouse over the user control.

For text boxes, the control text is what the user edits. For other user control types, the text is for display only.

Some user controls, like color pickers, don't have any visible text, so this command doesn't have any effect on them.

All user controls have no text by default, unless created using the `-text` option.

## Functional area

User Window

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `getControlText userControlID` |

### Arguments

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

### Flags

None

## Return value

string 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Set the text of a control.
int $windowId;
int $controlId; 
string $controlText;
 
// First create a User Window to place the Control on
$windowId = `createWindow "MyWindow"`;
 
// Create a Text Box Control in the window.
$controlId = `createTextBox $windowId -text "Some Text"`;
 
// Get the text
$controlText = `getControlText $controlId`;
print $controlText;
```

# 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)
- [getControlPos](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253738647)
- [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)
- [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)