-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GridLayout issue recalculating prefered size when it items is hidding #3692
Comments
with this commetted lines I could solve the problem seaching item, but other problem is generated inside the GridLayout childs item. //I use this code to recalculate the quantity of rows and colums in the GridLayout CalculateRowsColumnsLayout rc = new CalculateRowsColumnsLayout(qtyServicesMatchInCategory, 4); |
Can you simplify this? |
not this the more simple test case that I can create. You just need to copy paste all that code and call the method containerGridLayoutIssue(); in the start(); of the codenameone app. |
please check your support email where I attached the test case in a file more easy to copy. |
See this with option to search menu(s) in dashboard. Ant and Maven projects https://github.com/Eric-Chomba Dashboard with search |
I have updated the missing Class in the testCase (above) CalculateRowsColumnsLayout |
A better test case: Form hi = new Form("Dynamic Grid", BoxLayout.y());
GridLayout grid = new GridLayout(4, 1);
grid.setAutoFit(true);
Container dynamicGrid = new Container(grid);
grid.setHideZeroSized(true);
TextField amount = new TextField();
Button populate = new Button("Populate");
Button hide = new Button("Hide");
Button show = new Button("Show");
hi.addAll(dynamicGrid, amount, populate, hide, show);
populate.addActionListener(e -> {
final int total = Integer.parseInt(amount.getText());
dynamicGrid.removeAll();
for(int iter = 0 ; iter < total ; iter++) {
dynamicGrid.add(new Label("Lbl " + iter));
}
dynamicGrid.revalidate();
});
hide.addActionListener(e -> {
int total = Integer.parseInt(amount.getText());
for(Component cmp : dynamicGrid) {
boolean hidden = total > 0;
cmp.setVisible(!hidden);
cmp.setHidden(hidden);
total--;
}
dynamicGrid.revalidate();
});
show.addActionListener(e -> {
for(Component cmp : dynamicGrid) {
cmp.setVisible(true);
cmp.setHidden(false);
}
dynamicGrid.revalidate();
});
hi.show(); |
your test case and solution, don't solve the issue describe above. in my real case I create a class GridLayout with your last updates and I used in my test case. as I told you above the GridLayout seaching item don't recalculate correctly the size or the rows. The initial rows is 2 in my test case but when I continue searching and hidding not necessary category. I could check the it rows don't recalculate correctly. the components don't recalculate correctly inside the gridLayout because I was using the method //mb.setShouldCalcPreferredSize(true);
but when I found one item inside the specific category that have a GridLayout in my case. The GridLayout I could understand now that don't recalculate it rows. (see picture above). This the cause of this code in may case.
|
Previous fix didn't cover the auto-sizing method.
----------------------- see: codenameone#3692 the rows didn't recalculating correctly when items was hidden.
this the correct result expected with this solutions here |
Reproduce this with the test case I posted here. |
Please see the attached pdf about the issue
GridLayout issue_040423_1043PM.pdf
this my test case. Just excecute the method containerGridLayoutIssue() in your star() project.
missing Class
The text was updated successfully, but these errors were encountered: