2015-04-20 14:16:31 -05:00
# uiButton
uiButton is a control which represents a clickable button.
Windows | Unix | OS X
-----|-----|-----
||
2015-04-20 14:25:46 -05:00
uiButton derives from [uiControl ](uiControl.md ).
2015-04-20 14:29:06 -05:00
## constructor NewButton()
2015-04-20 14:25:46 -05:00
```c
uiButton *uiNewButton(const char *text);
```
Creates a new uiButton with the specifed text.
2015-04-20 14:27:45 -05:00
## func Text()
2015-04-20 14:25:46 -05:00
```c
char *uiButtonText(uiButton *b);
```
Returns the text shown on the uiButton. Free the returned string with `uiTextFree()` .
2015-04-20 14:27:45 -05:00
## func SetText()
2015-04-20 14:25:46 -05:00
```c
void uiButtonSetText(uiButton *b, const char *text);
```
Changes the text shown on the uiButton to the given text string.
2015-04-20 14:29:06 -05:00
## func OnClicked()
2015-04-20 14:25:46 -05:00
```c
2015-04-20 14:27:45 -05:00
void uiButtonOnClicked(uiButton *b, void (*handler)(uiButton *, void * ), void *data);
2015-04-20 14:25:46 -05:00
```
Sets the function that is called when the user clicks the uiButton. The `data` parameter is passed as the second argument to this function. If a handler was previous assigned, this call replaces the old handler with the given one.
The default handler does nothing.
TODO allow NULL to return to default?