20 setTitle(
"Javascript example");
29 this, std::placeholders::_1));
38 root()->addWidget(std::make_unique<WText>(
"<h2>Wt Javascript example</h2>"
39 "<p>Wt makes abstraction of Javascript, and therefore allows you"
40 " to develop web applications without any knowledge of Javascript,"
41 " and which are not dependent on Javascript."
42 " However, Wt does allow you to add custom Javascript code:</p>"
44 " <li>To call custom JavaScript code from an event handler, "
45 "connect the Wt::EventSignal to a Wt::JSlot.</li>"
46 " <li>To call C++ code from custom JavaScript, use "
47 "Wt.emit() to emit a Wt::JSignal.</li>"
48 " <li>To call custom JavaScript code from C++, use "
49 "WApplication::doJavascript() or Wt::JSlot::exec().</li>"
51 "<p>This simple application shows how to interact between C++ and"
52 " JavaScript using the JSlot and JSignal classes.</p>"));
55 = root()->addWidget(std::make_unique<WText>(
"Current amount: $" +
59 root()->addWidget(std::make_unique<WPushButton>(
"Change ..."));
60 amountButton->setMargin(10, Side::Left | Side::Right);
62 root()->addWidget(std::make_unique<WBreak>());
65 root()->addWidget(std::make_unique<WPushButton>(
"Pay now."));
66 confirmButton->setMargin(10, Side::Top | Side::Bottom);
71 confirmButton->clicked().connect(
confirmPay_->show);