⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Wt
All Projects
Wt
Overview
Activity
Roadmap
Issues
Wiki
Forums
Download (964 Bytes)
Bug #4974
» issue_4974.cpp
Roel Standaert, 03/15/2017 01:14 PM
#include
<Wt/WApplication>
#include
<Wt/WEnvironment>
#include
<Wt/WServer>
#include
<Wt/WContainerWidget>
#include
<Wt/WPushButton>
#include
<unistd.h>
using
namespace
std
;
using
namespace
Wt
;
class
MyApplication
:
public
WApplication
{
public:
MyApplication
(
const
WEnvironment
&
env
)
:
WApplication
(
env
),
t_
(
0
)
{
WPushButton
*
b
=
new
WPushButton
(
"sleep"
,
root
());
b
->
clicked
().
connect
(
std
::
bind
(
&
MyApplication
::
do_sleep
,
this
));
t_
=
new
WText
(
""
,
root
());
}
void
do_sleep
();
private
:
WText
*
t_
;
};
void
MyApplication
::
do_sleep
()
{
std
::
cout
<<
"start of 3 second sleep"
<<
std
::
endl
;
::
sleep
(
3
);
t_
->
setText
(
"Slept 3 seconds"
);
doJavaScript
(
"console.log(
\"
Slept 3 seconds!
\"
);"
);
std
::
cout
<<
"end of 3 second sleep"
<<
std
::
endl
;
}
WApplication
*
createApplication
(
const
WEnvironment
&
env
)
{
return
new
MyApplication
(
env
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
return
WRun
(
argc
,
argv
,
&
createApplication
);
}
« Previous
1
2
Next »
(1-1/2)
Loading...