Wt 4.12.1 problems with WTabWidget
Thanks for the Wt 4.12.1 release with the many bugfixes! I see the following issues with WTabWidget:
When initially rendered, the fist active tab is not highlighted as active anymore. I do see this independend of the theme, it happens with Bootstrap 5, default and polished themes in Firefox and Edge in Windows 10:
Also the sizing-issue for items inserted with ContentLoading::Lazy still exists. Tab 2 is not rendered to full size unless the browser window is a little resized manually or switching tabs:
https://redmine.emweb.be/issues/13861
Could anyone please verify both issues? Sample code that shows the problems:
#include <Wt/WApplication.h>
#include <Wt/WBootstrap5Theme.h>
#include <Wt/WContainerWidget.h>
#include <Wt/WVBoxLayout.h>
#include <Wt/WText.h>
#include <Wt/WTabWidget.h>
#include <Wt/WPanel.h>
using namespace Wt;
std::unique_ptr<WPanel> createDummyPanel(WString title)
{
auto panel = std::make_unique<WPanel>();
auto cont = panel->setCentralWidget(std::make_unique<WContainerWidget>());
cont->decorationStyle().setBackgroundColor(WColor("lightblue"));
cont->addNew<WText>(title);
return panel;
}
std::unique_ptr<WApplication> createHelloApplication(const WEnvironment &env)
{
auto app = std::make_unique<WApplication>(env);
auto theme = std::make_shared<WBootstrap5Theme>();
app->setTheme(theme);
auto vl = app->root()->setLayout(std::make_unique<WVBoxLayout>());
auto tabs = vl->addWidget(std::make_unique<WTabWidget>(), 1);
tabs->addTab(createDummyPanel("Content 1 - Should be Full-Size"), "Tab 1", ContentLoading::Lazy);
// Problem:
// Tab2 isn't rendered full-size on first selection, due to ContentLoading::Lazy
// Tab3 with ContentLoading::Eager is okay
tabs->addTab(createDummyPanel("Content 2 - Should be Full-Size"), "Tab 2", ContentLoading::Lazy);
tabs->addTab(createDummyPanel("Content 3 - Should be Full-Size"), "Tab 3", ContentLoading::Eager);
vl->addWidget(std::make_unique<WText>("Bottom"));
return app;
}
int main(int argc, char *argv[])
{
return Wt::WRun(argc, argv, &createHelloApplication);
}
Thanks,
Stefan
Replies (1)
RE: Wt 4.12.1 problems with WTabWidget - Added by Matthias Van Ceulebroeck 8 days ago
Hello Stefan,
I can verify both bugs are present.
I have scheduled the previously reported one (https://redmine.emweb.be/issues/13861) for the next version, and also added https://redmine.emweb.be/issues/14058 for the visual fix.
As always, thank you for the example, that's handy!
Best,
Matthias