haxeui-core icon indicating copy to clipboard operation
haxeui-core copied to clipboard

Cloning hidden Component

Open Shallowmallow opened this issue 3 years ago • 2 comments

Expected Behavior

When cloning a hidden component and showing it, it should be the same as cloning a shown component.

Current Behavior

It doesn't. For example cloning a hidden button , won't clone the button text.

Test app / minimal test case

You can test this code in the builder

<vbox style="padding:5px;border: 1px solid #a9c4e2;">
	<style>
		.standardButton {
			width: 50px;
			height: 50px;
		}
	</style>
	<button text="cloneShown" onClick="var b = buttonS.cloneComponent(); hbox.addComponent(b)"/>
    <button text="cloneHidden" onClick="var b = buttonH.cloneComponent(); hbox.addComponent(b); b.show();"/>
    <hbox id="hbox">
			<button id="buttonS"  text="shown" styleNames="standardButton"/>
            <button id="buttonH"  text="hidden" hidden="true" styleNames="standardButton"/>

	</hbox>
</vbox>

Shallowmallow avatar Jun 15 '22 11:06 Shallowmallow

Nice catch, that should be fixed now - the problem was that the hidden getter also returns the hidden status of its parents - so when it was cloned (c.hidden = this.hidden) it would essentially hide all child components of a hidden parent - showing (or hiding) isnt recursive (rightly so), so this means that the hidden label was never shown again.

Anyways, should be fixed in latest haxeui-core

ianharrigan avatar Jun 15 '22 12:06 ianharrigan

Can this be closed?

ianharrigan avatar Jun 15 '22 15:06 ianharrigan

I think so :)

Shallowmallow avatar Sep 18 '22 21:09 Shallowmallow