xtd 0.2.0
form_show_hide.cpp

demonstrates the use of xtd::forms::form show, hide and close methods.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/check_box>
#include <xtd/forms/form>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Form show and hide example").client_size({320, 325});
close_button.click += [&] {form2.close();};
show_button.click += [&] {form2.show();};
hide_button.click += [&] {form2.hide();};
form2.client_size({300, 100});
form2.form_closing += [&](auto sender, auto& e) {e.cancel(cancel_close_check_box.checked());};
form2.form_closed += [&] {form2.text(string::format("Close count = {}", ++close_count));};
}
private:
int close_count = 0;
button close_button = button::create(*this, "Close", {10, 10}, {100, 40});
button show_button = button::create(*this, "Show", {10, 60}, {100, 40});
button hide_button = button::create(*this, "Hide", {10, 110}, {100, 40});
check_box cancel_close_check_box = check_box::create(*this, "cancel close", false, check_state::unchecked, {10, 160}, {100, 40});
form form2 = form::create("Close count = 0");
};
auto main() -> int {
application::run(form1 {});
}
static void run()
Begins running a standard application message loop on the current thread, without a form.
Represents a Windows button control.
Definition button.hpp:49
static button create()
A factory to create an xtd::forms::button.
Represents a Windows check_box.
Definition check_box.hpp:45
static check_box create()
A factory to create an xtd::forms::check_box.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
static form create()
A factory to create an xtd::forms::form.
@ e
The E key.
Definition console_key.hpp:96
@ unchecked
The control is unchecked.
Definition check_state.hpp:25
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:217
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8