Ignore:
Timestamp:
Dec 13, 2012, 11:24:21 AM (12 years ago)
Author:
garnier
Message:

fix bug #3 : scroll console output

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc

    r176 r177  
    33#include <vector>
    44
     5#include "GWt_pspaApplication.h"
     6#include "GWt_LigneFaisceau.h"
     7#include "GWt_globalParameters.h"
     8#include "GWt_dialog.h"
     9#include "particleBeam.h"
     10#include "bareParticle.h"
     11#include "nomDeLogiciel.h"
     12#include "mixedTools.h"
     13#include "nomdElements.h"
     14
    515#include <Wt/WLineEdit>
    6 #include <Wt/WText>
    716#include <Wt/WGridLayout>
    817#include <Wt/WVBoxLayout>
     
    1726#include <Wt/WFileUpload>
    1827
    19 
    20 #include "GWt_pspaApplication.h"
    21 #include "GWt_LigneFaisceau.h"
    22 #include "GWt_globalParameters.h"
    23 #include "GWt_dialog.h"
    24 #include "particleBeam.h"
    25 #include "bareParticle.h"
    26 #include "nomDeLogiciel.h"
    27 #include "mixedTools.h"
    28 #include "nomdElements.h"
    29 
    3028using namespace Wt::Chart;
    3129
     
    8078  layout->addWidget(beamLine_, 2, 1, 1, 1);
    8179 
    82   console_ = new WTextArea();
     80  console_ = new WContainerWidget();
     81  console_->decorationStyle().setBackgroundColor (WColor("gray"));
    8382  console_->setMaximumSize(600,200);
    8483  layout->addWidget(console_, 3, 1);
    8584  console_->setMinimumSize(300,100);
    86  
     85  console_->setOverflow(WContainerWidget::OverflowAuto); 
     86
    8787  //-----------
    8888  // A supprimer et a mettre en fenetre
     
    477477  // Upload automatically when the user entered a file.
    478478  uploadFileSelectorWidget->changed().connect(uploadFileSelectorWidget, &WFileUpload::upload);
    479   //  uploadFileSelectorWidget->changed().connect(boutonLoadNew, &Wt::WPushButton::disable);
    480479 
    481480  // React to a succesfull upload.
     
    726725  return result;
    727726}
     727
     728void PspaApplication::addConsoleMessage(WString msg) {
     729  WText *w = new WText(console_);
     730 
     731  w->setText(msg);
     732  w->setInline(false);
     733 
     734  /*
     735   * Little javascript trick to make sure we scroll along with new content
     736   */
     737  WApplication *app = WApplication::instance();
     738  app->doJavaScript(console_->jsRef() + ".scrollTop += "
     739                    + console_->jsRef() + ".scrollHeight;");
     740 
     741}
Note: See TracChangeset for help on using the changeset viewer.