The following code example demonstrate the use of button control.
- Windows
-
- macOS
-
- Gnome
-
#include <xtd/xtd>
namespace examples {
class form1 : public form {
public:
form1() {
text("Button example");
label1.text(
ustring::format(
"Button 1 clicked {} times", ++button1_clicked));
};
label2.text(
ustring::format(
"Button 2 clicked {} times", ++button2_clicked));
};
label1.parent(*this);
label1.text("Button 1 clicked 0 times");
label1.location({50, 200});
label1.width(200);
label2.parent(*this);
label2.text("Button 2 clicked 0 times");
label2.location({50, 230});
label2.width(200);
}
private:
label label1;
label label2;
int button1_clicked = 0;
int button2_clicked = 0;
};
}
int main() {
}
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17