Project

General

Profile

Bug #2047

WPopupWidget

Added by Georg Baumann over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
Start date:
07/18/2013
Due date:
% Done:

0%

Estimated time:

Description

Hello,

when using the Wt::WPopupWidget together with the WBootstrapTheme, my WPopupWidget never gets visible (Wt 3.3.0).

Inspecting the HTML-code I figured out, the div of the WPopupWidget has initially the style-property "display: none;" and stlye-class "dropdown-menu". "dropdown-menu" from bootstrap.css declares a "display: none;" too. When klicking the Button, the "display: none;" style-property of the div is removed, but the "display: none;" of the bootstrap.css style-class "dropdown-menu" forces the div to stay hidden.

When removing the line "app->setTheme(new Wt::WBootstrapTheme(app));" in my code, everything works fine. But

Here is my code:

#include <Wt/WTable>
#include <Wt/WTableCell>
#include <Wt/WText>
#include <Wt/WApplication>
#include <Wt/WEnvironment>
#include <Wt/WCssTheme>
#include <Wt/WCssStyleSheet>
#include <Wt/WBootstrapTheme>
#include <Wt/WPushButton>
#include <Wt/WTable>
#include <Wt/WWidget>
#include <Wt/WContainerWidget>
#include <Wt/WString>
#include <Wt/WMenuItem>
#include <Wt/WMenu>
#include <Wt/WPopupWidget>
#include <Wt/WObject>
#include <iostream>
#include <string>
#include <stdlib.h>


class FrameButton : public Wt::WObject
{
public:
    FrameButton(Wt::WPushButton *, Wt::WPopupWidget *);
    Wt::WPushButton *getButton() { return fButton; }

private:
    void buttonClicked();
    Wt::WPushButton *fButton;
    Wt::WPopupWidget *popup;
    bool popuphidden;
};

FrameButton::FrameButton(Wt::WPushButton *button, Wt::WPopupWidget *popupWidget) {
    fButton = button;
    popup = popupWidget;
    popup->positionAt(fButton, Wt::Vertical);
    popup->setTransient(true);
    popuphidden = true;
    fButton->clicked().connect(this, &FrameButton::buttonClicked);
}

void FrameButton::buttonClicked() {
    if (popuphidden) {
        popuphidden = false;
        fButton->setText("Popup verbergen");
    } else {
        popuphidden = true;
        fButton->setText("Popup anzeigen");
    }
    popup->show();
}



Wt::WApplication *createApplication(const Wt::WEnvironment& env)
{
  Wt::WApplication* app = new Wt::WApplication(env);  
  if (app->appRoot().empty()) {
    std::cerr << "!!!!!!!!!!" << std::endl
              << "!! Warning: read the README.md file for hints on deployment,"
              << " the approot looks suspect!" << std::endl
              << "!!!!!!!!!!" << std::endl;
  }
  app->setTheme(new Wt::WBootstrapTheme(app));
  Wt::WContainerWidget *testDiv = new Wt::WContainerWidget();
  Wt::WContainerWidget *buttonContainer = new Wt::WContainerWidget(testDiv);
  Wt::WPushButton *button = new Wt::WPushButton("Popup anzeigen", buttonContainer);
  Wt::WContainerWidget *popupInhalt = new Wt::WContainerWidget();
  // Tabelle 3:
  Wt::WTable *table3 = new Wt::WTable(popupInhalt);
  table3->elementAt(0, 0)->addWidget(new Wt::WText("t @ row 0, t 0"));
  table3->elementAt(0, 1)->addWidget(new Wt::WText("t @ row 0, t 1"));
  table3->elementAt(1, 0)->addWidget(new Wt::WText("t @ row 1, t 0"));
  table3->elementAt(1, 1)->addWidget(new Wt::WText("t @ row 1, t 1"));
  Wt::WPopupWidget *popWid = new Wt::WPopupWidget(popupInhalt);
  FrameButton *builder = new FrameButton(button, popWid);
  buttonContainer->addWidget(builder->getButton());
  app->root()->addWidget(testDiv);
  return app;
}


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

Kind regards

#1

Updated by Wim Dumon over 8 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche

This is indeed an issue in Wt.

Assigned to Koen in order to confirm if the proposed solution (adding w.style.display='block'; in Wt.js in front of fitToWindow) is an acceptable solution.

#2

Updated by Koen Deforche over 8 years ago

  • Status changed from InProgress to Resolved

A fix from my local git is on its way.

#3

Updated by Koen Deforche over 8 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF