Project

General

Profile

Actions

Bug #6884

closed

Unable to pre-hide WContainerWidget that using flexbox layout

Added by Apivan Tuntakurn about 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
02/06/2019
Due date:
% Done:

0%

Estimated time:

Description

When I supply the layout to the WContainerWidget and call setHidden(true), the WContainerWidget does not hide.

    auto widget = root()->addWidget(std::make_unique<Wt::WContainerWidget>());
    auto layout = widget->setLayout(std::make_unique<Wt::WVBoxLayout>());
    layout->setPreferredImplementation(Wt::LayoutImplementation::Flex);

    //The problem is not reproducible with js implementation. 
    //layout->setPreferredImplementation(Wt::LayoutImplementation::JavaScript);

    layout->addWidget(std::make_unique<Wt::WText>("some text."));
    widget->setHidden(true);

A workaround is to call a javascript to hide it.

widget->doJavaScript(Wt::WString(R"($("#{1}").hide())").arg(widget->id()).toUTF8());
Actions #1

Updated by Apivan Tuntakurn about 5 years ago

My pull request:

[[[https://github.com/emweb/wt/pull/152]]]

Actions #2

Updated by Roel Standaert about 5 years ago

It looks like it goes a bit deeper than that.

Changing styleDisplay() like that works fine, and toggling visibility works properly if hiddenKeepGeometry() is off.

However, we should not set display to none when it's on (easy tweak, just add an extra check for that), but it appears that that still breaks toggling visibility.

Actions #3

Updated by Roel Standaert about 5 years ago

  • Status changed from New to Resolved

I pushed a fix

Actions #4

Updated by Roel Standaert over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF