Project

General

Profile

Actions

Bug #7210

closed

Wt4, Missing alternative for WLayout::clear

Added by Marco Kinski over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Roel Standaert
Target version:
-
Start date:
08/21/2019
Due date:
% Done:

0%

Estimated time:

Description

While changing from wt3 to wt 4.

I have lots of calls to the method WLayout::clear and cannot find a alternative.

So I tried to implement one, but this gives javascript runtime errors on consecutive calls:

while (layout->count() > 0) {
  layout->removeItem(layout->itemAt(layout->count() -1));
}

Files

main.cpp (1.62 KB) main.cpp Marco Kinski, 08/24/2019 01:00 PM
issue_7210.patch (873 Bytes) issue_7210.patch Roel Standaert, 09/06/2019 12:38 PM
Actions #1

Updated by Roel Standaert over 4 years ago

I'm not sure yet what the reasoning was for removing clear() from layouts.

What errors are you getting?

Actions #2

Updated by Roel Standaert over 4 years ago

  • Status changed from New to Feedback
Actions #3

Updated by Marco Kinski over 4 years ago

I attached a code example for reproduction.

Actions #4

Updated by Roel Standaert over 4 years ago

I attached a patch that should fix this. Still checking to make sure I'm not causing some regression with it. Can you check it out, too?

We can probably add clear() again.

Actions #5

Updated by Marco Kinski over 4 years ago

Thx, I Will need a couple days to be sure.

Actions #6

Updated by Marco Kinski over 4 years ago

Please note that I only use Wt::WLayout::setDefaultImplementation(Wt::LayoutImplementation::JavaScript);

I did'nt notice any new problems with the change.

Actions #7

Updated by Roel Standaert over 4 years ago

Do you still experience other issues when the default implementation is Flex instead of JavaScript? I'm trying to eliminate all of them so that setDefaultImplementation(Wt::LayoutImplementation::JavaScript) will not be necessary anymore.

Actions #8

Updated by Marco Kinski over 4 years ago

Many, reaching from widgets getting not shown to wrong propotions and unexpected scrollbars.

I dont think that thies are related to calling layout->clear() I will create examples inside #7187

Actions #9

Updated by Marco Kinski over 4 years ago

The wrong proportion is solved.

I had set a widget to 50% percentage of its parent which showed no effect with javascript sizers.

Actions #10

Updated by Roel Standaert over 4 years ago

It's true that things that may not have had an effect before because the layout would override it, may indeed have an effect now.

Actions #11

Updated by Marco Kinski over 4 years ago

I am surprised this got not patched into 4.1.2.

Do you still need feedback from me?

Actions #12

Updated by Roel Standaert over 4 years ago

  • Status changed from Feedback to InProgress
  • Assignee set to Roel Standaert

That must've been because I didn't particularly like that fix enough to immediately go ahead with it and then overlooked it. I was also thinking of targeting 4.2.0 rather than 4.1.2.

Note: you can also call setLayout() with a new layout on WContainerWidget instead.

Actions #13

Updated by Roel Standaert over 4 years ago

  • Status changed from InProgress to Resolved

I pushed a fix for this JavaScript error. It doesn't quite fix one caveat of JavaScript layouts, though: they don't properly do all of the removal JavaScript for widgets like WTextEdit that reimplement renderRemoveJS.

Actions #14

Updated by Roel Standaert over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF