How to render only visible nodes inside a ScrollPane? - performance

I'm using JavaFX to show thousands of nodes inside a ScrollPane. It gets laggy on nodes more than about 50. I'm adding each node by pane.getChilderen.add(myNewNode); and then move them to a specific position on the pane. How to make a pane to only render visible items to optimize the performance? Thanks.

Related

Xamarin.UITest: Retrieving elements hidden from screen

I want to write a UI test for my Xamarin.iOS app to make sure that all tableview elements/cells exist on a screen. I could use app.Query(e => e.All()), but this will only retrieve elements that are currently visible on the screen. Is there a way to retrieve all elements (including the ones hidden from the view) in order to assert that the retrieved elements are as expected, without initiating a scroll action?
Any suggestions are greatly appreciated.
There isn't a way to do it directly, but there are methods to scroll list views down to get more items, but the original ones will then be removed from the visual tree.
Table views use cell recycling, so they only creates enough cells to fill the screen. As you scroll cells that are scrolled off the top are 'recycled' and shown on the bottom with new data. This means that the cells of screen actually don't exist - so there is nothing that UI test can access.
I've done it in the past by getting the items and caching some values, scrolling, getting more items, scrolling etc, building up a list of items as I go. Then once there is no more to scroll, checking the values.

Collapsing item in JavaFX Tree View leaves some items improperly rendered

My JavaFX application uses Tree View and tree items are added dynamically added at different points while the program is running. The tree view does not render some tree items after expanding and collapsing items. The following images will make my point clearer.
The first picturing shows the tree after expanding and the second picture show the same tree after collapsing. As you can see the item Plate does not get properly rendered.
Is this a JavaFX bug or have I done something wrong? Also is there a correct way to get it rendered correctly or a workaround if this happens to be a bug?

Swap children's depth

I am using canvas and createjs. I have a container that has an eventListener attached to it so that any child in that container can be selected. When a child is selected I can drag it around on the stage but it is relative to its index so it is above some children and below others. I would like to move the above child to the top index. In flash I was able to swap the depth of that child and I was wondering if there is something similar in Javascript?
Thx.
All you gotta do is:
yourContainer.addChild(selectedChild);
this will pull your object to the top of your display list.

Layout horizontally and multiple lines

I'd like to layout a bunch of child Views horizontally. If children fill a row, they should allocate more space and continue the render process in the next row. This process should continue, as long as children are left to get rendered.
May I use this using Xamarin.Forms views?
There are no wrapping layouts currently in Xamarin.Forms, but you can achieve this quid easily with a RelativeLayout, as it allows to have constraint for childs relative to its parent.

GTK# - Problem with components overlapping upon resize

I have a panel containing a form (elements such as labels and textboxes within a table) and 3 buttons (in an hbuttonbox) at the bottom-right. If I shorten the panel by dragging the bottom border upwards, the 3 buttons come with it, and lay on top of the other form components, causing messy graphics. I would like the panel to not resize smaller than the bottom edge of the last component within it. Due to employer restrictions, I am not able to show a screenshot of the GUI. I will try to make any clarifications that are asked.
This probably has something to do with some resizing or general size settings on the components, but there are so many options that I'm not sure where to start.
Any ideas for an easy fix to this without getting down into the complicated nest of components? If not, any ideas on where I should start messing with settings?
Thanks!
UPDATE:
Everything is contained in a VBox with 3 cells. Elements in cells (top to bottom): Table, ScrolledWindow, HButtonBox. The ScrolledWindow bottom edge also moves (resizes) with the bottom edge of the panel when resizing, until the panel bottom goes above the whole ScrolledWindow. Then the buttons keep moving up, staying in relation to the panel's bottom edge.
By "form" do you mean you are using a Gtk.Fixed to contain your table and buttonbox? Then that's probably what's going wrong - you should use vboxes and hboxes for your layout. These will resize properly. Fixed layouts are only for exceptional cases.
EDIT:
Other suggestions:
Perhaps the HButtonBox has pack type 'end' instead of 'start'?
You could try playing with the 'fill' and 'expand' packing properties of the VBox's children.
I ended up adding a Height Request to the container, just slightly longer than the part of the scrolled window. This now stops resizing to where the bottom buttons would overlap the components above it. The problem (before the fix) is shown below:

Resources