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

Sets the number that appears in a num box user control that is specified by `userControlID`.

Num boxes are text boxes that restrict their input and output to numerical values. The number expected is either a float or an integer. If [createNumBox](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253738203) was used with the `-flt` flag, then all values are interpreted as floats. Otherwise, values are rounded down to the nearest integer (i.e. any decimal value will be truncated).

## Functional area

User Window

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `setNumBoxNum userControlID numVal` |

### Arguments

> Macro (scroll-tablelayout)

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `numVal` | float | yes | Number value to set for the num box. An int can be used as well, and any cast will automatically be made by the num box |
| `userControlId` | int | yes | ID of user control to operate on. |

### Flags

None

## Return value

void 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Set the value on a Num Box User Control
int $windowId;
int $controlId;
float $val;
 
// First create a User Window to place the Control on 
$windowId = `createWindow "MyWindow"`;
 
// Create the User Control on the Window. 
$controlId = `createNumBox $windowId`;
 
// Set the value on the Num Box. Because the Num Box
// was not created with the -flt flag, we are really
// setting the value to be -10.
setNumBoxNum $controlId -10.75;

// Should be -10
$val = `getNumBoxNum $controlId`;
print $val;
```

# Additional information

## Related commands

- [createNumBox](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253738203)
- [getNumBoxNum](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737066)
- [setNumBoxHandler](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736617)