Project

General

Profile

Actions

Bug #7210

closed
MK RS

Wt4, Missing alternative for WLayout::clear

Bug #7210: Wt4, Missing alternative for WLayout::clear

Added by Marco Kinski about 7 years ago. Updated almost 7 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

RS Updated by Roel Standaert about 7 years ago Actions #1

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

What errors are you getting?

RS Updated by Roel Standaert about 7 years ago Actions #2

  • Status changed from New to Feedback

MK Updated by Marco Kinski about 7 years ago Actions #3

I attached a code example for reproduction.

RS Updated by Roel Standaert about 7 years ago Actions #4

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.

MK Updated by Marco Kinski about 7 years ago Actions #5

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

MK Updated by Marco Kinski about 7 years ago Actions #6

Please note that I only use Wt::WLayout::setDefaultImplementation(Wt::LayoutImplementation::JavaScript);
I did'nt notice any new problems with the change.

RS Updated by Roel Standaert about 7 years ago Actions #7

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.

MK Updated by Marco Kinski about 7 years ago Actions #8

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

MK Updated by Marco Kinski about 7 years ago Actions #9

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

RS Updated by Roel Standaert about 7 years ago Actions #10

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.

MK Updated by Marco Kinski almost 7 years ago Actions #11

I am surprised this got not patched into 4.1.2.
Do you still need feedback from me?

RS Updated by Roel Standaert almost 7 years ago Actions #12

  • 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.

RS Updated by Roel Standaert almost 7 years ago Actions #13

  • 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.

RS Updated by Roel Standaert almost 7 years ago Actions #14

  • Status changed from Resolved to Closed
Actions

Also available in: PDF Atom