.. default-domain:: cpp .. highlight:: cpp .. namespace:: krpc::services::UI Button ====== .. class:: Button A button that the user can click. Added to a :class:`Canvas` or a :class:`Panel`. | Base class: :class:`Control` .. container:: inherited-members .. rubric:: Inherited Members * From :class:`Control`: :func:`interactable `, :func:`set_interactable `, :func:`color `, :func:`set_color `, :func:`tooltip `, :func:`set_tooltip ` * From :class:`Object`: :func:`rect_transform `, :func:`layout_element `, :func:`visible `, :func:`set_visible `, :func:`remove ` .. function:: Text text() The text for the button. .. function:: bool clicked() .. function:: void set_clicked(bool value) Whether the button has been clicked. .. note:: This property is set to true when the user clicks the button. A client script should reset the property to false in order to detect subsequent button presses. .. function:: bool pressed() Whether the user is holding the button down right now. .. note:: True from the button being pressed until the pointer is released, however far it has moved by then. Polling this repeats an action for as long as the button is held, for nudging a value; :func:`Button::clicked` reports each completed click instead.