xtd 0.2.0
Loading...
Searching...
No Matches
button3.cpp

demonstrates the use of xtd::forms::form control.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/label>
auto main() -> int {
auto button1_clicked = 0, button2_clicked = 0;
xtd::forms::button button1, button2;
xtd::forms::label label1, label2;
button1.text("Button 1").location({50, 50});
button2.auto_repeat(true).text("Button 2").location({50, 100}).size({200, 75});
label1.text("Button 1 clicked 0 times").location({50, 200}).width(200);
label2.text("Button 2 clicked 0 times").location({50, 230}).width(200);
button1.click += [&] {label1.text(xtd::string::format("Button 1 clicked {} times", ++button1_clicked));};
button2.click += [&] {label2.text(xtd::string::format("Button 2 clicked {} times", ++button2_clicked));};
form1.text("Button 3 example");
form1 << button1 << button2 << label1 << label2;
}
static void run()
Begins running a standard application message loop on the current thread, without a form.
Represents a Windows button control.
Definition button.h:49
virtual const xtd::string & text() const noexcept
Gets the text associated with this control.
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:54
Represents a standard Windows label.
Definition label.h:38
static basic_string format(const basic_string< char > &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...