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

First we create the very basic xtd::forms program.

Windows

macOS

Gnome

#include <xtd/xtd>
namespace tutorial {
class form_button : public xtd::forms::form {
public:
form_button() {
text("Button");
active_control(button_quit);
button_quit.parent(*this);
button_quit.image(xtd::forms::images::from_name("application-exit", xtd::drawing::size(16, 16)));
button_quit.text("&Quit");
button_quit.location(xtd::drawing::point {20, 20});
button_quit.click += xtd::event_handler {*this, &form_button::on_quit};
}
static auto main() {
}
private:
void on_quit(object& sender, const xtd::event_args& e) {
close();
}
xtd::forms::button button_quit;
};
}
startup_(tutorial::form_button::main);
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.h:54
Stores an ordered pair of integers, which specify a height and width.
Definition size.h:31
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
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
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:54
static xtd::drawing::image from_name(const xtd::string &name)
Gets image object with specified name.
Definition images.h:1268
generic_event_handler<> event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.h:32
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.h:175
@ center_screen
The form is centered on the current display, and has the dimensions specified in the form's size.
@ middle_left
Content is vertically aligned in the middle, and horizontally aligned on the left.