8 #include <Wt/WApplication>
10 #include <Wt/WContainerWidget>
12 #include <Wt/WPushButton>
40 new WText(
"<h2>Wt Javascript example</h2>"
41 "<p>Wt makes abstraction of Javascript, and therefore allows you"
42 " to develop web applications without any knowledge of Javascript,"
43 " and which are not dependent on Javascript."
44 " However, Wt does allow you to add custom Javascript code:</p>"
46 " <li>To call custom JavaScript code from an event handler, "
47 "connect the Wt::EventSignal to a Wt::JSlot.</li>"
48 " <li>To call C++ code from custom JavaScript, use "
49 "Wt.emit() to emit a Wt::JSignal.</li>"
50 " <li>To call custom JavaScript code from C++, use "
51 "WApplication::doJavascript() or Wt::JSlot::exec().</li>"
53 "<p>This simple application shows how to interact between C++ and"
54 " JavaScript using the JSlot and JSignal classes.</p>",
root());
60 amountButton->setMargin(10,
Left |
Right);
98 int main(
int argc,
char **argv)
Popup * promptAmount_
Popup for changing the amount.
void confirmed()
The user has confirmed the payment.
WText * currentAmount_
WText for showing the current amount.
int main(int argc, char **argv)
void setTitle(const WString &title)
Wt::Signals::connection connect(const F &function)
void setAmount(std::string amount)
Set the amount to be payed.
WContainerWidget * root() const
WApplication * createApplication(const WEnvironment &env)
Popup * confirmPay_
Popup for paying.
JavascriptExample(const WEnvironment &env)
Create the example application.
An example showing how to interact custom JavaScript with Wt stuff.