Project

General

Profile

improper refresh() on WPaintedWidget

Added by Marcel Ebmer about 14 years ago

I am running into the problem, that WPaintedWidgets are not correctly repainted when the user hits the refresh button.

Only WPainter::drawText works normally, all other drawing methods do absolutely nothing.

What could i have done wrong?


Replies (2)

improper refresh() on WPaintedWidget - code - Added by Marcel Ebmer about 14 years ago

some simplified code...

void MyClass::paintEvent(WPaintDevice* device) {
    WPainter painter(device);
    painter.fillRect(2, 2, _w - 4, _h - 4, _blue);
    painter.setPen(_greypen);
    painter.drawRect(1, 1, _w - 2, _h - 2);
    painter.setPen(_whitepen);
    painter.setFont(_largefont);
    painter.drawText(4, _h / 18, _w - 8, _h / 2, AlignCenter|AlignBottom, "foo");    //works on WApplication::refresh()
    painter.setFont(_smallfont);
    painter.drawText(4, _h / 2 + _h / 18, _w - 8, _h / 2 - 8, AlignCenter|AlignTop, "bar");    //works on WApplication::refresh()
}

RE: improper refresh() on WPaintedWidget - Added by Koen Deforche about 14 years ago

Hey Marcel,

This was a missing initialization problem.

The following patch (or latest public git) should fix this.

Regards,

koen

diff ---git a/src/Wt/WApplication.C b/src/Wt/WApplication.C

index ceeb0d0..babb4b7 100644

---- a/src/Wt/WApplication.C

  • b/src/Wt/WApplication.C
    @@ --70,6 +70,7 @@ WApplication::WApplication(const WEnvironment& env)
    loadingIndicator_(0),
    connected_(true),
    bodyHtmlClassChanged_(false),
  • enableAjax_(false),
    scriptLibrariesAdded_(0),
    theme_("default"),
    styleSheetsAdded_(0),
    (1-2/2)