Project

General

Profile

Actions

Bug #2541

closed

Widgets in Wt::WGridLayout disappear for some rowspan / colspan configurations

Added by Anonymous almost 11 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
01/07/2014
Due date:
% Done:

0%

Estimated time:

Description

As described in this forum thread, WGridLayout seems to swallow widgets when using spans greater than 1. A short test program to reproduce this bug:

#include <Wt/WApplication>
#include <Wt/WColor>
#include <Wt/WContainerWidget>
#include <Wt/WGridLayout>
#include <Wt/WText>

static Wt::WText*
getText(
    const Wt::WString& text,
    const char* colorName
) {
    Wt::WColor color(colorName);
    Wt::WText* widget = new Wt::WText(text);
    Wt::WCssDecorationStyle decoration;
    decoration.setBackgroundColor(color);
    widget->setDecorationStyle(decoration);
    return widget;
}

class GridDemoApplication : public Wt::WApplication
{
public:

    GridDemoApplication(
        const Wt::WEnvironment& env
    ) : Wt::WApplication(env) {
        this->root()->setOverflow(Wt::WContainerWidget::OverflowAuto);
        Wt::WGridLayout* layout = new Wt::WGridLayout(this->root());
        // A
        Wt::WText* a = getText("A", "red");
        layout->addWidget(a, 0, 0, 1, 1);
        // B
        Wt::WText* b = getText("B", "blue");
        layout->addWidget(b, 1, 0, 2, 1);
    }

private:
};

Wt::WApplication 
*createApplication(
    const Wt::WEnvironment& env
) {
    return new GridDemoApplication(env);
}

int 
main(
    int argc, 
    char **argv
) {
    return Wt::WRun(argc, argv, &createApplication);
}

The result of the above should be a page with a red text field above a blue text field, both occupying half the available space. The actual result is that the whole page is red, while the blue text label has a height of zero pixels (as can be seen by inspecting the page source).

Setting the red widget's row spawn to 2 and the blue widget's row span to one results in an almost blank page with red having a zero pixel height and the blue widget nowhere to be found in the page source.

Similar problems occur when switching row and column spans, the only difference being that the widgets have a zero width instead of a zero height.

Actions #1

Updated by Koen Deforche almost 11 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche
  • Target version set to 3.3.2
Actions #2

Updated by Koen Deforche over 10 years ago

  • Status changed from InProgress to Resolved
Actions #3

Updated by Koen Deforche over 10 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF