Bug #7210
closedWt4, Missing alternative for WLayout::clear
0%
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
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?
Updated by Marco Kinski over 4 years ago
I attached a code example for reproduction.
Updated by Roel Standaert over 4 years ago
- File issue_7210.patch issue_7210.patch added
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.
Updated by Marco Kinski over 4 years ago
Thx, I Will need a couple days to be sure.
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.
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.
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
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.
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.
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?
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.
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
.
Updated by Roel Standaert over 4 years ago
- Status changed from Resolved to Closed