Line | |
---|
1 | #include "GWt_console.h" |
---|
2 | |
---|
3 | #include <Wt/WApplication> |
---|
4 | #include <Wt/WText> |
---|
5 | |
---|
6 | GWt_console::GWt_console() |
---|
7 | :WContainerWidget() |
---|
8 | { |
---|
9 | setObjectName("console"); |
---|
10 | } |
---|
11 | |
---|
12 | |
---|
13 | GWt_console::~GWt_console() |
---|
14 | { |
---|
15 | } |
---|
16 | |
---|
17 | |
---|
18 | void GWt_console::addConsoleMessage(WString msg) { |
---|
19 | |
---|
20 | WText *w = new WText(this); |
---|
21 | w->setTextFormat(PlainText); |
---|
22 | w->setText(msg); |
---|
23 | w->setInline(false); |
---|
24 | |
---|
25 | /* |
---|
26 | * Little javascript trick to make sure we scroll along with new content |
---|
27 | */ |
---|
28 | wApp->doJavaScript(this->jsRef() + ".scrollTop += " |
---|
29 | + this->jsRef() + ".scrollHeight;"); |
---|
30 | |
---|
31 | } |
---|
32 | |
---|
Note: See
TracBrowser
for help on using the repository browser.