ScrollView - add / remove / add components problem

haxeui-core
#1

When use latest ScrollView ( from new-component-model ) and add components , remove all or some of them and add it again , ScrollView is empty . Is this a bug or need to set some option ?
On the first add everything is ok, but on the second ( after remove ) , scrollview is empty.
I’m using haxeui-openf ( new-component-model ) with target html5

#2

Ok, so removeComponent works , but removeComponentAt bring to empty ScrollView .

#3

Ok, sounds like a bug… any chance for a simple sample to reproduce it?

Cheers,
Ian

#4

Sure. Here is a simple project https://drive.google.com/file/d/1xjuh1xd5WpfMrfE17AfTRkEwHU0Xm3D6/view?usp=sharing
One thing, when did removeComponentAt(1); works, with setting 0 or 2 not. So maybe something with the child objects is wrong?

I’m also include the second bug with hide/show ( described here https://github.com/haxeui/haxeui-core/issues/270 ) , just uncomment the section

/*
		 testVScroll.hide();
         .............
		 Screen.instance.addComponent(bt);
		 */```
#5

Just to add something using removeAllComponents also return empty ScrolView

#6

I’m not sure is this the same bug or other , but if you do :

		testVScroll.removeComponent(hBox2);
		testVScroll.addComponent(hBox2);

for hBox2 you will see only the border, but not the text inside.
Strange, but previous it works ( on ScrollView2 class ) , so maybe something is different / wrong with the current ScrollView class.

#7

Ok, great, ill look at this later today / tomorrow - i need to get my current changes committed first so i can work with a blank change list :slight_smile:

Cheers,
Ian

#8

Hi Ian,
I’m just wondering did you have time to check add/remove problem ?

Thank you.

#9

Whoops… totally forgot about this! Will look later today…

Cheers,
Ian

BTW: i created this issue to track it: https://github.com/haxeui/haxeui-core/issues/276

#10

Replied on GH issue above

Incidentally there are two things to note here, one is related and another is just to “let you know”:

  1. In your original code you were using testVScroll.removeComponentAt(0) - the second parameter to this call (and removeComponent) is dispose=true, this means that you will “destroy” the underlying component which means you may get strange results when adding it again, you can set this to false to avoid this meaning HaxeUI wont try to destroy anything.

  2. I noticed in your “Lorem Ipsum” label you had “\n” (hardbreaks). There is nothing wrong with this ofc, but just in case you didnt know, if you have a width for the label (either fixed or %) then word wrapping will work just fine, eg:

var hBox2 : HBox = new HBox();
...
hBox2.width = 570;
...
var title2 = new Label();
title2.percentWidth = 100;

image

#11

Thank you Ian. Everything works with dispose=true and latest changes.

Just out of curiosity did you manage to fix your SSD and restore information ?

If so , maybe you want to create some private repos on Github ( it’s already free and you can created unlimited ones ) , so keep unfinished things on second location as backup.

Thank you again for your help.

#12

Nope, nothing about the SSD yet… the lab still has it, but im working off the priciple that its all gone (safer that way)… Im backing up work / personal work / documents etc now to a 6TB NAS and then backing up that again online… so, this shouldnt happen again - would still be nice to get the SSD back, but well, we’ll have to wait and see :frowning: