⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Wt
All Projects
Wt
Overview
Activity
Roadmap
Issues
Wiki
Forums
Download (969 Bytes)
Bug #1380
» scrool-to-posted.cpp
Ok -
Boris Nagaev
, 07/30/2012 06:51 PM
#include
<boost/bind.hpp>
#include
<Wt/WServer>
#include
<Wt/WRandom>
#include
<Wt/WApplication>
#include
<Wt/WTableView>
#include
<Wt/WStringListModel>
using
namespace
Wt
;
class
App
:
public
WApplication
{
public:
App
(
const
WEnvironment
&
env
)
:
WApplication
(
env
)
{
view_
=
new
WTableView
(
root
());
model_
=
new
WStringListModel
();
for
(
int
i
=
0
;
i
<
1000
;
i
++
)
{
model_
->
addString
(
WRandom
::
generateId
());
}
view_
->
setModel
(
model_
);
view_
->
resize
(
500
,
500
);
WServer
::
instance
()
->
post
(
sessionId
(),
boost
::
bind
(
&
App
::
scroll
,
this
));
enableUpdates
();
}
private
:
WTableView
*
view_
;
WStringListModel
*
model_
;
void
scroll
()
{
view_
->
scrollTo
(
model_
->
index
(
900
,
0
));
triggerUpdate
();
}
};
WApplication
*
createApp
(
const
WEnvironment
&
env
)
{
return
new
App
(
env
);
}
int
main
(
int
argc
,
char
**
argv
)
{
return
WRun
(
argc
,
argv
,
&
createApp
);
}
« Previous
1
2
Next »
(1-1/2)
Loading...