libui/docs/uiButton.md

1.1 KiB

uiButton

uiButton is a control which represents a clickable button.

Windows Unix OS X
Button on Windows Button on Unix Button on OS X

uiButton derives from uiControl.

constructor NewButton()

uiButton *uiNewButton(const char *text);

Creates a new uiButton with the specifed text.

func Text()

char *uiButtonText(uiButton *b);

Returns the text shown on the uiButton. Free the returned string with uiTextFree().

func SetText()

void uiButtonSetText(uiButton *b, const char *text);

Changes the text shown on the uiButton to the given text string.

func OnClicked()

void uiButtonOnClicked(uiButton *b, void (*handler)(uiButton *, void *), void *data);

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?